diff --git a/lightning/src/ln/chan_utils.rs b/lightning/src/ln/chan_utils.rs index 6f15f86f65d..ff812bbb259 100644 --- a/lightning/src/ln/chan_utils.rs +++ b/lightning/src/ln/chan_utils.rs @@ -937,7 +937,7 @@ impl Writeable for ChannelTransactionParameters { (8, self.funding_outpoint, option), (10, legacy_deserialization_prevention_marker, option), (11, self.channel_type_features, required), - (12, self.original_funding_outpoint, option), + (14, self.original_funding_outpoint, option), }); Ok(()) } @@ -962,7 +962,7 @@ impl Readable for ChannelTransactionParameters { (8, funding_outpoint, option), (10, _legacy_deserialization_prevention_marker, option), (11, channel_type_features, option), - (12, original_funding_outpoint, option), + (14, original_funding_outpoint, option), }); let mut additional_features = ChannelTypeFeatures::empty(); diff --git a/lightning/src/ln/channel.rs b/lightning/src/ln/channel.rs index 429dd3aa9d3..c1d9ea3ec61 100644 --- a/lightning/src/ln/channel.rs +++ b/lightning/src/ln/channel.rs @@ -1030,11 +1030,7 @@ impl ChannelContext { /// Returns the funding txo which is always the one that was confirmed on chain, even if the /// channel is split. pub fn get_original_funding_txo(&self) -> Option { - if self.channel_transaction_parameters.original_funding_outpoint.is_none() { - self.get_funding_txo() - } else { - self.channel_transaction_parameters.original_funding_outpoint - } + self.channel_transaction_parameters.original_funding_outpoint.or(self.get_funding_txo()) } /// Set the funding output and value of the channel, returning a `ChannelMonitorUpdate` diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs index 5e9bcff1781..cc5306329f8 100644 --- a/lightning/src/ln/channelmanager.rs +++ b/lightning/src/ln/channelmanager.rs @@ -82,6 +82,8 @@ pub use crate::ln::outbound_payment::{PaymentSendFailure, Retry, RetryableSendFa use crate::ln::script::ShutdownScript; use super::msgs::{CommitmentSigned, RevokeAndACK}; +/// A tuple containing a [`CommitmentSigned`] message and the commitment transaction number it +/// corresponds to. pub type NumberedCommitmentSigned = (CommitmentSigned, u64); // We hold various information about HTLC relay in the HTLC objects in Channel itself: @@ -8874,7 +8876,7 @@ where for (_, chan) in peer_state.channel_by_id.iter() { // Channels that were persisted have to be funded, otherwise they should have been // discarded. - let funding_txo = chan.context.get_funding_txo().ok_or(DecodeError::InvalidValue)?; + let funding_txo = chan.context.get_original_funding_txo().ok_or(DecodeError::InvalidValue)?; let monitor = args.channel_monitors.get(&funding_txo) .expect("We already checked for monitor presence when loading channels"); let mut max_in_flight_update_id = monitor.get_latest_update_id();