@@ -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 ( ) ;
@@ -924,10 +928,12 @@ impl Node {
924928
925929 /// Connect to a node and open a new channel. Disconnects and re-connects are handled automatically
926930 ///
931+ /// If `trusted_0conf` is set to `true`, we will trust incoming 0conf channels from this peer.
932+ ///
927933 /// Returns a temporary channel id
928934 pub fn connect_open_channel (
929935 & self , node_id : PublicKey , address : SocketAddr , channel_amount_sats : u64 ,
930- announce_channel : bool ,
936+ announce_channel : bool , trusted_0conf : bool ,
931937 ) -> Result < ( ) , Error > {
932938 let runtime_lock = self . running . read ( ) . unwrap ( ) ;
933939 if runtime_lock. is_none ( ) {
@@ -942,7 +948,7 @@ impl Node {
942948 return Err ( Error :: InsufficientFunds ) ;
943949 }
944950
945- let peer_info = PeerInfo { pubkey : node_id, address } ;
951+ let peer_info = PeerInfo { pubkey : node_id, address, trusted_0conf } ;
946952
947953 let con_peer_pubkey = peer_info. pubkey . clone ( ) ;
948954 let con_peer_addr = peer_info. address . clone ( ) ;
0 commit comments