Skip to content

Commit 116aa6e

Browse files
committed
f MaybePreimageClaimableHTLC
1 parent b14a8fb commit 116aa6e

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

lightning/src/chain/channelmonitor.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ pub enum Balance {
589589
/// HTLCs which we received from our counterparty which are claimable with a preimage which we
590590
/// do not currently have. This will only be claimable if we receive the preimage from the node
591591
/// to which we forwarded this HTLC before the timeout.
592-
MaybePreimageClaimableHTLCAwaitingTimeout {
592+
MaybePreimageClaimableHTLC {
593593
/// The amount potentially available to claim, in satoshis, excluding the on-chain fees
594594
/// which will be required to do so.
595595
claimable_amount_satoshis: u64,
@@ -1577,7 +1577,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
15771577
});
15781578
}
15791579
} else if htlc_resolved.is_none() {
1580-
return Some(Balance::MaybePreimageClaimableHTLCAwaitingTimeout {
1580+
return Some(Balance::MaybePreimageClaimableHTLC {
15811581
claimable_amount_satoshis: htlc.amount_msat / 1000,
15821582
expiry_height: htlc.cltv_expiry,
15831583
});
@@ -1747,7 +1747,7 @@ impl<Signer: Sign> ChannelMonitor<Signer> {
17471747
} else {
17481748
// As long as the HTLC is still in our latest commitment state, treat
17491749
// it as potentially claimable, even if it has long-since expired.
1750-
res.push(Balance::MaybePreimageClaimableHTLCAwaitingTimeout {
1750+
res.push(Balance::MaybePreimageClaimableHTLC {
17511751
claimable_amount_satoshis: htlc.amount_msat / 1000,
17521752
expiry_height: htlc.cltv_expiry,
17531753
});

lightning/src/ln/monitor_tests.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -290,10 +290,10 @@ fn do_test_claim_value_force_close(prev_commitment_tx: bool) {
290290
sorted_vec(nodes[0].chain_monitor.chain_monitor.get_monitor(funding_outpoint).unwrap().get_claimable_balances()));
291291
assert_eq!(sorted_vec(vec![Balance::ClaimableOnChannelClose {
292292
claimable_amount_satoshis: 1_000,
293-
}, Balance::MaybePreimageClaimableHTLCAwaitingTimeout {
293+
}, Balance::MaybePreimageClaimableHTLC {
294294
claimable_amount_satoshis: 3_000,
295295
expiry_height: htlc_cltv_timeout,
296-
}, Balance::MaybePreimageClaimableHTLCAwaitingTimeout {
296+
}, Balance::MaybePreimageClaimableHTLC {
297297
claimable_amount_satoshis: 4_000,
298298
expiry_height: htlc_cltv_timeout,
299299
}]),
@@ -755,8 +755,8 @@ fn test_balances_on_local_commitment_htlcs() {
755755

756756
#[test]
757757
fn test_no_preimage_inbound_htlc_balances() {
758-
// Tests that MaybePreimageClaimableHTLCAwaitingTimeouts are generated for inbound HTLCs for
759-
// which we do not have a preimage.
758+
// Tests that MaybePreimageClaimableHTLC are generated for inbound HTLCs for which we do not
759+
// have a preimage.
760760
let chanmon_cfgs = create_chanmon_cfgs(2);
761761
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
762762
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
@@ -780,7 +780,7 @@ fn test_no_preimage_inbound_htlc_balances() {
780780
assert_eq!(sorted_vec(vec![Balance::ClaimableOnChannelClose {
781781
claimable_amount_satoshis: 1_000_000 - 500_000 - 10_000 - chan_feerate *
782782
(channel::commitment_tx_base_weight(opt_anchors) + 2 * channel::COMMITMENT_TX_WEIGHT_PER_HTLC) / 1000,
783-
}, Balance::MaybePreimageClaimableHTLCAwaitingTimeout {
783+
}, Balance::MaybePreimageClaimableHTLC {
784784
claimable_amount_satoshis: 20_000,
785785
expiry_height: htlc_cltv_timeout,
786786
}, Balance::MaybeClaimableHTLCAwaitingTimeout {
@@ -791,7 +791,7 @@ fn test_no_preimage_inbound_htlc_balances() {
791791

792792
assert_eq!(sorted_vec(vec![Balance::ClaimableOnChannelClose {
793793
claimable_amount_satoshis: 500_000 - 20_000,
794-
}, Balance::MaybePreimageClaimableHTLCAwaitingTimeout {
794+
}, Balance::MaybePreimageClaimableHTLC {
795795
claimable_amount_satoshis: 10_000,
796796
expiry_height: htlc_cltv_timeout,
797797
}, Balance::MaybeClaimableHTLCAwaitingTimeout {
@@ -813,7 +813,7 @@ fn test_no_preimage_inbound_htlc_balances() {
813813
claimable_amount_satoshis: 1_000_000 - 500_000 - 10_000 - chan_feerate *
814814
(channel::commitment_tx_base_weight(opt_anchors) + 2 * channel::COMMITMENT_TX_WEIGHT_PER_HTLC) / 1000,
815815
confirmation_height: node_a_commitment_claimable,
816-
}, Balance::MaybePreimageClaimableHTLCAwaitingTimeout {
816+
}, Balance::MaybePreimageClaimableHTLC {
817817
claimable_amount_satoshis: 20_000,
818818
expiry_height: htlc_cltv_timeout,
819819
}, Balance::MaybeClaimableHTLCAwaitingTimeout {
@@ -839,7 +839,7 @@ fn test_no_preimage_inbound_htlc_balances() {
839839
let mut bs_pre_spend_claims = sorted_vec(vec![Balance::ClaimableAwaitingConfirmations {
840840
claimable_amount_satoshis: 500_000 - 20_000,
841841
confirmation_height: node_b_commitment_claimable,
842-
}, Balance::MaybePreimageClaimableHTLCAwaitingTimeout {
842+
}, Balance::MaybePreimageClaimableHTLC {
843843
claimable_amount_satoshis: 10_000,
844844
expiry_height: htlc_cltv_timeout,
845845
}, Balance::MaybeClaimableHTLCAwaitingTimeout {
@@ -897,7 +897,7 @@ fn test_no_preimage_inbound_htlc_balances() {
897897
claimable_amount_satoshis: 1_000_000 - 500_000 - 10_000 - chan_feerate *
898898
(channel::commitment_tx_base_weight(opt_anchors) + 2 * channel::COMMITMENT_TX_WEIGHT_PER_HTLC) / 1000,
899899
confirmation_height: node_a_commitment_claimable,
900-
}, Balance::MaybePreimageClaimableHTLCAwaitingTimeout {
900+
}, Balance::MaybePreimageClaimableHTLC {
901901
claimable_amount_satoshis: 20_000,
902902
expiry_height: htlc_cltv_timeout,
903903
}, Balance::ClaimableAwaitingConfirmations {
@@ -911,7 +911,7 @@ fn test_no_preimage_inbound_htlc_balances() {
911911
claimable_amount_satoshis: 1_000_000 - 500_000 - 10_000 - chan_feerate *
912912
(channel::commitment_tx_base_weight(opt_anchors) + 2 * channel::COMMITMENT_TX_WEIGHT_PER_HTLC) / 1000,
913913
confirmation_height: node_a_commitment_claimable,
914-
}, Balance::MaybePreimageClaimableHTLCAwaitingTimeout {
914+
}, Balance::MaybePreimageClaimableHTLC {
915915
claimable_amount_satoshis: 20_000,
916916
expiry_height: htlc_cltv_timeout,
917917
}, Balance::ClaimableAwaitingConfirmations {
@@ -952,7 +952,7 @@ fn test_no_preimage_inbound_htlc_balances() {
952952
// was already claimed.
953953
mine_transaction(&nodes[1], &bs_htlc_timeout_claim[0]);
954954
let bs_timeout_claimable_height = nodes[1].best_block_info().1 + ANTI_REORG_DELAY - 1;
955-
assert_eq!(sorted_vec(vec![Balance::MaybePreimageClaimableHTLCAwaitingTimeout {
955+
assert_eq!(sorted_vec(vec![Balance::MaybePreimageClaimableHTLC {
956956
claimable_amount_satoshis: 10_000,
957957
expiry_height: htlc_cltv_timeout,
958958
}, Balance::ClaimableAwaitingConfirmations {
@@ -962,7 +962,7 @@ fn test_no_preimage_inbound_htlc_balances() {
962962
sorted_vec(nodes[1].chain_monitor.chain_monitor.get_monitor(funding_outpoint).unwrap().get_claimable_balances()));
963963

964964
mine_transaction(&nodes[1], &as_htlc_timeout_claim[0]);
965-
assert_eq!(sorted_vec(vec![Balance::MaybePreimageClaimableHTLCAwaitingTimeout {
965+
assert_eq!(sorted_vec(vec![Balance::MaybePreimageClaimableHTLC {
966966
claimable_amount_satoshis: 10_000,
967967
expiry_height: htlc_cltv_timeout,
968968
}, Balance::ClaimableAwaitingConfirmations {
@@ -974,7 +974,7 @@ fn test_no_preimage_inbound_htlc_balances() {
974974
connect_blocks(&nodes[1], ANTI_REORG_DELAY - 2);
975975
expect_payment_failed!(nodes[1], to_a_failed_payment_hash, true);
976976

977-
assert_eq!(vec![Balance::MaybePreimageClaimableHTLCAwaitingTimeout {
977+
assert_eq!(vec![Balance::MaybePreimageClaimableHTLC {
978978
claimable_amount_satoshis: 10_000,
979979
expiry_height: htlc_cltv_timeout,
980980
}],

0 commit comments

Comments
 (0)