@@ -1377,11 +1377,12 @@ impl<Signer: Sign> ChannelMonitor<Signer> {
1377
1377
1378
1378
let mut confirmed_txid = us. funding_spend_confirmed ;
1379
1379
let mut pending_commitment_tx_conf_thresh = None ;
1380
- if let Some ( ( txid , conf_thresh ) ) = us. onchain_events_awaiting_threshold_conf . iter ( ) . find_map ( |event| {
1380
+ let funding_spend_pending = us. onchain_events_awaiting_threshold_conf . iter ( ) . find_map ( |event| {
1381
1381
if let OnchainEvent :: FundingSpendConfirmation { .. } = event. event {
1382
1382
Some ( ( event. txid , event. confirmation_threshold ( ) ) )
1383
1383
} else { None }
1384
- } ) {
1384
+ } ) ;
1385
+ if let Some ( ( txid, conf_thresh) ) = funding_spend_pending {
1385
1386
debug_assert ! ( us. funding_spend_confirmed. is_none( ) ,
1386
1387
"We have a pending funding spend awaiting anti-reorg confirmation, we can't have confirmed it already!" ) ;
1387
1388
confirmed_txid = Some ( txid) ;
@@ -1398,11 +1399,12 @@ impl<Signer: Sign> ChannelMonitor<Signer> {
1398
1399
// If the payment was outbound, check if there's an HTLCUpdate
1399
1400
// indicating we have spent this HTLC with a timeout, claiming it back
1400
1401
// and awaiting confirmations on it.
1401
- if let Some ( conf_thresh ) = us. onchain_events_awaiting_threshold_conf. iter( ) . find_map( |event| {
1402
+ let htlc_update_pending = us. onchain_events_awaiting_threshold_conf. iter( ) . find_map( |event| {
1402
1403
if let OnchainEvent :: HTLCUpdate { input_idx: Some ( input_idx) , .. } = event. event {
1403
1404
if input_idx == htlc_input_idx { Some ( event. confirmation_threshold( ) ) } else { None }
1404
1405
} else { None }
1405
- } ) {
1406
+ } ) ;
1407
+ if let Some ( conf_thresh) = htlc_update_pending {
1406
1408
res. push( ClaimableBalance :: ClaimableAwaitingConfirmations {
1407
1409
claimable_amount_satoshis: htlc. amount_msat / 1000 ,
1408
1410
confirmation_height: conf_thresh,
@@ -1419,15 +1421,14 @@ impl<Signer: Sign> ChannelMonitor<Signer> {
1419
1421
// Note that if there is a pending claim, but it did not use the
1420
1422
// preimage, we lost funds to our counterparty! We will then continue
1421
1423
// to show it as ContentiousClaimable until ANTI_REORG_DELAY.
1422
- if let Some ( ( conf_thresh, true ) ) =
1423
- us. onchain_events_awaiting_threshold_conf. iter( ) . find_map( |event| {
1424
- if let OnchainEvent :: HTLCSpendConfirmation { input_idx, preimage, .. } = event. event {
1425
- if input_idx == htlc_input_idx {
1426
- Some ( ( event. confirmation_threshold( ) , preimage. is_some( ) ) )
1427
- } else { None }
1424
+ let htlc_spend_pending = us. onchain_events_awaiting_threshold_conf. iter( ) . find_map( |event| {
1425
+ if let OnchainEvent :: HTLCSpendConfirmation { input_idx, preimage, .. } = event. event {
1426
+ if input_idx == htlc_input_idx {
1427
+ Some ( ( event. confirmation_threshold( ) , preimage. is_some( ) ) )
1428
1428
} else { None }
1429
- }
1430
- ) {
1429
+ } else { None }
1430
+ } ) ;
1431
+ if let Some ( ( conf_thresh, true ) ) = htlc_spend_pending {
1431
1432
res. push( ClaimableBalance :: ClaimableAwaitingConfirmations {
1432
1433
claimable_amount_satoshis: htlc. amount_msat / 1000 ,
1433
1434
confirmation_height: conf_thresh,
0 commit comments