Skip to content

Commit ba05dbf

Browse files
committed
Allow to specify a ChannelConfig upon opening
This is useful/necessary to set forwarding fee rates, as well as allowing for overriding the dust HTLC exposure limit.
1 parent e6ead06 commit ba05dbf

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

bindings/kotlin/ldk-node-jvm/lib/src/test/kotlin/org/lightningdevkit/ldknode/LibraryTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ class LibraryTest {
120120
assertEquals(100000u, totalBalance1)
121121
assertEquals(100000u, totalBalance2)
122122

123-
node1.connectOpenChannel(nodeId2, listenAddress2, 50000u, null, true)
123+
node1.connectOpenChannel(nodeId2, listenAddress2, 50000u, null, null, true)
124124

125125
val channelPendingEvent1 = node1.waitNextEvent()
126126
println("Got event: $channelPendingEvent1")

bindings/ldk_node.udl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ interface LDKNode {
5454
[Throws=NodeError]
5555
void disconnect(PublicKey node_id);
5656
[Throws=NodeError]
57-
void connect_open_channel(PublicKey node_id, NetAddress address, u64 channel_amount_sats, u64? push_to_counterparty_msat, boolean announce_channel);
57+
void connect_open_channel(PublicKey node_id, NetAddress address, u64 channel_amount_sats, u64? push_to_counterparty_msat, ChannelConfig? channel_config, boolean announce_channel);
5858
[Throws=NodeError]
5959
void close_channel([ByRef]ChannelId channel_id, PublicKey counterparty_node_id);
6060
[Throws=NodeError]

src/lib.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
//!
4949
//! let node_id = PublicKey::from_str("NODE_ID").unwrap();
5050
//! let node_addr = NetAddress::from_str("IP_ADDR:PORT").unwrap();
51-
//! node.connect_open_channel(node_id, node_addr, 10000, None, false).unwrap();
51+
//! node.connect_open_channel(node_id, node_addr, 10000, None, None, false).unwrap();
5252
//!
5353
//! let event = node.wait_next_event();
5454
//! println!("EVENT: {:?}", event);
@@ -1369,7 +1369,8 @@ impl<K: KVStore + Sync + Send + 'static> Node<K> {
13691369
/// Returns a temporary channel id.
13701370
pub fn connect_open_channel(
13711371
&self, node_id: PublicKey, address: NetAddress, channel_amount_sats: u64,
1372-
push_to_counterparty_msat: Option<u64>, announce_channel: bool,
1372+
push_to_counterparty_msat: Option<u64>, channel_config: Option<ChannelConfig>,
1373+
announce_channel: bool,
13731374
) -> Result<(), Error> {
13741375
let rt_lock = self.runtime.read().unwrap();
13751376
if rt_lock.is_none() {
@@ -1404,6 +1405,7 @@ impl<K: KVStore + Sync + Send + 'static> Node<K> {
14041405
announced_channel: announce_channel,
14051406
..Default::default()
14061407
},
1408+
channel_config: channel_config.unwrap_or_default(),
14071409
..Default::default()
14081410
};
14091411

src/test/functional_tests.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ fn do_channel_full_cycle<K: KVStore + Sync + Send>(
8787
node_b.listening_address().unwrap().into(),
8888
funding_amount_sat,
8989
Some(push_msat),
90+
None,
9091
true,
9192
)
9293
.unwrap();
@@ -311,7 +312,8 @@ fn channel_open_fails_when_funds_insufficient() {
311312
node_b.listening_address().unwrap().into(),
312313
120000,
313314
None,
314-
true,
315+
None,
316+
true
315317
)
316318
);
317319
}

0 commit comments

Comments
 (0)