From 55e311ddc14fbadd263b45b6ee4a019cfa757603 Mon Sep 17 00:00:00 2001 From: elnafateh Date: Thu, 10 Sep 2026 00:08:38 +0100 Subject: [PATCH] Expose funding_redeem_script on Channel --- e2e-tests/tests/e2e.rs | 3 +++ ldk-server-grpc/src/proto/types.proto | 10 ++++++++++ ldk-server-grpc/src/types.rs | 10 ++++++++++ ldk-server/src/util/proto_adapter.rs | 1 + 4 files changed, 24 insertions(+) diff --git a/e2e-tests/tests/e2e.rs b/e2e-tests/tests/e2e.rs index 05dea885..b2f11aed 100644 --- a/e2e-tests/tests/e2e.rs +++ b/e2e-tests/tests/e2e.rs @@ -828,6 +828,9 @@ async fn test_cli_list_channels() { // configured, so the reserve type is deterministically Adaptive. assert_eq!(channel["reserve_type"].as_i64(), Some(ReserveType::Adaptive as i64)); assert!(!channel["channel_type"].as_object().unwrap().is_empty()); + + // A funded, usable channel has a real funding redeem script. + assert!(channel["funding_redeem_script"].as_str().is_some_and(|s| !s.is_empty())); } #[tokio::test] diff --git a/ldk-server-grpc/src/proto/types.proto b/ldk-server-grpc/src/proto/types.proto index cea320b2..1cdb73ad 100644 --- a/ldk-server-grpc/src/proto/types.proto +++ b/ldk-server-grpc/src/proto/types.proto @@ -568,6 +568,16 @@ message Channel { // The negotiated channel-type features, keyed by the signaled BOLT feature bit. // This map is empty until channel negotiation determines the channel type. map channel_type = 33; + +// The witness script that is used to lock the channel's funding output to commitment transactions. +// +// This field will be `None` if we have not negotiated the funding transaction with our +// counterparty already. +// +// When a channel is spliced, this continues to refer to the original pre-splice channel +// state until the splice transaction reaches sufficient confirmations to be locked (and we +// exchange `splice_locked` messages with our peer). + optional string funding_redeem_script = 34; } // ChannelConfig represents the configuration settings for a channel in a Lightning Network node. diff --git a/ldk-server-grpc/src/types.rs b/ldk-server-grpc/src/types.rs index 6cef8912..4a33082d 100644 --- a/ldk-server-grpc/src/types.rs +++ b/ldk-server-grpc/src/types.rs @@ -679,6 +679,16 @@ pub struct Channel { /// This map is empty until channel negotiation determines the channel type. #[prost(btree_map = "uint32, message", tag = "33")] pub channel_type: ::prost::alloc::collections::BTreeMap, + /// The witness script that is used to lock the channel's funding output to commitment transactions. + /// + /// This field will be `None` if we have not negotiated the funding transaction with our + /// counterparty already. + /// + /// When a channel is spliced, this continues to refer to the original pre-splice channel + /// state until the splice transaction reaches sufficient confirmations to be locked (and we + /// exchange `splice_locked` messages with our peer). + #[prost(string, optional, tag = "34")] + pub funding_redeem_script: ::core::option::Option<::prost::alloc::string::String>, } /// ChannelConfig represents the configuration settings for a channel in a Lightning Network node. /// See more: diff --git a/ldk-server/src/util/proto_adapter.rs b/ldk-server/src/util/proto_adapter.rs index f61aebfa..e149c27d 100644 --- a/ldk-server/src/util/proto_adapter.rs +++ b/ldk-server/src/util/proto_adapter.rs @@ -145,6 +145,7 @@ pub(crate) fn channel_to_proto(channel: ChannelDetails) -> Channel { .map(|s| channel_shutdown_state_to_proto(s) as i32), reserve_type: channel.reserve_type.as_ref().map(|r| reserve_type_to_proto(r) as i32), channel_type, + funding_redeem_script: channel.funding_redeem_script.map(|script| script.to_hex_string()), } }