Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 161
Expose ChannelCounterparty and ReserveType in ChannelDetails#841
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
tnull
merged 3 commits into
lightningdevkit:main
from
enigbe:2026-03-channel-reserve-type-exposureJun 23, 2026
Uh oh!
There was an error while loading. Please reload this page.
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -25,7 +25,7 @@ pub use bitcoin::{Address, BlockHash, Network, OutPoint, ScriptBuf, Txid}; | ||
| pub use lightning::chain::channelmonitor::BalanceSource; | ||
| use lightning::events::PaidBolt12Invoice as LdkPaidBolt12Invoice; | ||
| pub use lightning::events::{ClosureReason, PaymentFailureReason}; | ||
| use lightning::ln::channel_state::ChannelShutdownState; | ||
| use lightning::ln::channel_state::{ChannelShutdownState, CounterpartyForwardingInfo}; | ||
| use lightning::ln::channelmanager::PaymentId; | ||
| use lightning::ln::msgs::DecodeError; | ||
| pub use lightning::ln::types::ChannelId; | ||
| @@ -44,7 +44,7 @@ pub use lightning_liquidity::lsps0::ser::LSPSDateTime; | ||
| pub use lightning_liquidity::lsps1::msgs::{ | ||
| LSPS1ChannelInfo, LSPS1OrderId, LSPS1OrderParams, LSPS1PaymentState, | ||
| }; | ||
| use lightning_types::features::NodeFeatures as LdkNodeFeatures; | ||
| use lightning_types::features::{InitFeatures as LdkInitFeatures, NodeFeatures as LdkNodeFeatures}; | ||
| pub use lightning_types::payment::{PaymentHash, PaymentPreimage, PaymentSecret}; | ||
| pub use lightning_types::string::UntrustedString; | ||
| use vss_client::headers::{ | ||
| @@ -1526,6 +1526,7 @@ pub struct NodeFeatures { | ||
| pub(crate) inner: LdkNodeFeatures, | ||
| } | ||
| #[uniffi::export] | ||
| impl NodeFeatures { | ||
| /// Constructs node features from big-endian BOLT 9 encoded bytes. | ||
| #[uniffi::constructor] | ||
| @@ -1815,6 +1816,298 @@ impl From<LdkNodeFeatures> for NodeFeatures { | ||
| } | ||
| } | ||
| #[derive(Debug, Clone, PartialEq, Eq, uniffi::Object)] | ||
| #[uniffi::export(Debug, Eq)] | ||
| pub struct InitFeatures { | ||
| pub(crate) inner: LdkInitFeatures, | ||
| } | ||
| #[uniffi::export] | ||
| impl InitFeatures { | ||
| /// Constructs init features from big-endian BOLT 9 encoded bytes. | ||
| #[uniffi::constructor] | ||
| pub fn from_bytes(bytes: &[u8]) -> Self { | ||
| Self { inner: LdkInitFeatures::from_be_bytes(bytes.to_vec()).into() } | ||
| } | ||
| /// Returns the BOLT 9 big-endian encoded representation of these features. | ||
| pub fn to_bytes(&self) -> Vec<u8> { | ||
| self.inner.encode() | ||
| } | ||
| /// Whether the peer's `init` message advertises support for `option_static_remotekey`. | ||
| pub fn supports_static_remote_key(&self) -> bool { | ||
enigbe marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| self.inner.supports_static_remote_key() | ||
| } | ||
| /// Whether the peer's `init` message requires `option_static_remotekey`. | ||
| pub fn requires_static_remote_key(&self) -> bool { | ||
| self.inner.requires_static_remote_key() | ||
| } | ||
| /// Whether the peer's `init` message advertises support for `option_anchors_zero_fee_htlc_tx`. | ||
| pub fn supports_anchors_zero_fee_htlc_tx(&self) -> bool { | ||
| self.inner.supports_anchors_zero_fee_htlc_tx() | ||
| } | ||
| /// Whether the peer's `init` message requires `option_anchors_zero_fee_htlc_tx`. | ||
| pub fn requires_anchors_zero_fee_htlc_tx(&self) -> bool { | ||
| self.inner.requires_anchors_zero_fee_htlc_tx() | ||
| } | ||
| /// Whether the peer's `init` message advertises support for `option_anchors_nonzero_fee_htlc_tx`. | ||
| pub fn supports_anchors_nonzero_fee_htlc_tx(&self) -> bool { | ||
| self.inner.supports_anchors_nonzero_fee_htlc_tx() | ||
| } | ||
| /// Whether the peer's `init` message requires `option_anchors_nonzero_fee_htlc_tx`. | ||
| pub fn requires_anchors_nonzero_fee_htlc_tx(&self) -> bool { | ||
| self.inner.requires_anchors_nonzero_fee_htlc_tx() | ||
| } | ||
| /// Whether the peer's `init` message advertises support for `option_support_large_channel`. | ||
| pub fn supports_wumbo(&self) -> bool { | ||
| self.inner.supports_wumbo() | ||
| } | ||
| /// Whether the peer's `init` message requires `option_support_large_channel`. | ||
| pub fn requires_wumbo(&self) -> bool { | ||
| self.inner.requires_wumbo() | ||
| } | ||
| /// Whether the peer's `init` message advertises support for `option_route_blinding`. | ||
| pub fn supports_route_blinding(&self) -> bool { | ||
| self.inner.supports_route_blinding() | ||
| } | ||
| /// Whether the peer's `init` message requires `option_route_blinding`. | ||
| pub fn requires_route_blinding(&self) -> bool { | ||
| self.inner.requires_route_blinding() | ||
| } | ||
| /// Whether the peer's `init` message advertises support for `option_onion_messages`. | ||
| pub fn supports_onion_messages(&self) -> bool { | ||
| self.inner.supports_onion_messages() | ||
| } | ||
| /// Whether the peer's `init` message requires `option_onion_messages`. | ||
| pub fn requires_onion_messages(&self) -> bool { | ||
| self.inner.requires_onion_messages() | ||
| } | ||
| /// Whether the peer's `init` message advertises support for `option_scid_alias`. | ||
| pub fn supports_scid_privacy(&self) -> bool { | ||
| self.inner.supports_scid_privacy() | ||
| } | ||
| /// Whether the peer's `init` message requires `option_scid_alias`. | ||
| pub fn requires_scid_privacy(&self) -> bool { | ||
| self.inner.requires_scid_privacy() | ||
| } | ||
| /// Whether the peer's `init` message advertises support for `option_zeroconf`. | ||
| pub fn supports_zero_conf(&self) -> bool { | ||
| self.inner.supports_zero_conf() | ||
| } | ||
| /// Whether the peer's `init` message requires `option_zeroconf`. | ||
| pub fn requires_zero_conf(&self) -> bool { | ||
enigbe marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| self.inner.requires_zero_conf() | ||
| } | ||
| /// Whether the peer's `init` message advertises support for `option_dual_fund`. | ||
| pub fn supports_dual_fund(&self) -> bool { | ||
| self.inner.supports_dual_fund() | ||
| } | ||
| /// Whether the peer's `init` message requires `option_dual_fund`. | ||
| pub fn requires_dual_fund(&self) -> bool { | ||
| self.inner.requires_dual_fund() | ||
| } | ||
| /// Whether the peer's `init` message advertises support for `option_quiesce`. | ||
| pub fn supports_quiescence(&self) -> bool { | ||
| self.inner.supports_quiescence() | ||
| } | ||
| /// Whether the peer's `init` message requires `option_quiesce`. | ||
| pub fn requires_quiescence(&self) -> bool { | ||
| self.inner.requires_quiescence() | ||
| } | ||
| /// Whether the peer's `init` message advertises support for `option_data_loss_protect`. | ||
| pub fn supports_data_loss_protect(&self) -> bool { | ||
| self.inner.supports_data_loss_protect() | ||
| } | ||
| /// Whether the peer's `init` message requires `option_data_loss_protect`. | ||
| pub fn requires_data_loss_protect(&self) -> bool { | ||
| self.inner.requires_data_loss_protect() | ||
| } | ||
| /// Whether the peer's `init` message advertises support for `option_upfront_shutdown_script`. | ||
| pub fn supports_upfront_shutdown_script(&self) -> bool { | ||
| self.inner.supports_upfront_shutdown_script() | ||
| } | ||
| /// Whether the peer's `init` message requires `option_upfront_shutdown_script`. | ||
| pub fn requires_upfront_shutdown_script(&self) -> bool { | ||
| self.inner.requires_upfront_shutdown_script() | ||
| } | ||
| /// Whether the peer's `init` message advertises support for `gossip_queries`. | ||
| pub fn supports_gossip_queries(&self) -> bool { | ||
| self.inner.supports_gossip_queries() | ||
| } | ||
| /// Whether the peer's `init` message requires `gossip_queries`. | ||
| pub fn requires_gossip_queries(&self) -> bool { | ||
| self.inner.requires_gossip_queries() | ||
| } | ||
| /// Whether the peer's `init` message advertises support for `var_onion_optin`. | ||
| pub fn supports_variable_length_onion(&self) -> bool { | ||
| self.inner.supports_variable_length_onion() | ||
| } | ||
| /// Whether the peer's `init` message requires `var_onion_optin`. | ||
| pub fn requires_variable_length_onion(&self) -> bool { | ||
| self.inner.requires_variable_length_onion() | ||
| } | ||
| /// Whether the peer's `init` message advertises support for `payment_secret`. | ||
| pub fn supports_payment_secret(&self) -> bool { | ||
| self.inner.supports_payment_secret() | ||
| } | ||
| /// Whether the peer's `init` message requires `payment_secret`. | ||
| pub fn requires_payment_secret(&self) -> bool { | ||
| self.inner.requires_payment_secret() | ||
| } | ||
| /// Whether the peer's `init` message advertises support for `basic_mpp`. | ||
| pub fn supports_basic_mpp(&self) -> bool { | ||
| self.inner.supports_basic_mpp() | ||
| } | ||
| /// Whether the peer's `init` message requires `basic_mpp`. | ||
| pub fn requires_basic_mpp(&self) -> bool { | ||
| self.inner.requires_basic_mpp() | ||
| } | ||
| /// Whether the peer's `init` message advertises support for `opt_shutdown_anysegwit`. | ||
| pub fn supports_shutdown_anysegwit(&self) -> bool { | ||
| self.inner.supports_shutdown_anysegwit() | ||
| } | ||
| /// Whether the peer's `init` message requires `opt_shutdown_anysegwit`. | ||
| pub fn requires_shutdown_anysegwit(&self) -> bool { | ||
| self.inner.requires_shutdown_anysegwit() | ||
| } | ||
| /// Whether the peer's `init` message advertises support for `option_channel_type`. | ||
| pub fn supports_channel_type(&self) -> bool { | ||
| self.inner.supports_channel_type() | ||
| } | ||
| /// Whether the peer's `init` message requires `option_channel_type`. | ||
| pub fn requires_channel_type(&self) -> bool { | ||
| self.inner.requires_channel_type() | ||
| } | ||
| /// Whether the peer's `init` message advertises support for `option_trampoline`. | ||
| pub fn supports_trampoline_routing(&self) -> bool { | ||
| self.inner.supports_trampoline_routing() | ||
| } | ||
| /// Whether the peer's `init` message requires `option_trampoline`. | ||
| pub fn requires_trampoline_routing(&self) -> bool { | ||
| self.inner.requires_trampoline_routing() | ||
| } | ||
| /// Whether the peer's `init` message advertises support for `option_simple_close`. | ||
| pub fn supports_simple_close(&self) -> bool { | ||
| self.inner.supports_simple_close() | ||
| } | ||
| /// Whether the peer's `init` message requires `option_simple_close`. | ||
| pub fn requires_simple_close(&self) -> bool { | ||
| self.inner.requires_simple_close() | ||
| } | ||
| /// Whether the peer's `init` message advertises support for `option_splice`. | ||
| pub fn supports_splicing(&self) -> bool { | ||
| self.inner.supports_splicing() | ||
| } | ||
| /// Whether the peer's `init` message requires `option_splice`. | ||
| pub fn requires_splicing(&self) -> bool { | ||
| self.inner.requires_splicing() | ||
| } | ||
| /// Whether the peer's `init` message advertises support for `option_provide_storage`. | ||
| pub fn supports_provide_storage(&self) -> bool { | ||
| self.inner.supports_provide_storage() | ||
| } | ||
| /// Whether the peer's `init` message requires `option_provide_storage`. | ||
| pub fn requires_provide_storage(&self) -> bool { | ||
| self.inner.requires_provide_storage() | ||
| } | ||
| /// Whether the peer's `init` message set `initial_routing_sync`. | ||
| pub fn initial_routing_sync(&self) -> bool { | ||
| self.inner.initial_routing_sync() | ||
| } | ||
| /// Whether the peer's `init` message advertises support for `option_taproot`. | ||
| pub fn supports_taproot(&self) -> bool { | ||
| self.inner.supports_taproot() | ||
| } | ||
| /// Whether the peer's `init` message requires `option_taproot`. | ||
| pub fn requires_taproot(&self) -> bool { | ||
| self.inner.requires_taproot() | ||
| } | ||
| /// Whether the peer's `init` message advertises support for `option_zero_fee_commitments`. | ||
| pub fn supports_anchor_zero_fee_commitments(&self) -> bool { | ||
| self.inner.supports_anchor_zero_fee_commitments() | ||
| } | ||
| /// Whether the peer's `init` message requires `option_zero_fee_commitments`. | ||
| pub fn requires_anchor_zero_fee_commitments(&self) -> bool { | ||
| self.inner.requires_anchor_zero_fee_commitments() | ||
| } | ||
| /// Whether the peer's `init` message advertises support for HTLC hold. | ||
| pub fn supports_htlc_hold(&self) -> bool { | ||
| self.inner.supports_htlc_hold() | ||
| } | ||
| /// Whether the peer's `init` message requires HTLC hold. | ||
| pub fn requires_htlc_hold(&self) -> bool { | ||
| self.inner.requires_htlc_hold() | ||
| } | ||
| } | ||
| impl From<LdkInitFeatures> for InitFeatures { | ||
| fn from(ldk_init: LdkInitFeatures) -> Self { | ||
| Self { inner: ldk_init } | ||
| } | ||
| } | ||
| /// Information needed for constructing an invoice route hint for this channel. | ||
| #[uniffi::remote(Record)] | ||
| pub struct CounterpartyForwardingInfo { | ||
| /// Base routing fee in millisatoshis. | ||
| pub fee_base_msat: u32, | ||
| /// Amount in millionths of a satoshi the channel will charge per transferred satoshi. | ||
| pub fee_proportional_millionths: u32, | ||
| /// The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart, | ||
| /// such that the outgoing HTLC is forwardable to this counterparty. | ||
| pub cltv_expiry_delta: u16, | ||
| } | ||
| #[cfg(test)] | ||
| mod tests { | ||
| use std::num::NonZeroU64; | ||
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be missing
#[uniffi::export]?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has been added.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, the one you added is also fine to keep, but we'll also need to add
uniffi::exportto the impl block, as otherwise the methods won't be available in bindings.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's right. I've added this and extended the coverage in the python test to check the now-exposed methods. I noticed
NodeFeatureshad the same issue, so I fixed and covered that as well.