pub struct NodeState {Show 24 fields
pub id: String,
pub block_height: u32,
pub network: String,
pub version: String,
pub alias: Option<String>,
pub color: String,
pub num_active_channels: u32,
pub num_pending_channels: u32,
pub num_inactive_channels: u32,
pub channels_balance_msat: u64,
pub max_payable_msat: u64,
pub total_channel_capacity_msat: u64,
pub max_chan_reserve_msat: u64,
pub onchain_balance_msat: u64,
pub unconfirmed_onchain_balance_msat: u64,
pub immature_onchain_balance_msat: u64,
pub pending_onchain_balance_msat: u64,
pub max_receivable_single_payment_msat: u64,
pub total_inbound_liquidity_msat: u64,
pub connected_channel_peers: Vec<String>,
pub utxos: Vec<FundOutput>,
pub total_onchain_msat: u64,
pub total_balance_msat: u64,
pub spendable_balance_msat: u64,
}Expand description
A point-in-time snapshot of the node’s balances, capacity, and
connectivity. Returned by node_state().
All amounts are in millisatoshis (1 sat = 1000 msat).
Fields§
§id: StringThe node’s public key as a lowercase hex string (66 chars).
block_height: u32Latest block height the node has synced to.
network: StringThe Bitcoin network this node is running on (e.g. “bitcoin”, “regtest”).
version: StringCLN version string (e.g. “v24.11”).
alias: Option<String>Human-readable node alias, if set.
color: String3-byte RGB color of the node, as a lowercase hex string (6 chars).
num_active_channels: u32Number of channels that are open and operational. These are the
channels that contribute to channels_balance_msat,
max_payable_msat, total_channel_capacity_msat, and
total_inbound_liquidity_msat.
num_pending_channels: u32Number of channels that are being opened but not yet confirmed. Pending channels do not contribute to any balance or capacity field on this snapshot; their funds show up only after they transition to active.
num_inactive_channels: u32Number of channels that are open but the peer is offline.
Inactive channels hold balance but cannot be used for payments
until the peer reconnects; they do not contribute to
max_payable_msat or total_inbound_liquidity_msat (those are
computed from the live spendable_msat / receivable_msat
reported by CLN, which goes to zero when the peer is offline).
channels_balance_msat: u64Total our-side balance across all open channels, including amounts that protocol reserves make unspendable.
This is the field a wallet’s home screen should show as the user’s “Lightning balance” — it reflects what they own off-chain, matching what they’d expect to see at a glance.
Do not use this to gate a send button: some of it is locked
in channel reserves. Use max_payable_msat for that.
max_payable_msat: u64Aggregate spendable amount across all open channels. Equal to
channels_balance_msat - max_chan_reserve_msat.
This is the field a send screen should gate against — it is what the user can actually move right now over Lightning in total.
Caveat: a single Lightning payment is additionally bounded by
the largest channel’s own spendable_msat. Reaching this full
aggregate amount in one payment requires multi-path-payment
support from the recipient and a working route.
total_channel_capacity_msat: u64Sum of all open channel capacities (your side + remote side).
max_chan_reserve_msat: u64Amount locked in protocol channel reserves, computed as
channels_balance_msat - max_payable_msat. These sats are yours
on paper but cannot be spent until the channel closes.
onchain_balance_msat: u64Confirmed on-chain balance available for spending or opening channels.
unconfirmed_onchain_balance_msat: u64On-chain balance from transactions that have not yet been confirmed.
immature_onchain_balance_msat: u64On-chain balance confirmed but not yet spendable (e.g. coinbase outputs inside the 100-block maturation window).
pending_onchain_balance_msat: u64On-chain balance locked in channels that are being closed. These funds will become available once the close is confirmed.
max_receivable_single_payment_msat: u64Largest single Lightning payment the node can receive without splitting across channels. Bounded by the inbound capacity of the largest open channel.
total_inbound_liquidity_msat: u64Total amount you can receive across all open channels combined.
connected_channel_peers: Vec<String>Lowercase hex public keys of peers we have at least one channel
with and are currently connected to. Peers we’re connected to but
have no channel with are not represented here; for routing-node
use cases, query list_peers() directly.
utxos: Vec<FundOutput>Unspent on-chain outputs owned by the node’s wallet. Excludes
spent outputs; includes confirmed, unconfirmed, immature, and
reserved UTXOs (callers can filter by status and reserved).
total_onchain_msat: u64All non-pending on-chain balance buckets summed:
onchain_balance_msat + unconfirmed_onchain_balance_msat + immature_onchain_balance_msat.
Excludes funds locked in closing channels (pending_onchain_balance_msat)
since those are not yet on-chain UTXOs.
total_balance_msat: u64Everything the user owns, summed: channel balance (including protocol reserves) + all on-chain buckets + funds locked in closing channels. The “total holdings” number a wallet home screen typically shows.
spendable_balance_msat: u64What the user can spend right now:
max_payable_msat + onchain_balance_msat. Excludes reserves,
unconfirmed, immature, and pending amounts. The number a
send-money screen should gate against.
Trait Implementations§
Source§impl<UT> ConvertError<UT> for NodeState
impl<UT> ConvertError<UT> for NodeState
fn try_convert_unexpected_callback_error( e: UnexpectedUniFFICallbackError, ) -> Result<Self>
Source§impl<UT> FfiConverter<UT> for NodeState
impl<UT> FfiConverter<UT> for NodeState
Source§const TYPE_ID_META: MetadataBuffer
const TYPE_ID_META: MetadataBuffer
Source§type FfiType = RustBuffer
type FfiType = RustBuffer
Source§fn lower(v: Self) -> RustBuffer
fn lower(v: Self) -> RustBuffer
Source§fn try_lift(buf: RustBuffer) -> Result<Self>
fn try_lift(buf: RustBuffer) -> Result<Self>
Source§impl<UT> LiftReturn<UT> for NodeState
impl<UT> LiftReturn<UT> for NodeState
Source§fn try_lift_successful_return(v: Self::ReturnType) -> Result<Self>
fn try_lift_successful_return(v: Self::ReturnType) -> Result<Self>
Source§fn lift_foreign_return(
ffi_return: Self::ReturnType,
call_status: RustCallStatus,
) -> Self
fn lift_foreign_return( ffi_return: Self::ReturnType, call_status: RustCallStatus, ) -> Self
Source§fn lift_error(_buf: RustBuffer) -> Self
fn lift_error(_buf: RustBuffer) -> Self
Source§fn handle_callback_unexpected_error(e: UnexpectedUniFFICallbackError) -> Self
fn handle_callback_unexpected_error(e: UnexpectedUniFFICallbackError) -> Self
Source§impl<UT> LowerError<UT> for NodeState
impl<UT> LowerError<UT> for NodeState
Source§fn lower_error(obj: Self) -> RustBuffer
fn lower_error(obj: Self) -> RustBuffer
Source§impl<UT> LowerReturn<UT> for NodeState
impl<UT> LowerReturn<UT> for NodeState
Source§type ReturnType = <NodeState as Lower<UT>>::FfiType
type ReturnType = <NodeState as Lower<UT>>::FfiType
Source§fn lower_return(v: Self) -> Result<Self::ReturnType, RustCallError>
fn lower_return(v: Self) -> Result<Self::ReturnType, RustCallError>
Source§fn handle_failed_lift(
error: LiftArgsError,
) -> Result<Self::ReturnType, RustCallError>
fn handle_failed_lift( error: LiftArgsError, ) -> Result<Self::ReturnType, RustCallError>
Auto Trait Implementations§
impl Freeze for NodeState
impl RefUnwindSafe for NodeState
impl Send for NodeState
impl Sync for NodeState
impl Unpin for NodeState
impl UnsafeUnpin for NodeState
impl UnwindSafe for NodeState
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for T
impl<T> Downcast for T
Source§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request