[dependencies]
bitcoin = "0.29"
-lightning = { version = "0.0.111" }
-lightning-block-sync = { version = "0.0.111", features=["rest-client"] }
-lightning-net-tokio = { version = "0.0.111" }
+lightning = { version = "0.0.112" }
+lightning-block-sync = { version = "0.0.112", features=["rest-client"] }
+lightning-net-tokio = { version = "0.0.112" }
tokio = { version = "1.14.1", features = ["full"] }
tokio-postgres = { version="0.7.5" }
futures = "0.3"
self.native_router.get_next_node_announcement(starting_point)
}
- fn peer_connected(&self, their_node_id: &PublicKey, init: &Init) {
+ fn peer_connected(&self, their_node_id: &PublicKey, init: &Init) -> Result<(), ()> {
self.native_router.peer_connected(their_node_id, init)
}
let mut buffered_reader = BufReader::new(file);
let network_graph_result = NetworkGraph::read(&mut buffered_reader, logger);
if let Ok(network_graph) = network_graph_result {
- network_graph.remove_stale_channels();
+ network_graph.remove_stale_channels_and_tracking();
println!("Initialized from cached network graph!");
network_graph
} else {
.truncate(true)
.open(&cache_path)
.unwrap();
- self.network_graph.remove_stale_channels();
+ self.network_graph.remove_stale_channels_and_tracking();
let mut writer = BufWriter::new(file);
self.network_graph.write(&mut writer).unwrap();
writer.flush().unwrap();
use bitcoin::hashes::Hash;
use lightning::chain;
use lightning::chain::AccessError;
-use lightning_block_sync::BlockSource;
+use lightning_block_sync::{BlockData, BlockSource};
use lightning_block_sync::http::BinaryResponse;
use lightning_block_sync::rest::RestClient;
let block_hash = BlockHash::from_slice(&block_hash).unwrap();
let block_result = self.rest_client.get_block(&block_hash).await;
- let block = block_result.map_err(|error| {
- eprintln!("Couldn't retrieve block {}: {:?} ({})", block_height, error, block_hash);
- AccessError::UnknownChain
- })?;
- Ok(block)
+ match block_result {
+ Ok(BlockData::FullBlock(block)) => {
+ Ok(block)
+ },
+ Ok(_) => unreachable!(),
+ Err(error) => {
+ eprintln!("Couldn't retrieve block {}: {:?} ({})", block_height, error, block_hash);
+ Err(AccessError::UnknownChain)
+ }
+ }
}) })
}
}