From: John Cantrell Date: Tue, 5 Dec 2023 21:01:29 +0000 (-0500) Subject: simplify GossipVerifier types using APeerManager X-Git-Tag: v0.0.119~27^2 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=67659677d4fdb6bf418d66dfa37c61706425232b;p=rust-lightning simplify GossipVerifier types using APeerManager --- diff --git a/lightning-block-sync/src/gossip.rs b/lightning-block-sync/src/gossip.rs index 3b6e9f683..591b02987 100644 --- a/lightning-block-sync/src/gossip.rs +++ b/lightning-block-sync/src/gossip.rs @@ -9,10 +9,7 @@ use bitcoin::blockdata::constants::ChainHash; use bitcoin::blockdata::transaction::{TxOut, OutPoint}; use bitcoin::hash_types::BlockHash; -use lightning::sign::NodeSigner; - -use lightning::ln::peer_handler::{CustomMessageHandler, PeerManager, SocketDescriptor}; -use lightning::ln::msgs::{ChannelMessageHandler, OnionMessageHandler}; +use lightning::ln::peer_handler::APeerManager; use lightning::routing::gossip::{NetworkGraph, P2PGossipSync}; use lightning::routing::utxo::{UtxoFuture, UtxoLookup, UtxoResult, UtxoLookupError}; @@ -135,21 +132,14 @@ impl< pub struct GossipVerifier where Blocks::Target: UtxoSource, L::Target: Logger, - CM::Target: ChannelMessageHandler, - OM::Target: OnionMessageHandler, - CMH::Target: CustomMessageHandler, - NS::Target: NodeSigner, + APM::Target: APeerManager, { source: Blocks, - peer_manager: Arc>, Self, L>>, OM, L, CMH, NS>>, + peer_manager: APM, gossiper: Arc>, Self, L>>, spawn: S, block_cache: Arc>>, @@ -160,24 +150,17 @@ const BLOCK_CACHE_SIZE: usize = 5; impl GossipVerifier where + APM: Deref + Send + Sync + Clone, +> GossipVerifier where Blocks::Target: UtxoSource, L::Target: Logger, - CM::Target: ChannelMessageHandler, - OM::Target: OnionMessageHandler, - CMH::Target: CustomMessageHandler, - NS::Target: NodeSigner, + APM::Target: APeerManager, { /// Constructs a new [`GossipVerifier`]. /// /// This is expected to be given to a [`P2PGossipSync`] (initially constructed with `None` for /// the UTXO lookup) via [`P2PGossipSync::add_utxo_lookup`]. - pub fn new(source: Blocks, spawn: S, gossiper: Arc>, Self, L>>, peer_manager: Arc>, Self, L>>, OM, L, CMH, NS>>) -> Self { + pub fn new(source: Blocks, spawn: S, gossiper: Arc>, Self, L>>, peer_manager: APM) -> Self { Self { source, spawn, gossiper, peer_manager, block_cache: Arc::new(Mutex::new(VecDeque::with_capacity(BLOCK_CACHE_SIZE))), @@ -269,18 +252,11 @@ impl Deref for GossipVerifier where + APM: Deref + Send + Sync + Clone, +> Deref for GossipVerifier where Blocks::Target: UtxoSource, L::Target: Logger, - CM::Target: ChannelMessageHandler, - OM::Target: OnionMessageHandler, - CMH::Target: CustomMessageHandler, - NS::Target: NodeSigner, + APM::Target: APeerManager, { type Target = Self; fn deref(&self) -> &Self { self } @@ -290,18 +266,11 @@ impl UtxoLookup for GossipVerifier where + APM: Deref + Send + Sync + Clone, +> UtxoLookup for GossipVerifier where Blocks::Target: UtxoSource, L::Target: Logger, - CM::Target: ChannelMessageHandler, - OM::Target: OnionMessageHandler, - CMH::Target: CustomMessageHandler, - NS::Target: NodeSigner, + APM::Target: APeerManager, { fn get_utxo(&self, _chain_hash: &ChainHash, short_channel_id: u64) -> UtxoResult { let res = UtxoFuture::new(); @@ -309,11 +278,11 @@ impl