From eecc3b722379be3fb9382ede84aef8ad2b41f660 Mon Sep 17 00:00:00 2001 From: Valentine Wallace Date: Fri, 26 Feb 2021 17:55:13 -0500 Subject: [PATCH 1/2] SimpleArcChannelManager type: remove outer Arc for flexibility --- background-processor/src/lib.rs | 2 +- lightning-net-tokio/src/lib.rs | 2 +- lightning/src/ln/channelmanager.rs | 2 +- lightning/src/ln/peer_handler.rs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/background-processor/src/lib.rs b/background-processor/src/lib.rs index 0a09ae95c..0c7191fba 100644 --- a/background-processor/src/lib.rs +++ b/background-processor/src/lib.rs @@ -124,7 +124,7 @@ mod tests { type ChainMonitor = chainmonitor::ChainMonitor, Arc, Arc, Arc, Arc>; struct Node { - node: SimpleArcChannelManager, + node: Arc>, persister: Arc, logger: Arc, } diff --git a/lightning-net-tokio/src/lib.rs b/lightning-net-tokio/src/lib.rs index 051341ee9..c247eba6d 100644 --- a/lightning-net-tokio/src/lib.rs +++ b/lightning-net-tokio/src/lib.rs @@ -38,7 +38,7 @@ //! type ChainFilter = dyn lightning::chain::Filter; //! type DataPersister = dyn lightning::chain::channelmonitor::Persist; //! type ChainMonitor = lightning::chain::chainmonitor::ChainMonitor, Arc, Arc, Arc, Arc>; -//! type ChannelManager = lightning::ln::channelmanager::SimpleArcChannelManager; +//! type ChannelManager = Arc>; //! type PeerManager = lightning::ln::peer_handler::SimpleArcPeerManager; //! //! // Connect to node with pubkey their_node_id at addr: diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs index 8fd243ae7..7af34e86e 100644 --- a/lightning/src/ln/channelmanager.rs +++ b/lightning/src/ln/channelmanager.rs @@ -349,7 +349,7 @@ const ERR: () = "You need at least 32 bit pointers (well, usize, but we'll assum /// issues such as overly long function definitions. Note that the ChannelManager can take any /// type that implements KeysInterface for its keys manager, but this type alias chooses the /// concrete type of the KeysManager. -pub type SimpleArcChannelManager = Arc, Arc, Arc, Arc, Arc>>; +pub type SimpleArcChannelManager = ChannelManager, Arc, Arc, Arc, Arc>; /// SimpleRefChannelManager is a type alias for a ChannelManager reference, and is the reference /// counterpart to the SimpleArcChannelManager type alias. Use this type by default when you don't diff --git a/lightning/src/ln/peer_handler.rs b/lightning/src/ln/peer_handler.rs index dbd54b3b6..b5e5ebef2 100644 --- a/lightning/src/ln/peer_handler.rs +++ b/lightning/src/ln/peer_handler.rs @@ -182,7 +182,7 @@ fn _check_usize_is_32_or_64() { /// lifetimes). Other times you can afford a reference, which is more efficient, in which case /// SimpleRefPeerManager is the more appropriate type. Defining these type aliases prevents /// issues such as overly long function definitions. -pub type SimpleArcPeerManager = Arc, Arc, Arc>>, Arc>>; +pub type SimpleArcPeerManager = Arc>, Arc, Arc>>, Arc>>; /// SimpleRefPeerManager is a type alias for a PeerManager reference, and is the reference /// counterpart to the SimpleArcPeerManager type alias. Use this type by default when you don't From a2d9fca9d50ce6c05135f0b38743404bd5c75d8f Mon Sep 17 00:00:00 2001 From: Valentine Wallace Date: Fri, 26 Feb 2021 17:58:56 -0500 Subject: [PATCH 2/2] SimpleArcPeerManager type: remove outer Arc for flexibility --- lightning-net-tokio/src/lib.rs | 2 +- lightning/src/ln/peer_handler.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lightning-net-tokio/src/lib.rs b/lightning-net-tokio/src/lib.rs index c247eba6d..8c9833308 100644 --- a/lightning-net-tokio/src/lib.rs +++ b/lightning-net-tokio/src/lib.rs @@ -39,7 +39,7 @@ //! type DataPersister = dyn lightning::chain::channelmonitor::Persist; //! type ChainMonitor = lightning::chain::chainmonitor::ChainMonitor, Arc, Arc, Arc, Arc>; //! type ChannelManager = Arc>; -//! type PeerManager = lightning::ln::peer_handler::SimpleArcPeerManager; +//! type PeerManager = Arc>; //! //! // Connect to node with pubkey their_node_id at addr: //! async fn connect_to_node(peer_manager: PeerManager, chain_monitor: Arc, channel_manager: ChannelManager, their_node_id: PublicKey, addr: SocketAddr) { diff --git a/lightning/src/ln/peer_handler.rs b/lightning/src/ln/peer_handler.rs index b5e5ebef2..6edd95415 100644 --- a/lightning/src/ln/peer_handler.rs +++ b/lightning/src/ln/peer_handler.rs @@ -182,7 +182,7 @@ fn _check_usize_is_32_or_64() { /// lifetimes). Other times you can afford a reference, which is more efficient, in which case /// SimpleRefPeerManager is the more appropriate type. Defining these type aliases prevents /// issues such as overly long function definitions. -pub type SimpleArcPeerManager = Arc>, Arc, Arc>>, Arc>>; +pub type SimpleArcPeerManager = PeerManager>, Arc, Arc>>, Arc>; /// SimpleRefPeerManager is a type alias for a PeerManager reference, and is the reference /// counterpart to the SimpleArcPeerManager type alias. Use this type by default when you don't