Skip to content

Commit aa005f4

Browse files
committed
f: Highlight the list only applies to inbound channels
1 parent 9125870 commit aa005f4

File tree

5 files changed

+24
-16
lines changed

5 files changed

+24
-16
lines changed

src/builder.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ impl NodeBuilder {
435435
/// Configures the [`Node`] instance to source inbound liquidity from the given
436436
/// [bLIP-51 / LSPS1] service.
437437
///
438-
/// Will mark the LSP as trusted for 0-confirmation, 0-reserve channels, see [`Config::trusted_peers_0conf_0reserve`].
438+
/// Will mark the LSP as trusted for 0-confirmation, 0-reserve channels, see [`Config::inbound_trusted_peers_0conf_0reserve`].
439439
///
440440
/// The given `token` will be used by the LSP to authenticate the user.
441441
///
@@ -444,7 +444,7 @@ impl NodeBuilder {
444444
&mut self, node_id: PublicKey, address: SocketAddress, token: Option<String>,
445445
) -> &mut Self {
446446
// Mark the LSP as trusted for 0conf, 0reserve
447-
self.config.trusted_peers_0conf_0reserve.push(node_id.clone());
447+
self.config.inbound_trusted_peers_0conf_0reserve.push(node_id.clone());
448448

449449
let liquidity_source_config =
450450
self.liquidity_source_config.get_or_insert(LiquiditySourceConfig::default());
@@ -456,7 +456,7 @@ impl NodeBuilder {
456456
/// Configures the [`Node`] instance to source just-in-time inbound liquidity from the given
457457
/// [bLIP-52 / LSPS2] service.
458458
///
459-
/// Will mark the LSP as trusted for 0-confirmation, 0-reserve channels, see [`Config::trusted_peers_0conf_0reserve`].
459+
/// Will mark the LSP as trusted for 0-confirmation, 0-reserve channels, see [`Config::inbound_trusted_peers_0conf_0reserve`].
460460
///
461461
/// The given `token` will be used by the LSP to authenticate the user.
462462
///
@@ -465,7 +465,7 @@ impl NodeBuilder {
465465
&mut self, node_id: PublicKey, address: SocketAddress, token: Option<String>,
466466
) -> &mut Self {
467467
// Mark the LSP as trusted for 0conf, 0reserve
468-
self.config.trusted_peers_0conf_0reserve.push(node_id.clone());
468+
self.config.inbound_trusted_peers_0conf_0reserve.push(node_id.clone());
469469

470470
let liquidity_source_config =
471471
self.liquidity_source_config.get_or_insert(LiquiditySourceConfig::default());
@@ -956,7 +956,7 @@ impl ArcedNodeBuilder {
956956
/// Configures the [`Node`] instance to source inbound liquidity from the given
957957
/// [bLIP-51 / LSPS1] service.
958958
///
959-
/// Will mark the LSP as trusted for 0-confirmation, 0-reserve channels, see [`Config::trusted_peers_0conf_0reserve`].
959+
/// Will mark the LSP as trusted for 0-confirmation, 0-reserve channels, see [`Config::inbound_trusted_peers_0conf_0reserve`].
960960
///
961961
/// The given `token` will be used by the LSP to authenticate the user.
962962
///
@@ -970,7 +970,7 @@ impl ArcedNodeBuilder {
970970
/// Configures the [`Node`] instance to source just-in-time inbound liquidity from the given
971971
/// [bLIP-52 / LSPS2] service.
972972
///
973-
/// Will mark the LSP as trusted for 0-confirmation, 0-reserve channels, see [`Config::trusted_peers_0conf_0reserve`].
973+
/// Will mark the LSP as trusted for 0-confirmation, 0-reserve channels, see [`Config::inbound_trusted_peers_0conf_0reserve`].
974974
///
975975
/// The given `token` will be used by the LSP to authenticate the user.
976976
///

src/config.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ pub(crate) const LNURL_AUTH_TIMEOUT_SECS: u64 = 15;
123123
/// | `listening_addresses` | None |
124124
/// | `announcement_addresses` | None |
125125
/// | `node_alias` | None |
126-
/// | `trusted_peers_0conf_0reserve` | [] |
126+
/// | `inbound_trusted_peers_0conf_0reserve` | [] |
127127
/// | `probing_liquidity_limit_multiplier` | 3 |
128128
/// | `anchor_channels_config` | Some(..) |
129129
/// | `route_parameters` | None |
@@ -163,11 +163,17 @@ pub struct Config {
163163
/// confirmations of the funding transaction (zero-conf), and allow them to spend their
164164
/// entire balance (zero-reserve).
165165
///
166+
/// **Note:** This list only sets 0-reserve for a peer *if that peer opens the channel to
167+
/// us*. If you would like to open the channel yourself, and set 0-reserve for that peer,
168+
/// see [`Node::open_0reserve_channel`].
169+
///
166170
/// **Note:** Allowing payments via zero-confirmation channels is insecure if the funding
167171
/// transaction never gets confirmed on-chain. Zero-reserve channels allow the peer to try
168172
/// to steal your funds with no financial penalty. Zero-confirmation, and zero-reserve
169173
/// channels should therefore only be accepted from trusted peers.
170-
pub trusted_peers_0conf_0reserve: Vec<PublicKey>,
174+
///
175+
/// [`Node::open_0reserve_channel`]: crate::Node::open_0reserve_channel
176+
pub inbound_trusted_peers_0conf_0reserve: Vec<PublicKey>,
171177
/// The liquidity factor by which we filter the outgoing channels used for sending probes.
172178
///
173179
/// Channels with available liquidity less than the required amount times this value won't be
@@ -214,7 +220,7 @@ impl Default for Config {
214220
network: DEFAULT_NETWORK,
215221
listening_addresses: None,
216222
announcement_addresses: None,
217-
trusted_peers_0conf_0reserve: Vec::new(),
223+
inbound_trusted_peers_0conf_0reserve: Vec::new(),
218224
probing_liquidity_limit_multiplier: DEFAULT_PROBING_LIQUIDITY_LIMIT_MULTIPLIER,
219225
anchor_channels_config: Some(AnchorChannelsConfig::default()),
220226
tor_config: None,

src/event.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1283,8 +1283,10 @@ where
12831283
});
12841284
}
12851285
}
1286-
let is_trusted_peer =
1287-
self.config.trusted_peers_0conf_0reserve.contains(&counterparty_node_id);
1286+
let is_trusted_peer = self
1287+
.config
1288+
.inbound_trusted_peers_0conf_0reserve
1289+
.contains(&counterparty_node_id);
12881290
let res = if is_trusted_peer {
12891291
self.channel_manager.accept_inbound_channel_from_trusted_peer(
12901292
&temporary_channel_id,

src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1431,7 +1431,7 @@ impl Node {
14311431
///
14321432
/// Note that this only allows *the counterparty* to spend *their* entire balance in the
14331433
/// the channel; whether *you* are allowed to spend your own full balance is the
1434-
/// counterparty's decision. See [`Config::trusted_peers_0conf_0reserve`] if the
1434+
/// counterparty's decision. See [`Config::inbound_trusted_peers_0conf_0reserve`] if the
14351435
/// counterparty would like to set zero-reserve on your own balance as well.
14361436
///
14371437
/// Disconnects and reconnects are handled automatically.
@@ -1446,7 +1446,7 @@ impl Node {
14461446
///
14471447
/// Returns a [`UserChannelId`] allowing to locally keep track of the channel.
14481448
///
1449-
/// [`Config::trusted_peers_0conf_0reserve`]: crate::config::Config::trusted_peers_0conf_0reserve
1449+
/// [`Config::inbound_trusted_peers_0conf_0reserve`]: crate::config::Config::inbound_trusted_peers_0conf_0reserve
14501450
/// [`AnchorChannelsConfig::per_channel_reserve_sats`]: crate::config::AnchorChannelsConfig::per_channel_reserve_sats
14511451
pub fn open_0reserve_channel(
14521452
&self, node_id: PublicKey, address: SocketAddress, channel_amount_sats: u64,
@@ -1472,7 +1472,7 @@ impl Node {
14721472
///
14731473
/// Note that this only allows *the counterparty* to spend *their* entire balance in the
14741474
/// the channel; whether *you* are allowed to spend your own full balance is the
1475-
/// counterparty's decision. See [`Config::trusted_peers_0conf_0reserve`] if the
1475+
/// counterparty's decision. See [`Config::inbound_trusted_peers_0conf_0reserve`] if the
14761476
/// counterparty would like to set zero-reserve on your own balance as well.
14771477
///
14781478
/// Disconnects and reconnects are handled automatically.
@@ -1483,7 +1483,7 @@ impl Node {
14831483
///
14841484
/// Returns a [`UserChannelId`] allowing to locally keep track of the channel.
14851485
///
1486-
/// [`Config::trusted_peers_0conf_0reserve`]: crate::config::Config::trusted_peers_0conf_0reserve
1486+
/// [`Config::inbound_trusted_peers_0conf_0reserve`]: crate::config::Config::inbound_trusted_peers_0conf_0reserve
14871487
pub fn open_0reserve_channel_with_all(
14881488
&self, node_id: PublicKey, address: SocketAddress, push_to_counterparty_msat: Option<u64>,
14891489
channel_config: Option<ChannelConfig>,

tests/common/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ pub(crate) fn setup_two_nodes_with_store(
406406
let mut config_b = random_config(anchor_channels);
407407
config_b.store_type = store_type;
408408
if allow_0conf_0reserve {
409-
config_b.node_config.trusted_peers_0conf_0reserve.push(node_a.node_id());
409+
config_b.node_config.inbound_trusted_peers_0conf_0reserve.push(node_a.node_id());
410410
}
411411
if anchor_channels && anchors_trusted_no_reserve {
412412
config_b

0 commit comments

Comments
 (0)