@@ -122,6 +122,7 @@ pub use error::Error as NodeError;
122122use error:: Error ;
123123pub use event:: Event ;
124124use event:: { EventHandler , EventQueue } ;
125+ use fee_estimator:: { ConfirmationTarget , FeeEstimator , OnchainFeeEstimator } ;
125126#[ cfg( feature = "uniffi" ) ]
126127use ffi:: * ;
127128use gossip:: GossipSource ;
@@ -176,6 +177,7 @@ pub struct Node {
176177 wallet : Arc < Wallet > ,
177178 chain_source : Arc < ChainSource > ,
178179 tx_broadcaster : Arc < Broadcaster > ,
180+ fee_estimator : Arc < OnchainFeeEstimator > ,
179181 event_queue : Arc < EventQueue < Arc < Logger > > > ,
180182 channel_manager : Arc < ChannelManager > ,
181183 chain_monitor : Arc < ChainMonitor > ,
@@ -1247,7 +1249,7 @@ impl Node {
12471249 . to_p2wsh ( ) ,
12481250 } ;
12491251
1250- let fee_rate = self . wallet . estimate_channel_funding_fee_rate ( ) ;
1252+ let fee_rate = self . fee_estimator . estimate_fee_rate ( ConfirmationTarget :: ChannelFunding ) ;
12511253
12521254 let inputs = self
12531255 . wallet
@@ -1266,7 +1268,13 @@ impl Node {
12661268 change_script : None ,
12671269 } ;
12681270
1269- let funding_feerate_per_kw = fee_rate. to_sat_per_kwu ( ) . try_into ( ) . unwrap_or ( u32:: MAX ) ;
1271+ let funding_feerate_per_kw: u32 = match fee_rate. to_sat_per_kwu ( ) . try_into ( ) {
1272+ Ok ( fee_rate) => fee_rate,
1273+ Err ( _) => {
1274+ debug_assert ! ( false ) ;
1275+ fee_estimator:: get_fallback_rate_for_target ( ConfirmationTarget :: ChannelFunding )
1276+ } ,
1277+ } ;
12701278
12711279 self . channel_manager
12721280 . splice_channel (
0 commit comments