Skip to content

Commit 29b9eb3

Browse files
committed
Add payment hash to MaybePreimageClaimableHTLC
1 parent ba9e517 commit 29b9eb3

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

lightning/src/chain/channelmonitor.rs

+4
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,8 @@ pub enum Balance {
634634
/// The height at which our counterparty will be able to claim the balance if we have not
635635
/// yet received the preimage and claimed it ourselves.
636636
expiry_height: u32,
637+
/// The payment hash whose preimage we need to claim this HTLC.
638+
payment_hash: PaymentHash,
637639
},
638640
/// The channel has been closed, and our counterparty broadcasted a revoked commitment
639641
/// transaction.
@@ -1635,6 +1637,7 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitorImpl<Signer> {
16351637
return Some(Balance::MaybePreimageClaimableHTLC {
16361638
claimable_amount_satoshis: htlc.amount_msat / 1000,
16371639
expiry_height: htlc.cltv_expiry,
1640+
payment_hash: htlc.payment_hash,
16381641
});
16391642
}
16401643
None
@@ -1806,6 +1809,7 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitor<Signer> {
18061809
res.push(Balance::MaybePreimageClaimableHTLC {
18071810
claimable_amount_satoshis: htlc.amount_msat / 1000,
18081811
expiry_height: htlc.cltv_expiry,
1812+
payment_hash: htlc.payment_hash,
18091813
});
18101814
}
18111815
}

lightning/src/ln/monitor_tests.rs

+4
Original file line numberDiff line numberDiff line change
@@ -311,10 +311,12 @@ fn do_test_claim_value_force_close(prev_commitment_tx: bool) {
311311
let received_htlc_balance = Balance::MaybePreimageClaimableHTLC {
312312
claimable_amount_satoshis: 3_000,
313313
expiry_height: htlc_cltv_timeout,
314+
payment_hash,
314315
};
315316
let received_htlc_timeout_balance = Balance::MaybePreimageClaimableHTLC {
316317
claimable_amount_satoshis: 4_000,
317318
expiry_height: htlc_cltv_timeout,
319+
payment_hash: timeout_payment_hash,
318320
};
319321
let received_htlc_claiming_balance = Balance::ContentiousClaimable {
320322
claimable_amount_satoshis: 3_000,
@@ -775,10 +777,12 @@ fn test_no_preimage_inbound_htlc_balances() {
775777
let a_received_htlc_balance = Balance::MaybePreimageClaimableHTLC {
776778
claimable_amount_satoshis: 20_000,
777779
expiry_height: htlc_cltv_timeout,
780+
payment_hash: to_a_failed_payment_hash,
778781
};
779782
let b_received_htlc_balance = Balance::MaybePreimageClaimableHTLC {
780783
claimable_amount_satoshis: 10_000,
781784
expiry_height: htlc_cltv_timeout,
785+
payment_hash: to_b_failed_payment_hash,
782786
};
783787
let b_sent_htlc_balance = Balance::MaybeTimeoutClaimableHTLC {
784788
claimable_amount_satoshis: 20_000,

0 commit comments

Comments
 (0)