@@ -442,6 +442,7 @@ impl Builder {
442442 // Initialize the ChannelManager
443443 let mut user_config = UserConfig :: default ( ) ;
444444 user_config. channel_handshake_limits . force_announced_channel_preference = false ;
445+ user_config. manually_accept_inbound_channels = true ;
445446 let channel_manager = {
446447 if let Ok ( mut reader) = kv_store
447448 . read ( CHANNEL_MANAGER_PERSISTENCE_NAMESPACE , CHANNEL_MANAGER_PERSISTENCE_KEY )
@@ -638,6 +639,7 @@ impl Node {
638639 Arc :: clone ( & self . network_graph ) ,
639640 Arc :: clone ( & self . keys_manager ) ,
640641 Arc :: clone ( & self . payment_store ) ,
642+ Arc :: clone ( & self . peer_store ) ,
641643 Arc :: clone ( & self . runtime ) ,
642644 Arc :: clone ( & self . logger ) ,
643645 Arc :: clone ( & self . config ) ,
@@ -909,16 +911,18 @@ impl Node {
909911 /// Connect to a node on the peer-to-peer network.
910912 ///
911913 /// If `permanently` is set to `true`, we'll remember the peer and reconnect to it on restart.
914+ ///
915+ /// If `trusted_0conf` is set to `true`, we will trust incoming 0conf channels from this peer.
912916 pub fn connect (
913- & self , node_id : PublicKey , address : SocketAddr , permanently : bool ,
917+ & self , node_id : PublicKey , address : SocketAddr , permanently : bool , trusted_0conf : bool ,
914918 ) -> Result < ( ) , Error > {
915919 let rt_lock = self . runtime . read ( ) . unwrap ( ) ;
916920 if rt_lock. is_none ( ) {
917921 return Err ( Error :: NotRunning ) ;
918922 }
919923 let runtime = rt_lock. as_ref ( ) . unwrap ( ) ;
920924
921- let peer_info = PeerInfo { pubkey : node_id, address } ;
925+ let peer_info = PeerInfo { pubkey : node_id, address, trusted_0conf } ;
922926
923927 let con_peer_pubkey = peer_info. pubkey ;
924928 let con_peer_addr = peer_info. address ;
@@ -980,10 +984,12 @@ impl Node {
980984 /// channel counterparty on channel open. This can be useful to start out with the balance not
981985 /// entirely shifted to one side, therefore allowing to receive payments from the getgo.
982986 ///
987+ /// If `trusted_0conf` is set to `true`, we will trust incoming 0conf channels from this peer.
988+ ///
983989 /// Returns a temporary channel id.
984990 pub fn connect_open_channel (
985991 & self , node_id : PublicKey , address : SocketAddr , channel_amount_sats : u64 ,
986- push_to_counterparty_msat : Option < u64 > , announce_channel : bool ,
992+ push_to_counterparty_msat : Option < u64 > , announce_channel : bool , trusted_0conf : bool ,
987993 ) -> Result < ( ) , Error > {
988994 let rt_lock = self . runtime . read ( ) . unwrap ( ) ;
989995 if rt_lock. is_none ( ) {
@@ -997,7 +1003,7 @@ impl Node {
9971003 return Err ( Error :: InsufficientFunds ) ;
9981004 }
9991005
1000- let peer_info = PeerInfo { pubkey : node_id, address } ;
1006+ let peer_info = PeerInfo { pubkey : node_id, address, trusted_0conf } ;
10011007
10021008 let con_peer_pubkey = peer_info. pubkey ;
10031009 let con_peer_addr = peer_info. address ;
0 commit comments