Skip to content

Commit 167c2d6

Browse files
committed
f ClaimableBalance -> Balance
1 parent bc30651 commit 167c2d6

File tree

2 files changed

+55
-55
lines changed

2 files changed

+55
-55
lines changed

lightning/src/chain/channelmonitor.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ impl_writeable_tlv_based_enum_upgradable!(ChannelMonitorUpdateStep,
541541
/// be provided.
542542
#[derive(Clone, Debug, PartialEq, Eq)]
543543
#[cfg_attr(test, derive(PartialOrd, Ord))]
544-
pub enum ClaimableBalance {
544+
pub enum Balance {
545545
/// The channel is not yet closed (or the commitment or closing transaction has not yet
546546
/// appeared in a block). The given balance is claimable (less on-chain fees) if the channel is
547547
/// force-closed now.
@@ -566,7 +566,7 @@ pub enum ClaimableBalance {
566566
///
567567
/// Once the spending transaction confirms, before it has reached enough confirmations to be
568568
/// considered safe from chain reorganizations, the balance will instead be provided via
569-
/// [`ClaimableBalance::ClaimableAwaitingConfirmations`].
569+
/// [`Balance::ClaimableAwaitingConfirmations`].
570570
ContentiousClaimable {
571571
/// The amount available to claim, in satoshis, excluding the on-chain fees which will be
572572
/// required to do so.
@@ -1369,9 +1369,9 @@ impl<Signer: Sign> ChannelMonitor<Signer> {
13691369
/// state(s) may not be fully captured here.
13701370
// TODO, fix that ^
13711371
///
1372-
/// See [`ClaimableBalance`] for additional details on the types of claimable balances which
1372+
/// See [`Balance`] for additional details on the types of claimable balances which
13731373
/// may be returned here and their meanings.
1374-
pub fn get_claimable_balances(&self) -> Vec<ClaimableBalance> {
1374+
pub fn get_claimable_balances(&self) -> Vec<Balance> {
13751375
let mut res = Vec::new();
13761376
let us = self.inner.lock().unwrap();
13771377

@@ -1405,12 +1405,12 @@ impl<Signer: Sign> ChannelMonitor<Signer> {
14051405
} else { None }
14061406
});
14071407
if let Some(conf_thresh) = htlc_update_pending {
1408-
res.push(ClaimableBalance::ClaimableAwaitingConfirmations {
1408+
res.push(Balance::ClaimableAwaitingConfirmations {
14091409
claimable_amount_satoshis: htlc.amount_msat / 1000,
14101410
confirmation_height: conf_thresh,
14111411
});
14121412
} else {
1413-
res.push(ClaimableBalance::MaybeClaimableHTLCAwaitingTimeout {
1413+
res.push(Balance::MaybeClaimableHTLCAwaitingTimeout {
14141414
claimable_amount_satoshis: htlc.amount_msat / 1000,
14151415
claimable_height: htlc.cltv_expiry,
14161416
});
@@ -1429,12 +1429,12 @@ impl<Signer: Sign> ChannelMonitor<Signer> {
14291429
} else { None }
14301430
});
14311431
if let Some((conf_thresh, true)) = htlc_spend_pending {
1432-
res.push(ClaimableBalance::ClaimableAwaitingConfirmations {
1432+
res.push(Balance::ClaimableAwaitingConfirmations {
14331433
claimable_amount_satoshis: htlc.amount_msat / 1000,
14341434
confirmation_height: conf_thresh,
14351435
});
14361436
} else {
1437-
res.push(ClaimableBalance::ContentiousClaimable {
1437+
res.push(Balance::ContentiousClaimable {
14381438
claimable_amount_satoshis: htlc.amount_msat / 1000,
14391439
timeout_height: htlc.cltv_expiry,
14401440
});
@@ -1457,7 +1457,7 @@ impl<Signer: Sign> ChannelMonitor<Signer> {
14571457
Some(descriptor.output.value)
14581458
} else { None }
14591459
}) {
1460-
res.push(ClaimableBalance::ClaimableAwaitingConfirmations {
1460+
res.push(Balance::ClaimableAwaitingConfirmations {
14611461
claimable_amount_satoshis: value,
14621462
confirmation_height: conf_thresh,
14631463
});
@@ -1471,7 +1471,7 @@ impl<Signer: Sign> ChannelMonitor<Signer> {
14711471
} else if txid == us.current_holder_commitment_tx.txid {
14721472
walk_htlcs!(true, us.current_holder_commitment_tx.htlc_outputs.iter().map(|(a, _, _)| a));
14731473
if let Some(conf_thresh) = pending_commitment_tx_conf_thresh {
1474-
res.push(ClaimableBalance::ClaimableAwaitingConfirmations {
1474+
res.push(Balance::ClaimableAwaitingConfirmations {
14751475
claimable_amount_satoshis: us.current_holder_commitment_tx.to_self_value_sat,
14761476
confirmation_height: conf_thresh,
14771477
});
@@ -1481,7 +1481,7 @@ impl<Signer: Sign> ChannelMonitor<Signer> {
14811481
if txid == prev_commitment.txid {
14821482
walk_htlcs!(true, prev_commitment.htlc_outputs.iter().map(|(a, _, _)| a));
14831483
if let Some(conf_thresh) = pending_commitment_tx_conf_thresh {
1484-
res.push(ClaimableBalance::ClaimableAwaitingConfirmations {
1484+
res.push(Balance::ClaimableAwaitingConfirmations {
14851485
claimable_amount_satoshis: prev_commitment.to_self_value_sat,
14861486
confirmation_height: conf_thresh,
14871487
});
@@ -1494,7 +1494,7 @@ impl<Signer: Sign> ChannelMonitor<Signer> {
14941494
// We blindly assume this is a cooperative close transaction here, and that
14951495
// neither us nor our counterparty misbehaved. At worst we've under-estimated
14961496
// the amount we can claim as we'll punish a misbehaving counterparty.
1497-
res.push(ClaimableBalance::ClaimableAwaitingConfirmations {
1497+
res.push(Balance::ClaimableAwaitingConfirmations {
14981498
claimable_amount_satoshis: us.current_holder_commitment_tx.to_self_value_sat,
14991499
confirmation_height: conf_thresh,
15001500
});
@@ -1507,15 +1507,15 @@ impl<Signer: Sign> ChannelMonitor<Signer> {
15071507
for (htlc, _, _) in us.current_holder_commitment_tx.htlc_outputs.iter() {
15081508
if htlc.transaction_output_index.is_none() { continue; }
15091509
if htlc.offered {
1510-
res.push(ClaimableBalance::MaybeClaimableHTLCAwaitingTimeout {
1510+
res.push(Balance::MaybeClaimableHTLCAwaitingTimeout {
15111511
claimable_amount_satoshis: htlc.amount_msat / 1000,
15121512
claimable_height: htlc.cltv_expiry,
15131513
});
15141514
} else if us.payment_preimages.get(&htlc.payment_hash).is_some() {
15151515
claimable_inbound_htlc_value_sat += htlc.amount_msat / 1000;
15161516
}
15171517
}
1518-
res.push(ClaimableBalance::ClaimableOnChannelClose {
1518+
res.push(Balance::ClaimableOnChannelClose {
15191519
claimable_amount_satoshis: us.current_holder_commitment_tx.to_self_value_sat + claimable_inbound_htlc_value_sat,
15201520
});
15211521
}
@@ -2708,7 +2708,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
27082708
// we've already failed the HTLC as the commitment transaction
27092709
// which was broadcasted was revoked. In that case, we should
27102710
// spend the HTLC output here immediately, and expose that fact
2711-
// as a ClaimableBalance, something which we do not yet do.
2711+
// as a Balance, something which we do not yet do.
27122712
// TODO: Track the above as claimable!
27132713
}
27142714
continue 'outer_loop;

0 commit comments

Comments
 (0)