From: Matt Corallo Date: Thu, 27 Oct 2022 18:01:37 +0000 (+0000) Subject: Update LDK to 0.0.112 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=df908c814c701f5a19e55706e7716dc0647dcda0;p=rapid-gossip-sync-server Update LDK to 0.0.112 --- diff --git a/Cargo.toml b/Cargo.toml index 79fa1d7..852c7c2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,9 +5,9 @@ edition = "2018" [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" diff --git a/src/downloader.rs b/src/downloader.rs index 504db2a..4fc3d51 100644 --- a/src/downloader.rs +++ b/src/downloader.rs @@ -106,7 +106,7 @@ impl RoutingMessageHandler for GossipRouter { 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) } diff --git a/src/lib.rs b/src/lib.rs index 01bc570..bf61b40 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -60,7 +60,7 @@ impl RapidSyncProcessor { 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 { diff --git a/src/persistence.rs b/src/persistence.rs index 51c242b..99fab32 100644 --- a/src/persistence.rs +++ b/src/persistence.rs @@ -189,7 +189,7 @@ impl GossipPersister { .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(); diff --git a/src/verifier.rs b/src/verifier.rs index 46c8709..62c191a 100644 --- a/src/verifier.rs +++ b/src/verifier.rs @@ -5,7 +5,7 @@ use bitcoin::blockdata::block::Block; 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; @@ -36,11 +36,16 @@ impl ChainVerifier { 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) + } + } }) }) } }