Skip to content

Commit c7e98b8

Browse files
committed
Rename MaybeClaimableHTLCAwaitingTimeout for consistency
As we now have a MaybePreimageClaimableHTLC, its more consistent to rename `MaybeClaimableHTLCAwaitingTimeout` to `MaybeTimeoutClaimableHTLC`.
1 parent 116aa6e commit c7e98b8

File tree

2 files changed

+29
-29
lines changed

2 files changed

+29
-29
lines changed

lightning/src/chain/channelmonitor.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ pub enum Balance {
578578
/// HTLCs which we sent to our counterparty which are claimable after a timeout (less on-chain
579579
/// fees) if the counterparty does not know the preimage for the HTLCs. These are somewhat
580580
/// likely to be claimed by our counterparty before we do.
581-
MaybeClaimableHTLCAwaitingTimeout {
581+
MaybeTimeoutClaimableHTLC {
582582
/// The amount potentially available to claim, in satoshis, excluding the on-chain fees
583583
/// which will be required to do so.
584584
claimable_amount_satoshis: u64,
@@ -1553,7 +1553,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
15531553
confirmation_height: conf_thresh,
15541554
});
15551555
} else {
1556-
return Some(Balance::MaybeClaimableHTLCAwaitingTimeout {
1556+
return Some(Balance::MaybeTimeoutClaimableHTLC {
15571557
claimable_amount_satoshis: htlc.amount_msat / 1000,
15581558
claimable_height: htlc.cltv_expiry,
15591559
});
@@ -1738,7 +1738,7 @@ impl<Signer: Sign> ChannelMonitor<Signer> {
17381738
for (htlc, _, _) in us.current_holder_commitment_tx.htlc_outputs.iter() {
17391739
if htlc.transaction_output_index.is_none() { continue; }
17401740
if htlc.offered {
1741-
res.push(Balance::MaybeClaimableHTLCAwaitingTimeout {
1741+
res.push(Balance::MaybeTimeoutClaimableHTLC {
17421742
claimable_amount_satoshis: htlc.amount_msat / 1000,
17431743
claimable_height: htlc.cltv_expiry,
17441744
});

lightning/src/ln/monitor_tests.rs

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -280,10 +280,10 @@ fn do_test_claim_value_force_close(prev_commitment_tx: bool) {
280280
assert_eq!(sorted_vec(vec![Balance::ClaimableOnChannelClose {
281281
claimable_amount_satoshis: 1_000_000 - 3_000 - 4_000 - 1_000 - 3 - chan_feerate *
282282
(channel::commitment_tx_base_weight(opt_anchors) + 2 * channel::COMMITMENT_TX_WEIGHT_PER_HTLC) / 1000,
283-
}, Balance::MaybeClaimableHTLCAwaitingTimeout {
283+
}, Balance::MaybeTimeoutClaimableHTLC {
284284
claimable_amount_satoshis: 3_000,
285285
claimable_height: htlc_cltv_timeout,
286-
}, Balance::MaybeClaimableHTLCAwaitingTimeout {
286+
}, Balance::MaybeTimeoutClaimableHTLC {
287287
claimable_amount_satoshis: 4_000,
288288
claimable_height: htlc_cltv_timeout,
289289
}]),
@@ -341,12 +341,12 @@ fn do_test_claim_value_force_close(prev_commitment_tx: bool) {
341341
chan_feerate * (channel::commitment_tx_base_weight(opt_anchors) +
342342
if prev_commitment_tx { 1 } else { 2 } *
343343
channel::COMMITMENT_TX_WEIGHT_PER_HTLC) / 1000,
344-
}, Balance::MaybeClaimableHTLCAwaitingTimeout {
344+
}, Balance::MaybeTimeoutClaimableHTLC {
345345
claimable_amount_satoshis: 4_000,
346346
claimable_height: htlc_cltv_timeout,
347347
}];
348348
if !prev_commitment_tx {
349-
a_expected_balances.push(Balance::MaybeClaimableHTLCAwaitingTimeout {
349+
a_expected_balances.push(Balance::MaybeTimeoutClaimableHTLC {
350350
claimable_amount_satoshis: 3_000,
351351
claimable_height: htlc_cltv_timeout,
352352
});
@@ -403,10 +403,10 @@ fn do_test_claim_value_force_close(prev_commitment_tx: bool) {
403403
claimable_amount_satoshis: 1_000_000 - 3_000 - 4_000 - 1_000 - 3 - chan_feerate *
404404
(channel::commitment_tx_base_weight(opt_anchors) + 2 * channel::COMMITMENT_TX_WEIGHT_PER_HTLC) / 1000,
405405
confirmation_height: nodes[0].best_block_info().1 + ANTI_REORG_DELAY - 1,
406-
}, Balance::MaybeClaimableHTLCAwaitingTimeout {
406+
}, Balance::MaybeTimeoutClaimableHTLC {
407407
claimable_amount_satoshis: 3_000,
408408
claimable_height: htlc_cltv_timeout,
409-
}, Balance::MaybeClaimableHTLCAwaitingTimeout {
409+
}, Balance::MaybeTimeoutClaimableHTLC {
410410
claimable_amount_satoshis: 4_000,
411411
claimable_height: htlc_cltv_timeout,
412412
}]),
@@ -434,10 +434,10 @@ fn do_test_claim_value_force_close(prev_commitment_tx: bool) {
434434

435435
// After ANTI_REORG_DELAY, A will consider its balance fully spendable and generate a
436436
// `SpendableOutputs` event. However, B still has to wait for the CSV delay.
437-
assert_eq!(sorted_vec(vec![Balance::MaybeClaimableHTLCAwaitingTimeout {
437+
assert_eq!(sorted_vec(vec![Balance::MaybeTimeoutClaimableHTLC {
438438
claimable_amount_satoshis: 3_000,
439439
claimable_height: htlc_cltv_timeout,
440-
}, Balance::MaybeClaimableHTLCAwaitingTimeout {
440+
}, Balance::MaybeTimeoutClaimableHTLC {
441441
claimable_amount_satoshis: 4_000,
442442
claimable_height: htlc_cltv_timeout,
443443
}]),
@@ -465,16 +465,16 @@ fn do_test_claim_value_force_close(prev_commitment_tx: bool) {
465465
} else {
466466
expect_payment_sent!(nodes[0], payment_preimage);
467467
}
468-
assert_eq!(sorted_vec(vec![Balance::MaybeClaimableHTLCAwaitingTimeout {
468+
assert_eq!(sorted_vec(vec![Balance::MaybeTimeoutClaimableHTLC {
469469
claimable_amount_satoshis: 3_000,
470470
claimable_height: htlc_cltv_timeout,
471-
}, Balance::MaybeClaimableHTLCAwaitingTimeout {
471+
}, Balance::MaybeTimeoutClaimableHTLC {
472472
claimable_amount_satoshis: 4_000,
473473
claimable_height: htlc_cltv_timeout,
474474
}]),
475475
sorted_vec(nodes[0].chain_monitor.chain_monitor.get_monitor(funding_outpoint).unwrap().get_claimable_balances()));
476476
connect_blocks(&nodes[0], ANTI_REORG_DELAY - 1);
477-
assert_eq!(vec![Balance::MaybeClaimableHTLCAwaitingTimeout {
477+
assert_eq!(vec![Balance::MaybeTimeoutClaimableHTLC {
478478
claimable_amount_satoshis: 4_000,
479479
claimable_height: htlc_cltv_timeout,
480480
}],
@@ -646,10 +646,10 @@ fn test_balances_on_local_commitment_htlcs() {
646646
claimable_amount_satoshis: 1_000_000 - 10_000 - 20_000 - chan_feerate *
647647
(channel::commitment_tx_base_weight(opt_anchors) + 2 * channel::COMMITMENT_TX_WEIGHT_PER_HTLC) / 1000,
648648
confirmation_height: node_a_commitment_claimable,
649-
}, Balance::MaybeClaimableHTLCAwaitingTimeout {
649+
}, Balance::MaybeTimeoutClaimableHTLC {
650650
claimable_amount_satoshis: 10_000,
651651
claimable_height: htlc_cltv_timeout,
652-
}, Balance::MaybeClaimableHTLCAwaitingTimeout {
652+
}, Balance::MaybeTimeoutClaimableHTLC {
653653
claimable_amount_satoshis: 20_000,
654654
claimable_height: htlc_cltv_timeout,
655655
}]),
@@ -673,10 +673,10 @@ fn test_balances_on_local_commitment_htlcs() {
673673
claimable_amount_satoshis: 1_000_000 - 10_000 - 20_000 - chan_feerate *
674674
(channel::commitment_tx_base_weight(opt_anchors) + 2 * channel::COMMITMENT_TX_WEIGHT_PER_HTLC) / 1000,
675675
confirmation_height: node_a_commitment_claimable,
676-
}, Balance::MaybeClaimableHTLCAwaitingTimeout {
676+
}, Balance::MaybeTimeoutClaimableHTLC {
677677
claimable_amount_satoshis: 10_000,
678678
claimable_height: htlc_cltv_timeout,
679-
}, Balance::MaybeClaimableHTLCAwaitingTimeout {
679+
}, Balance::MaybeTimeoutClaimableHTLC {
680680
claimable_amount_satoshis: 20_000,
681681
claimable_height: htlc_cltv_timeout,
682682
}]),
@@ -697,7 +697,7 @@ fn test_balances_on_local_commitment_htlcs() {
697697
}, Balance::ClaimableAwaitingConfirmations {
698698
claimable_amount_satoshis: 10_000,
699699
confirmation_height: node_a_htlc_claimable,
700-
}, Balance::MaybeClaimableHTLCAwaitingTimeout {
700+
}, Balance::MaybeTimeoutClaimableHTLC {
701701
claimable_amount_satoshis: 20_000,
702702
claimable_height: htlc_cltv_timeout,
703703
}]),
@@ -714,7 +714,7 @@ fn test_balances_on_local_commitment_htlcs() {
714714
}, Balance::ClaimableAwaitingConfirmations {
715715
claimable_amount_satoshis: 10_000,
716716
confirmation_height: node_a_htlc_claimable,
717-
}, Balance::MaybeClaimableHTLCAwaitingTimeout {
717+
}, Balance::MaybeTimeoutClaimableHTLC {
718718
claimable_amount_satoshis: 20_000,
719719
claimable_height: htlc_cltv_timeout,
720720
}]),
@@ -783,7 +783,7 @@ fn test_no_preimage_inbound_htlc_balances() {
783783
}, Balance::MaybePreimageClaimableHTLC {
784784
claimable_amount_satoshis: 20_000,
785785
expiry_height: htlc_cltv_timeout,
786-
}, Balance::MaybeClaimableHTLCAwaitingTimeout {
786+
}, Balance::MaybeTimeoutClaimableHTLC {
787787
claimable_amount_satoshis: 10_000,
788788
claimable_height: htlc_cltv_timeout,
789789
}]),
@@ -794,7 +794,7 @@ fn test_no_preimage_inbound_htlc_balances() {
794794
}, Balance::MaybePreimageClaimableHTLC {
795795
claimable_amount_satoshis: 10_000,
796796
expiry_height: htlc_cltv_timeout,
797-
}, Balance::MaybeClaimableHTLCAwaitingTimeout {
797+
}, Balance::MaybeTimeoutClaimableHTLC {
798798
claimable_amount_satoshis: 20_000,
799799
claimable_height: htlc_cltv_timeout,
800800
}]),
@@ -816,7 +816,7 @@ fn test_no_preimage_inbound_htlc_balances() {
816816
}, Balance::MaybePreimageClaimableHTLC {
817817
claimable_amount_satoshis: 20_000,
818818
expiry_height: htlc_cltv_timeout,
819-
}, Balance::MaybeClaimableHTLCAwaitingTimeout {
819+
}, Balance::MaybeTimeoutClaimableHTLC {
820820
claimable_amount_satoshis: 10_000,
821821
claimable_height: htlc_cltv_timeout,
822822
}]);
@@ -842,7 +842,7 @@ fn test_no_preimage_inbound_htlc_balances() {
842842
}, Balance::MaybePreimageClaimableHTLC {
843843
claimable_amount_satoshis: 10_000,
844844
expiry_height: htlc_cltv_timeout,
845-
}, Balance::MaybeClaimableHTLCAwaitingTimeout {
845+
}, Balance::MaybeTimeoutClaimableHTLC {
846846
claimable_amount_satoshis: 20_000,
847847
claimable_height: htlc_cltv_timeout,
848848
}]);
@@ -1089,13 +1089,13 @@ fn do_test_revoked_counterparty_commitment_balances(confirm_htlc_spend_first: bo
10891089
// lists the two on-chain timeout-able HTLCs as claimable balances.
10901090
assert_eq!(sorted_vec(vec![Balance::ClaimableOnChannelClose {
10911091
claimable_amount_satoshis: 100_000 - 5_000 - 4_000 - 3 - 2_000 + 3_000,
1092-
}, Balance::MaybeClaimableHTLCAwaitingTimeout {
1092+
}, Balance::MaybeTimeoutClaimableHTLC {
10931093
claimable_amount_satoshis: 2_000,
10941094
claimable_height: missing_htlc_cltv_timeout,
1095-
}, Balance::MaybeClaimableHTLCAwaitingTimeout {
1095+
}, Balance::MaybeTimeoutClaimableHTLC {
10961096
claimable_amount_satoshis: 4_000,
10971097
claimable_height: htlc_cltv_timeout,
1098-
}, Balance::MaybeClaimableHTLCAwaitingTimeout {
1098+
}, Balance::MaybeTimeoutClaimableHTLC {
10991099
claimable_amount_satoshis: 5_000,
11001100
claimable_height: live_htlc_cltv_timeout,
11011101
}]),
@@ -1501,10 +1501,10 @@ fn test_revoked_counterparty_aggregated_claims() {
15011501

15021502
assert_eq!(sorted_vec(vec![Balance::ClaimableOnChannelClose {
15031503
claimable_amount_satoshis: 100_000 - 4_000 - 3_000,
1504-
}, Balance::MaybeClaimableHTLCAwaitingTimeout {
1504+
}, Balance::MaybeTimeoutClaimableHTLC {
15051505
claimable_amount_satoshis: 4_000,
15061506
claimable_height: htlc_cltv_timeout,
1507-
}, Balance::MaybeClaimableHTLCAwaitingTimeout {
1507+
}, Balance::MaybeTimeoutClaimableHTLC {
15081508
claimable_amount_satoshis: 3_000,
15091509
claimable_height: htlc_cltv_timeout,
15101510
}]),

0 commit comments

Comments
 (0)