From: Matt Corallo Date: Wed, 13 Jul 2022 01:20:09 +0000 (+0000) Subject: Simplify claimable balance trivially with consistent accessors X-Git-Tag: v0.0.111~34^2~2 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=f712eb41572d98af2e234bb05013728138f3f4f5;p=rust-lightning Simplify claimable balance trivially with consistent accessors --- diff --git a/lightning/src/chain/channelmonitor.rs b/lightning/src/chain/channelmonitor.rs index f08895718..863ce4759 100644 --- a/lightning/src/chain/channelmonitor.rs +++ b/lightning/src/chain/channelmonitor.rs @@ -1457,8 +1457,8 @@ impl ChannelMonitor { OnchainEvent::HTLCUpdate { commitment_tx_output_idx, htlc_value_satoshis, .. } if commitment_tx_output_idx == Some(htlc_commitment_tx_output_idx) => { debug_assert!(htlc_update_pending.is_none()); - htlc_update_pending = - Some((htlc_value_satoshis.unwrap(), event.confirmation_threshold())); + debug_assert_eq!(htlc_value_satoshis.unwrap(), htlc.amount_msat / 1000); + htlc_update_pending = Some(event.confirmation_threshold()); }, OnchainEvent::HTLCSpendConfirmation { commitment_tx_output_idx, preimage, .. } if commitment_tx_output_idx == htlc_commitment_tx_output_idx => { @@ -1496,9 +1496,9 @@ impl ChannelMonitor { // If the payment was outbound, check if there's an HTLCUpdate // indicating we have spent this HTLC with a timeout, claiming it back // and awaiting confirmations on it. - if let Some((value, conf_thresh)) = htlc_update_pending { + if let Some(conf_thresh) = htlc_update_pending { res.push(Balance::ClaimableAwaitingConfirmations { - claimable_amount_satoshis: value, + claimable_amount_satoshis: htlc.amount_msat / 1000, confirmation_height: conf_thresh, }); } else {