Merge pull request #1777 from lexe-tech/max/best-block-header-best-block
[rust-lightning] / lightning-block-sync / src / convert.rs
index 358076f4c25a883f5e571b421f9d3ff1ebe20f27..ed28833b7b30d4986fe53e2801d2ddaf43dcf765 100644 (file)
@@ -15,6 +15,7 @@ use serde_json;
 use std::convert::From;
 use std::convert::TryFrom;
 use std::convert::TryInto;
+use bitcoin::hashes::Hash;
 
 /// Conversion from `std::io::Error` into `BlockSourceError`.
 impl From<std::io::Error> for BlockSourceError {
@@ -57,7 +58,7 @@ impl TryInto<BlockHeaderData> for JsonResponse {
 
                // Add an empty previousblockhash for the genesis block.
                if let None = header.get("previousblockhash") {
-                       let hash: BlockHash = Default::default();
+                       let hash: BlockHash = BlockHash::all_zeros();
                        header.as_object_mut().unwrap().insert("previousblockhash".to_string(), serde_json::json!(hash.to_hex()));
                }
 
@@ -182,7 +183,7 @@ impl TryInto<Txid> for JsonResponse {
 }
 
 /// Converts a JSON value into a transaction. WATCH OUT! this cannot be used for zero-input transactions
-/// (e.g. createrawtransaction). See https://github.com/rust-bitcoin/rust-bitcoincore-rpc/issues/197
+/// (e.g. createrawtransaction). See <https://github.com/rust-bitcoin/rust-bitcoincore-rpc/issues/197>
 impl TryInto<Transaction> for JsonResponse {
        type Error = std::io::Error;
        fn try_into(self) -> std::io::Result<Transaction> {