Skip to content

Commit df46875

Browse files
committed
Update pending funding when handling revoke_and_ack
If there are any pending splices when a revoke_and_ack message is received, FundingScope::value_to_self_msat needs to be updated for each. Otherwise, the promoted FundingScope will be invalid when the splice is locked.
1 parent ceede42 commit df46875

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

lightning/src/ln/channel.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6364,8 +6364,10 @@ impl<SP: Deref> FundedChannel<SP> where
63646364

63656365
#[cfg(any(test, fuzzing))]
63666366
{
6367-
*self.funding.next_local_commitment_tx_fee_info_cached.lock().unwrap() = None;
6368-
*self.funding.next_remote_commitment_tx_fee_info_cached.lock().unwrap() = None;
6367+
for funding in core::iter::once(&mut self.funding).chain(self.pending_funding.iter_mut()) {
6368+
*funding.next_local_commitment_tx_fee_info_cached.lock().unwrap() = None;
6369+
*funding.next_remote_commitment_tx_fee_info_cached.lock().unwrap() = None;
6370+
}
63696371
}
63706372

63716373
match &self.context.holder_signer {
@@ -6515,7 +6517,10 @@ impl<SP: Deref> FundedChannel<SP> where
65156517
}
65166518
}
65176519
}
6518-
self.funding.value_to_self_msat = (self.funding.value_to_self_msat as i64 + value_to_self_msat_diff) as u64;
6520+
6521+
for funding in core::iter::once(&mut self.funding).chain(self.pending_funding.iter_mut()) {
6522+
funding.value_to_self_msat = (funding.value_to_self_msat as i64 + value_to_self_msat_diff) as u64;
6523+
}
65196524

65206525
if let Some((feerate, update_state)) = self.context.pending_update_fee {
65216526
match update_state {

0 commit comments

Comments
 (0)