@@ -138,7 +138,7 @@ use io::utils::write_node_metrics;
138138use lightning:: chain:: BestBlock ;
139139use lightning:: events:: bump_transaction:: { Input , Wallet as LdkWallet } ;
140140use lightning:: impl_writeable_tlv_based;
141- use lightning:: ln:: chan_utils:: { make_funding_redeemscript , FUNDING_TRANSACTION_WITNESS_WEIGHT } ;
141+ use lightning:: ln:: chan_utils:: FUNDING_TRANSACTION_WITNESS_WEIGHT ;
142142use lightning:: ln:: channel_state:: { ChannelDetails as LdkChannelDetails , ChannelShutdownState } ;
143143use lightning:: ln:: channelmanager:: PaymentId ;
144144use lightning:: ln:: funding:: SpliceContribution ;
@@ -1267,29 +1267,27 @@ impl Node {
12671267 const EMPTY_SCRIPT_SIG_WEIGHT : u64 =
12681268 1 /* empty script_sig */ * bitcoin:: constants:: WITNESS_SCALE_FACTOR as u64 ;
12691269
1270- // Used for creating a redeem script for the previous funding txo and the new funding
1271- // txo. Only needed when selecting which UTXOs to include in the funding tx that would
1272- // be sufficient to pay for fees. Hence, the value does not matter.
1273- let dummy_pubkey = PublicKey :: from_slice ( & [ 2 ; 33 ] ) . unwrap ( ) ;
1274-
12751270 let funding_txo = channel_details. funding_txo . ok_or_else ( || {
12761271 log_error ! ( self . logger, "Failed to splice channel: channel not yet ready" , ) ;
12771272 Error :: ChannelSplicingFailed
12781273 } ) ?;
12791274
1275+ let funding_output = channel_details. get_funding_output ( ) . ok_or_else ( || {
1276+ log_error ! ( self . logger, "Failed to splice channel: channel not yet ready" ) ;
1277+ Error :: ChannelSplicingFailed
1278+ } ) ?;
1279+
12801280 let shared_input = Input {
12811281 outpoint : funding_txo. into_bitcoin_outpoint ( ) ,
1282- previous_utxo : bitcoin:: TxOut {
1283- value : Amount :: from_sat ( channel_details. channel_value_satoshis ) ,
1284- script_pubkey : make_funding_redeemscript ( & dummy_pubkey, & dummy_pubkey)
1285- . to_p2wsh ( ) ,
1286- } ,
1282+ previous_utxo : funding_output. clone ( ) ,
12871283 satisfaction_weight : EMPTY_SCRIPT_SIG_WEIGHT + FUNDING_TRANSACTION_WITNESS_WEIGHT ,
12881284 } ;
12891285
12901286 let shared_output = bitcoin:: TxOut {
12911287 value : shared_input. previous_utxo . value + Amount :: from_sat ( splice_amount_sats) ,
1292- script_pubkey : make_funding_redeemscript ( & dummy_pubkey, & dummy_pubkey) . to_p2wsh ( ) ,
1288+ // will not actually be the exact same script pubkey after splice
1289+ // but it is the same size and good enough for coin selection purposes
1290+ script_pubkey : funding_output. script_pubkey . clone ( ) ,
12931291 } ;
12941292
12951293 let fee_rate = self . fee_estimator . estimate_fee_rate ( ConfirmationTarget :: ChannelFunding ) ;
0 commit comments