Skip to content

Commit 7e9c9ba

Browse files
committed
fix Include the weight of the old funding input for splice fee estimate
1 parent d7bb05f commit 7e9c9ba

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lightning/src/ln/channel.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4706,11 +4706,13 @@ fn check_v2_funding_inputs_sufficient(
47064706
is_splice: bool, funding_feerate_sat_per_1000_weight: u32,
47074707
) -> Result<u64, ChannelError> {
47084708
let mut total_input_witness_weight = Weight::from_wu(funding_inputs.iter().map(|(_, _, w)| w.to_wu()).sum());
4709+
let mut funding_inputs_len = funding_inputs.len();
47094710
if is_initiator && is_splice {
4710-
// consider the weight of the witness needed for spending the old funding transaction
4711+
// consider the weight of the input and witness needed for spending the old funding transaction
4712+
funding_inputs_len += 1;
47114713
total_input_witness_weight += Weight::from_wu(FUNDING_TRANSACTION_WITNESS_WEIGHT);
47124714
}
4713-
let estimated_fee = estimate_v2_funding_transaction_fee(is_initiator, funding_inputs.len(), total_input_witness_weight, funding_feerate_sat_per_1000_weight);
4715+
let estimated_fee = estimate_v2_funding_transaction_fee(is_initiator, funding_inputs_len, total_input_witness_weight, funding_feerate_sat_per_1000_weight);
47144716

47154717
let mut total_input_sats = 0u64;
47164718
for (idx, input) in funding_inputs.iter().enumerate() {

0 commit comments

Comments
 (0)