X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning-rapid-gossip-sync%2Fsrc%2Fprocessing.rs;h=18f9916316a5ffe9c7e0bf4dde7231bfea626789;hb=4910c7cffee4ce35de44c0bef361c2d822daacde;hp=818e19fe4b42fa6f12a31597b8ca4798eee2b5cb;hpb=79b55f081557f7df7fc27f6c39574904bdbd1737;p=rust-lightning diff --git a/lightning-rapid-gossip-sync/src/processing.rs b/lightning-rapid-gossip-sync/src/processing.rs index 818e19fe..18f99163 100644 --- a/lightning-rapid-gossip-sync/src/processing.rs +++ b/lightning-rapid-gossip-sync/src/processing.rs @@ -1,8 +1,6 @@ -use std::cmp::max; -use std::io; -use std::io::Read; -use std::ops::Deref; -use std::sync::atomic::Ordering; +use core::cmp::max; +use core::ops::Deref; +use core::sync::atomic::Ordering; use bitcoin::BlockHash; use bitcoin::secp256k1::PublicKey; @@ -13,6 +11,7 @@ use lightning::ln::msgs::{ use lightning::routing::gossip::NetworkGraph; use lightning::util::logger::Logger; use lightning::util::ser::{BigSize, Readable}; +use lightning::io; use crate::error::GraphSyncError; use crate::RapidGossipSync; @@ -28,19 +27,7 @@ const GOSSIP_PREFIX: [u8; 4] = [76, 68, 75, 1]; const MAX_INITIAL_NODE_ID_VECTOR_CAPACITY: u32 = 50_000; impl>, L: Deref> RapidGossipSync where L::Target: Logger { - /// Update network graph from binary data. - /// Returns the last sync timestamp to be used the next time rapid sync data is queried. - /// - /// `network_graph`: network graph to be updated - /// - /// `update_data`: `&[u8]` binary stream that comprises the update data - pub fn update_network_graph(&self, update_data: &[u8]) -> Result { - let mut read_cursor = io::Cursor::new(update_data); - self.update_network_graph_from_byte_stream(&mut read_cursor) - } - - - pub(crate) fn update_network_graph_from_byte_stream( + pub(crate) fn update_network_graph_from_byte_stream( &self, mut read_cursor: &mut R, ) -> Result {