Fix CI compilation in beta environment.
[rapid-gossip-sync-server] / src / verifier.rs
index 6813ff7d3dd766da51d0ae23779e27f2ea8c76de..c44cb663158e19d7e1c850b22bd57f6f952665c1 100644 (file)
@@ -1,8 +1,9 @@
-use std::convert::TryInto;
+use std::io::ErrorKind;
 use std::ops::Deref;
 use std::sync::Arc;
 use std::sync::Mutex;
 
+use bitcoin::blockdata::constants::ChainHash;
 use bitcoin::{BlockHash, TxOut};
 use bitcoin::blockdata::block::Block;
 use bitcoin::hashes::Hash;
@@ -64,7 +65,15 @@ impl<L: Deref + Clone + Send + Sync + 'static> ChainVerifier<L> where L::Target:
                let block_hash_result =
                        client.request_resource::<BinaryResponse, RestBinaryResponse>(&uri).await;
                let block_hash: Vec<u8> = block_hash_result.map_err(|error| {
-                       log_error!(logger, "Could't find block hash at height {}: {}", block_height, error.to_string());
+                       match error.kind() {
+                               ErrorKind::InvalidData => {
+                                       // the response length was likely 0
+                                       log_error!(logger, "Could't find block hash at height {}: Invalid response! Please make sure the `-rest=1` flag is set.", block_height);
+                               }
+                               _ => {
+                                       log_error!(logger, "Could't find block hash at height {}: {}", block_height, error.to_string());
+                               }
+                       }
                        UtxoLookupError::UnknownChain
                })?.0;
                let block_hash = BlockHash::from_slice(&block_hash).unwrap();
@@ -84,7 +93,7 @@ impl<L: Deref + Clone + Send + Sync + 'static> ChainVerifier<L> where L::Target:
 }
 
 impl<L: Deref + Clone + Send + Sync + 'static> UtxoLookup for ChainVerifier<L> where L::Target: Logger {
-       fn get_utxo(&self, _genesis_hash: &BlockHash, short_channel_id: u64) -> UtxoResult {
+       fn get_utxo(&self, _genesis_hash: &ChainHash, short_channel_id: u64) -> UtxoResult {
                let res = UtxoFuture::new();
                let fut = res.clone();
                let graph_ref = Arc::clone(&self.graph);