Skip to content

Commit 241a980

Browse files
committed
Expose funding_redeem_script on Channel
1 parent 88016a5 commit 241a980

4 files changed

Lines changed: 18 additions & 0 deletions

File tree

e2e-tests/tests/e2e.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -828,6 +828,9 @@ async fn test_cli_list_channels() {
828828
// configured, so the reserve type is deterministically Adaptive.
829829
assert_eq!(channel["reserve_type"].as_i64(), Some(ReserveType::Adaptive as i64));
830830
assert!(!channel["channel_type"].as_object().unwrap().is_empty());
831+
832+
// A funded, usable channel has a real funding redeem script.
833+
assert!(channel["funding_redeem_script"].as_str().is_some_and(|s| !s.is_empty()));
831834
}
832835

833836
#[tokio::test]

ldk-server-grpc/src/proto/types.proto

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,13 @@ message Channel {
568568
// The negotiated channel-type features, keyed by the signaled BOLT feature bit.
569569
// This map is empty until channel negotiation determines the channel type.
570570
map<uint32, Feature> channel_type = 33;
571+
572+
// The hex-encoded witness script that locks the channel's funding output to commitment
573+
// transactions.
574+
//
575+
// Will be unset if we have not negotiated the funding transaction with our counterparty
576+
// already.
577+
optional string funding_redeem_script = 34;
571578
}
572579

573580
// ChannelConfig represents the configuration settings for a channel in a Lightning Network node.

ldk-server-grpc/src/types.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,13 @@ pub struct Channel {
679679
/// This map is empty until channel negotiation determines the channel type.
680680
#[prost(btree_map = "uint32, message", tag = "33")]
681681
pub channel_type: ::prost::alloc::collections::BTreeMap<u32, Feature>,
682+
/// The hex-encoded witness script that locks the channel's funding output to commitment
683+
/// transactions.
684+
///
685+
/// Will be unset if we have not negotiated the funding transaction with our counterparty
686+
/// already.
687+
#[prost(string, optional, tag = "34")]
688+
pub funding_redeem_script: ::core::option::Option<::prost::alloc::string::String>,
682689
}
683690
/// ChannelConfig represents the configuration settings for a channel in a Lightning Network node.
684691
/// See more: <https://docs.rs/lightning/latest/lightning/util/config/struct.ChannelConfig.html>

ldk-server/src/util/proto_adapter.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ pub(crate) fn channel_to_proto(channel: ChannelDetails) -> Channel {
145145
.map(|s| channel_shutdown_state_to_proto(s) as i32),
146146
reserve_type: channel.reserve_type.as_ref().map(|r| reserve_type_to_proto(r) as i32),
147147
channel_type,
148+
funding_redeem_script: channel.funding_redeem_script.map(|script| script.to_hex_string()),
148149
}
149150
}
150151

0 commit comments

Comments
 (0)