Skip to content

Commit f712eb4

Browse files
committed
Simplify claimable balance trivially with consistent accessors
1 parent a17794c commit f712eb4

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
@@ -1457,8 +1457,8 @@ impl<Signer: Sign> ChannelMonitor<Signer> {
14571457
OnchainEvent::HTLCUpdate { commitment_tx_output_idx, htlc_value_satoshis, .. }
14581458
if commitment_tx_output_idx == Some(htlc_commitment_tx_output_idx) => {
14591459
debug_assert!(htlc_update_pending.is_none());
1460-
htlc_update_pending =
1461-
Some((htlc_value_satoshis.unwrap(), event.confirmation_threshold()));
1460+
debug_assert_eq!(htlc_value_satoshis.unwrap(), htlc.amount_msat / 1000);
1461+
htlc_update_pending = Some(event.confirmation_threshold());
14621462
},
14631463
OnchainEvent::HTLCSpendConfirmation { commitment_tx_output_idx, preimage, .. }
14641464
if commitment_tx_output_idx == htlc_commitment_tx_output_idx => {
@@ -1496,9 +1496,9 @@ impl<Signer: Sign> ChannelMonitor<Signer> {
14961496
// If the payment was outbound, check if there's an HTLCUpdate
14971497
// indicating we have spent this HTLC with a timeout, claiming it back
14981498
// and awaiting confirmations on it.
1499-
if let Some((value, conf_thresh)) = htlc_update_pending {
1499+
if let Some(conf_thresh) = htlc_update_pending {
15001500
res.push(Balance::ClaimableAwaitingConfirmations {
1501-
claimable_amount_satoshis: value,
1501+
claimable_amount_satoshis: htlc.amount_msat / 1000,
15021502
confirmation_height: conf_thresh,
15031503
});
15041504
} else {

0 commit comments

Comments
 (0)