@@ -418,6 +418,7 @@ impl Builder {
418418 // Initialize the ChannelManager
419419 let mut user_config = UserConfig :: default ( ) ;
420420 user_config. channel_handshake_limits . force_announced_channel_preference = false ;
421+ user_config. manually_accept_inbound_channels = true ;
421422 let channel_manager = {
422423 if let Ok ( mut reader) = kv_store
423424 . read ( CHANNEL_MANAGER_PERSISTENCE_NAMESPACE , CHANNEL_MANAGER_PERSISTENCE_KEY )
@@ -654,6 +655,7 @@ impl Node {
654655 Arc :: clone ( & self . network_graph ) ,
655656 Arc :: clone ( & self . keys_manager ) ,
656657 Arc :: clone ( & self . payment_store ) ,
658+ Arc :: clone ( & self . peer_store ) ,
657659 Arc :: clone ( & tokio_runtime) ,
658660 Arc :: clone ( & self . logger ) ,
659661 Arc :: clone ( & self . config ) ,
@@ -858,8 +860,10 @@ impl Node {
858860 /// Connect to a node on the peer-to-peer network.
859861 ///
860862 /// If `permanently` is set to `true`, we'll remember the peer and reconnect to it on restart.
863+ ///
864+ /// If `trusted_0conf` is set to `true`, we will trust incoming 0conf channels from this peer.
861865 pub fn connect (
862- & self , node_id : PublicKey , address : SocketAddr , permanently : bool ,
866+ & self , node_id : PublicKey , address : SocketAddr , permanently : bool , trusted_0conf : bool ,
863867 ) -> Result < ( ) , Error > {
864868 let runtime_lock = self . running . read ( ) . unwrap ( ) ;
865869 if runtime_lock. is_none ( ) {
@@ -868,7 +872,7 @@ impl Node {
868872
869873 let runtime = runtime_lock. as_ref ( ) . unwrap ( ) ;
870874
871- let peer_info = PeerInfo { pubkey : node_id, address } ;
875+ let peer_info = PeerInfo { pubkey : node_id, address, trusted_0conf } ;
872876
873877 let con_peer_pubkey = peer_info. pubkey . clone ( ) ;
874878 let con_peer_addr = peer_info. address . clone ( ) ;
@@ -930,10 +934,12 @@ impl Node {
930934 /// channel counterparty on channel open. This can be useful to start out with the balance not
931935 /// entirely shifted to one side, therefore allowing to receive payments from the getgo.
932936 ///
937+ /// If `trusted_0conf` is set to `true`, we will trust incoming 0conf channels from this peer.
938+ ///
933939 /// Returns a temporary channel id.
934940 pub fn connect_open_channel (
935941 & self , node_id : PublicKey , address : SocketAddr , channel_amount_sats : u64 ,
936- push_to_counterparty_msat : Option < u64 > , announce_channel : bool ,
942+ push_to_counterparty_msat : Option < u64 > , announce_channel : bool , trusted_0conf : bool ,
937943 ) -> Result < ( ) , Error > {
938944 let runtime_lock = self . running . read ( ) . unwrap ( ) ;
939945 if runtime_lock. is_none ( ) {
@@ -948,7 +954,7 @@ impl Node {
948954 return Err ( Error :: InsufficientFunds ) ;
949955 }
950956
951- let peer_info = PeerInfo { pubkey : node_id, address } ;
957+ let peer_info = PeerInfo { pubkey : node_id, address, trusted_0conf } ;
952958
953959 let con_peer_pubkey = peer_info. pubkey . clone ( ) ;
954960 let con_peer_addr = peer_info. address . clone ( ) ;
0 commit comments