Skip to content

Commit 7fd2372

Browse files
committed
Simplify claimable balance trivially with consistent accessors
1 parent acaaffd commit 7fd2372

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lightning/src/chain/channelmonitor.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1453,8 +1453,8 @@ impl<Signer: Sign> ChannelMonitor<Signer> {
14531453
OnchainEvent::HTLCUpdate { commitment_tx_output_idx, htlc_value_satoshis, .. }
14541454
if commitment_tx_output_idx == Some(htlc_commitment_tx_output_idx) => {
14551455
debug_assert!(htlc_update_pending.is_none());
1456-
htlc_update_pending =
1457-
Some((htlc_value_satoshis.unwrap(), event.confirmation_threshold()));
1456+
debug_assert_eq!(htlc_value_satoshis.unwrap(), htlc.amount_msat / 1000);
1457+
htlc_update_pending = Some(event.confirmation_threshold());
14581458
},
14591459
OnchainEvent::HTLCSpendConfirmation { commitment_tx_output_idx, preimage, .. }
14601460
if commitment_tx_output_idx == htlc_commitment_tx_output_idx => {
@@ -1492,9 +1492,9 @@ impl<Signer: Sign> ChannelMonitor<Signer> {
14921492
// If the payment was outbound, check if there's an HTLCUpdate
14931493
// indicating we have spent this HTLC with a timeout, claiming it back
14941494
// and awaiting confirmations on it.
1495-
if let Some((value, conf_thresh)) = htlc_update_pending {
1495+
if let Some(conf_thresh) = htlc_update_pending {
14961496
res.push(Balance::ClaimableAwaitingConfirmations {
1497-
claimable_amount_satoshis: value,
1497+
claimable_amount_satoshis: htlc.amount_msat / 1000,
14981498
confirmation_height: conf_thresh,
14991499
});
15001500
} else {

0 commit comments

Comments
 (0)