Skip to content

Commit

Permalink
f Rename SweeperBalance and sweeper_balances
Browse files Browse the repository at this point in the history
  • Loading branch information
tnull committed Feb 19, 2024
1 parent 4b1c34b commit 1a893e7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions bindings/ldk_node.udl
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ interface LightningBalance {
};

[Enum]
interface SweeperBalance {
interface PendingSweepBalance {
PendingBroadcast ( ChannelId? channel_id, u64 amount_satoshis );
BroadcastAwaitingConfirmation ( ChannelId? channel_id, u32 latest_broadcast_height, Txid latest_spending_txid, u64 amount_satoshis );
AwaitingThresholdConfirmations ( ChannelId? channel_id, Txid latest_spending_txid, BlockHash confirmation_hash, u32 confirmation_height, u64 amount_satoshis);
Expand All @@ -248,7 +248,7 @@ dictionary BalanceDetails {
u64 spendable_onchain_balance_sats;
u64 total_lightning_balance_sats;
sequence<LightningBalance> lightning_balances;
sequence<SweeperBalance> sweeper_balances;
sequence<PendingSweepBalance> pending_balances_from_channel_closures;
};

interface ChannelConfig {
Expand Down
6 changes: 3 additions & 3 deletions src/balance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub struct BalanceDetails {
///
/// Note that, depending on the sync status of the wallets, swept balances listed here might or
/// might not already be accounted for in [`Self::total_onchain_balance_sats`].
pub sweeper_balances: Vec<SweeperBalance>,
pub pending_balances_from_channel_closures: Vec<PendingSweepBalance>,
}

/// Details about the status of a known Lightning balance.
Expand Down Expand Up @@ -206,7 +206,7 @@ impl LightningBalance {

/// Details about the status of a known balance currently being swept to our on-chain wallet.
#[derive(Debug, Clone)]
pub enum SweeperBalance {
pub enum PendingSweepBalance {
/// The spendable output is about to be swept, but a spending transaction has yet to be generated and
/// broadcast.
PendingBroadcast {
Expand Down Expand Up @@ -246,7 +246,7 @@ pub enum SweeperBalance {
},
}

impl SweeperBalance {
impl PendingSweepBalance {
pub(crate) fn from_tracked_spendable_output(output_info: SpendableOutputInfo) -> Self {
if let Some(confirmation_hash) = output_info.confirmation_hash {
debug_assert!(output_info.confirmation_height.is_some());
Expand Down
8 changes: 4 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ pub use bitcoin;
pub use lightning;
pub use lightning_invoice;

pub use balance::{BalanceDetails, LightningBalance, SweeperBalance};
pub use balance::{BalanceDetails, LightningBalance, PendingSweepBalance};
pub use error::Error as NodeError;
use error::Error;

Expand Down Expand Up @@ -1591,19 +1591,19 @@ impl<K: KVStore + Sync + Send + 'static> Node<K> {
}
}

let sweeper_balances = self
let pending_balances_from_channel_closures = self
.output_sweeper
.tracked_spendable_outputs()
.into_iter()
.map(|o| SweeperBalance::from_tracked_spendable_output(o))
.map(|o| PendingSweepBalance::from_tracked_spendable_output(o))
.collect();

BalanceDetails {
total_onchain_balance_sats,
spendable_onchain_balance_sats,
total_lightning_balance_sats,
lightning_balances,
sweeper_balances,
pending_balances_from_channel_closures,
}
}

Expand Down

0 comments on commit 1a893e7

Please sign in to comment.