Skip to content

Commit ae93f00

Browse files
committed
Simplify claimable balance trivially with consistent accessors
1 parent 284c801 commit ae93f00

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
@@ -1449,8 +1449,8 @@ impl<Signer: Sign> ChannelMonitor<Signer> {
14491449
OnchainEvent::HTLCUpdate { commitment_tx_output_idx, htlc_value_satoshis, .. }
14501450
if commitment_tx_output_idx == Some(htlc_commitment_tx_output_idx) => {
14511451
debug_assert!(htlc_update_pending.is_none());
1452-
htlc_update_pending =
1453-
Some((htlc_value_satoshis.unwrap(), event.confirmation_threshold()));
1452+
debug_assert_eq!(htlc_value_satoshis.unwrap(), htlc.amount_msat / 1000);
1453+
htlc_update_pending = Some(event.confirmation_threshold());
14541454
},
14551455
OnchainEvent::HTLCSpendConfirmation { commitment_tx_output_idx, preimage, .. }
14561456
if commitment_tx_output_idx == htlc_commitment_tx_output_idx => {
@@ -1488,9 +1488,9 @@ impl<Signer: Sign> ChannelMonitor<Signer> {
14881488
// If the payment was outbound, check if there's an HTLCUpdate
14891489
// indicating we have spent this HTLC with a timeout, claiming it back
14901490
// and awaiting confirmations on it.
1491-
if let Some((value, conf_thresh)) = htlc_update_pending {
1491+
if let Some(conf_thresh) = htlc_update_pending {
14921492
res.push(Balance::ClaimableAwaitingConfirmations {
1493-
claimable_amount_satoshis: value,
1493+
claimable_amount_satoshis: htlc.amount_msat / 1000,
14941494
confirmation_height: conf_thresh,
14951495
});
14961496
} else {

0 commit comments

Comments
 (0)