Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix backwards compatibility of channels between 0.0.114 and 0.0.116 #12

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lightning/src/ln/chan_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
}
Expand All @@ -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();
Expand Down
6 changes: 1 addition & 5 deletions lightning/src/ln/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1030,11 +1030,7 @@ impl<Signer: ChannelSigner> ChannelContext<Signer> {
/// 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<OutPoint> {
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`
Expand Down
4 changes: 3 additions & 1 deletion lightning/src/ln/channelmanager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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();
Expand Down
Loading