Unverified Commit 46e2d840 authored by Roman Zeyde's avatar Roman Zeyde
Browse files

Fix RPC to return raw headers

(following Electrum 1.2 protocol spec)
parent ca82a585
......@@ -59,8 +59,10 @@ impl Connection {
fn blockchain_headers_subscribe(&mut self) -> Result<Value> {
let entry = self.query.get_best_header()?;
self.last_header_entry = Some(entry.clone());
Ok(jsonify_header(&entry))
let hex_header = hex::encode(serialize(entry.header()).unwrap());
let result = json!({"hex": hex_header, "height": entry.height()});
self.last_header_entry = Some(entry);
Ok(result)
}
fn server_version(&self) -> Result<Value> {
......@@ -221,7 +223,8 @@ impl Connection {
let entry = self.query.get_best_header()?;
if *last_entry != entry {
*last_entry = entry;
let header = jsonify_header(last_entry);
let hex_header = hex::encode(serialize(last_entry.header()).unwrap());
let header = json!({"hex": hex_header, "height": last_entry.height()});
result.push(json!({
"jsonrpc": "2.0",
"method": "blockchain.headers.subscribe",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment