Skip to content

Commit fe77868

Browse files
committed
Rename field to LSPS2ServiceConfig::disable_client_reserve
This makes it consistent with the argument used in ldk-server's open channel API. Also add a few more variable renames to make things consistent.
1 parent d780eae commit fe77868

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,7 +1149,7 @@ impl Node {
11491149
fn open_channel_inner(
11501150
&self, node_id: PublicKey, address: SocketAddress, channel_amount_sats: FundingAmount,
11511151
push_to_counterparty_msat: Option<u64>, channel_config: Option<ChannelConfig>,
1152-
announce_for_forwarding: bool, set_0reserve: bool,
1152+
announce_for_forwarding: bool, disable_counterparty_reserve: bool,
11531153
) -> Result<UserChannelId, Error> {
11541154
if !*self.is_running.read().expect("lock") {
11551155
return Err(Error::NotRunning);
@@ -1219,7 +1219,7 @@ impl Node {
12191219
.expect("a 16-byte slice should convert into a [u8; 16]"),
12201220
);
12211221

1222-
let result = if set_0reserve {
1222+
let result = if disable_counterparty_reserve {
12231223
self.channel_manager.create_channel_to_trusted_peer_0reserve(
12241224
peer_info.node_id,
12251225
channel_amount_sats,
@@ -1239,7 +1239,7 @@ impl Node {
12391239
)
12401240
};
12411241

1242-
let zero_reserve_string = if set_0reserve { "0reserve " } else { "" };
1242+
let zero_reserve_string = if disable_counterparty_reserve { "0reserve " } else { "" };
12431243

12441244
match result {
12451245
Ok(_) => {

src/liquidity.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ pub struct LSPS2ServiceConfig {
149149
/// See [`Node::open_0reserve_channel`] to manually open these channels.
150150
///
151151
/// [`Node::open_0reserve_channel`]: crate::Node::open_0reserve_channel
152-
pub allow_client_0reserve: bool,
152+
pub disable_client_reserve: bool,
153153
}
154154

155155
pub(crate) struct LiquiditySourceBuilder<L: Deref>
@@ -796,7 +796,7 @@ where
796796
config.channel_config.forwarding_fee_base_msat = 0;
797797
config.channel_config.forwarding_fee_proportional_millionths = 0;
798798

799-
let result = if service_config.allow_client_0reserve {
799+
let result = if service_config.disable_client_reserve {
800800
self.channel_manager.create_channel_to_trusted_peer_0reserve(
801801
their_network_key,
802802
channel_amount_sats,
@@ -823,7 +823,7 @@ where
823823
// the pending requests and regularly retry opening the channel until we
824824
// succeed.
825825
let zero_reserve_string =
826-
if service_config.allow_client_0reserve { "0reserve " } else { "" };
826+
if service_config.disable_client_reserve { "0reserve " } else { "" };
827827
log_error!(
828828
self.logger,
829829
"Failed to open LSPS2 {}channel to {}: {:?}",

tests/common/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -790,7 +790,7 @@ pub async fn splice_in_with_all(
790790

791791
pub(crate) async fn do_channel_full_cycle<E: ElectrumApi>(
792792
node_a: TestNode, node_b: TestNode, bitcoind: &BitcoindClient, electrsd: &E, allow_0conf: bool,
793-
allow_0reserve: bool, expect_anchor_channel: bool, force_close: bool,
793+
disable_node_b_reserve: bool, expect_anchor_channel: bool, force_close: bool,
794794
) {
795795
let addr_a = node_a.onchain_payment().new_address().unwrap();
796796
let addr_b = node_b.onchain_payment().new_address().unwrap();
@@ -846,7 +846,7 @@ pub(crate) async fn do_channel_full_cycle<E: ElectrumApi>(
846846
println!("\nA -- open_channel -> B");
847847
let funding_amount_sat = 2_080_000;
848848
let push_msat = (funding_amount_sat / 2) * 1000; // balance the channel
849-
if allow_0reserve {
849+
if disable_node_b_reserve {
850850
node_a
851851
.open_0reserve_channel(
852852
node_b.node_id(),
@@ -927,7 +927,7 @@ pub(crate) async fn do_channel_full_cycle<E: ElectrumApi>(
927927

928928
// Note that only node B has 0-reserve, we don't yet have an API to allow the opener of the
929929
// channel to have 0-reserve.
930-
if allow_0reserve {
930+
if disable_node_b_reserve {
931931
assert_eq!(node_b.list_channels()[0].unspendable_punishment_reserve, Some(0));
932932
assert_eq!(node_b.list_channels()[0].outbound_capacity_msat, push_msat);
933933
assert_eq!(node_b.list_channels()[0].next_outbound_htlc_limit_msat, push_msat);
@@ -1295,7 +1295,7 @@ pub(crate) async fn do_channel_full_cycle<E: ElectrumApi>(
12951295
2
12961296
);
12971297

1298-
if allow_0reserve {
1298+
if disable_node_b_reserve {
12991299
let node_a_outbound_capacity_msat = node_a.list_channels()[0].outbound_capacity_msat;
13001300
let node_a_reserve_msat =
13011301
node_a.list_channels()[0].unspendable_punishment_reserve.unwrap() * 1000;

tests/integration_tests_rust.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1786,7 +1786,7 @@ async fn do_lsps2_client_service_integration(client_trusts_lsp: bool) {
17861786
min_channel_opening_fee_msat: 0,
17871787
max_client_to_self_delay: 1024,
17881788
client_trusts_lsp,
1789-
allow_client_0reserve: false,
1789+
disable_client_reserve: false,
17901790
};
17911791

17921792
let service_config = random_config(true);
@@ -2105,7 +2105,7 @@ async fn lsps2_client_trusts_lsp() {
21052105
min_channel_opening_fee_msat: 0,
21062106
max_client_to_self_delay: 1024,
21072107
client_trusts_lsp: true,
2108-
allow_client_0reserve: false,
2108+
disable_client_reserve: false,
21092109
};
21102110

21112111
let service_config = random_config(true);
@@ -2280,7 +2280,7 @@ async fn lsps2_lsp_trusts_client_but_client_does_not_claim() {
22802280
min_channel_opening_fee_msat: 0,
22812281
max_client_to_self_delay: 1024,
22822282
client_trusts_lsp: false,
2283-
allow_client_0reserve: false,
2283+
disable_client_reserve: false,
22842284
};
22852285

22862286
let service_config = random_config(true);

0 commit comments

Comments
 (0)