Skip to content

Commit 1e50365

Browse files
authored
Merge pull request #4143 from TheBlueMatt/2025-09-0.1.6
0.1.6 Initial backports
2 parents cdc6003 + 5b6b4ce commit 1e50365

17 files changed

+1863
-372
lines changed

lightning/src/chain/channelmonitor.rs

Lines changed: 211 additions & 98 deletions
Large diffs are not rendered by default.

lightning/src/chain/package.rs

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -820,7 +820,7 @@ enum PackageMalleability {
820820
///
821821
/// As packages are time-sensitive, we fee-bump and rebroadcast them at scheduled intervals.
822822
/// Failing to confirm a package translate as a loss of funds for the user.
823-
#[derive(Clone, Debug, PartialEq, Eq)]
823+
#[derive(Clone, Debug, Eq)]
824824
pub struct PackageTemplate {
825825
// List of onchain outputs and solving data to generate satisfying witnesses.
826826
inputs: Vec<(BitcoinOutPoint, PackageSolvingData)>,
@@ -849,6 +849,50 @@ pub struct PackageTemplate {
849849
height_timer: u32,
850850
}
851851

852+
impl PartialEq for PackageTemplate {
853+
fn eq(&self, o: &Self) -> bool {
854+
if self.inputs != o.inputs
855+
|| self.malleability != o.malleability
856+
|| self.feerate_previous != o.feerate_previous
857+
|| self.height_timer != o.height_timer
858+
{
859+
return false;
860+
}
861+
#[cfg(test)]
862+
{
863+
// In some cases we may reset `counterparty_spendable_height` to zero on reload, which
864+
// can cause our test assertions that ChannelMonitors round-trip exactly to trip. Here
865+
// we allow exactly the same case as we tweak in the `PackageTemplate` `Readable`
866+
// implementation.
867+
if self.counterparty_spendable_height == 0 {
868+
for (_, input) in self.inputs.iter() {
869+
if let PackageSolvingData::RevokedHTLCOutput(RevokedHTLCOutput {
870+
htlc, ..
871+
}) = input
872+
{
873+
if !htlc.offered && htlc.cltv_expiry != 0 {
874+
return true;
875+
}
876+
}
877+
}
878+
}
879+
if o.counterparty_spendable_height == 0 {
880+
for (_, input) in o.inputs.iter() {
881+
if let PackageSolvingData::RevokedHTLCOutput(RevokedHTLCOutput {
882+
htlc, ..
883+
}) = input
884+
{
885+
if !htlc.offered && htlc.cltv_expiry != 0 {
886+
return true;
887+
}
888+
}
889+
}
890+
}
891+
}
892+
self.counterparty_spendable_height == o.counterparty_spendable_height
893+
}
894+
}
895+
852896
impl PackageTemplate {
853897
pub(crate) fn can_merge_with(&self, other: &PackageTemplate, cur_height: u32) -> bool {
854898
match (self.malleability, other.malleability) {

lightning/src/events/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,11 @@ impl_writeable_tlv_based_enum_legacy!(PaymentPurpose,
229229
/// Information about an HTLC that is part of a payment that can be claimed.
230230
#[derive(Clone, Debug, PartialEq, Eq)]
231231
pub struct ClaimedHTLC {
232+
/// The counterparty of the channel.
233+
///
234+
/// This value will always be `None` for objects serialized with LDK versions prior to 0.2 and
235+
/// `Some` otherwise.
236+
pub counterparty_node_id: Option<PublicKey>,
232237
/// The `channel_id` of the channel over which the HTLC was received.
233238
pub channel_id: ChannelId,
234239
/// The `user_channel_id` of the channel over which the HTLC was received. This is the value
@@ -259,6 +264,7 @@ impl_writeable_tlv_based!(ClaimedHTLC, {
259264
(0, channel_id, required),
260265
(1, counterparty_skimmed_fee_msat, (default_value, 0u64)),
261266
(2, user_channel_id, required),
267+
(3, counterparty_node_id, option),
262268
(4, cltv_expiry, required),
263269
(6, value_msat, required),
264270
});

lightning/src/ln/chanmon_update_fail_tests.rs

Lines changed: 198 additions & 24 deletions
Large diffs are not rendered by default.

lightning/src/ln/channel.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4392,7 +4392,7 @@ impl<SP: Deref> Channel<SP> where
43924392
Ok((closing_transaction, total_fee_satoshis))
43934393
}
43944394

4395-
fn funding_outpoint(&self) -> OutPoint {
4395+
pub fn funding_outpoint(&self) -> OutPoint {
43964396
self.context.channel_transaction_parameters.funding_outpoint.unwrap()
43974397
}
43984398

0 commit comments

Comments
 (0)