Skip to content

Commit b3ad4d2

Browse files
committed
Revert "Only skip bumping channel closes for trusted peers"
This reverts commit 7a36e5b, as it's now safe again to skip bump events for fully-trusted counterparties.
1 parent 1dd9827 commit b3ad4d2

File tree

2 files changed

+25
-22
lines changed

2 files changed

+25
-22
lines changed

src/config.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,11 +235,13 @@ pub struct AnchorChannelsConfig {
235235
/// on-chain.
236236
///
237237
/// Channels with these peers won't count towards the retained on-chain reserve and we won't
238-
/// take any action to get the required channel closing transactions confirmed ourselves.
238+
/// take any action to get the required transactions confirmed ourselves.
239239
///
240240
/// **Note:** Trusting the channel counterparty to take the necessary actions to get the
241-
/// required Anchor spending transactions confirmed on-chain is potentially insecure
242-
/// as the channel may not be closed if they refuse to do so.
241+
/// required Anchor spending and HTLC transactions confirmed on-chain is potentially insecure
242+
/// as the channel may not be closed if they refuse to do so, potentially leaving the user
243+
/// funds stuck *or* even allow the counterparty to steal any in-flight funds after the
244+
/// corresponding HTLCs time out.
243245
pub trusted_peers_no_reserve: Vec<PublicKey>,
244246
/// The amount of satoshis per anchors-negotiated channel with an untrusted peer that we keep
245247
/// as an emergency reserve in our on-chain wallet.

src/event.rs

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1465,29 +1465,30 @@ where
14651465
self.runtime.spawn_cancellable_background_task(future);
14661466
},
14671467
LdkEvent::BumpTransaction(bte) => {
1468-
match bte {
1468+
let (channel_id, counterparty_node_id) = match bte {
14691469
BumpTransactionEvent::ChannelClose {
14701470
ref channel_id,
14711471
ref counterparty_node_id,
14721472
..
1473-
} => {
1474-
// Skip bumping channel closes if our counterparty is trusted.
1475-
if let Some(anchor_channels_config) =
1476-
self.config.anchor_channels_config.as_ref()
1477-
{
1478-
if anchor_channels_config
1479-
.trusted_peers_no_reserve
1480-
.contains(counterparty_node_id)
1481-
{
1482-
log_debug!(self.logger,
1483-
"Ignoring BumpTransactionEvent::ChannelClose for channel {} due to trusted counterparty {}",
1484-
channel_id, counterparty_node_id
1485-
);
1486-
return Ok(());
1487-
}
1488-
}
1489-
},
1490-
BumpTransactionEvent::HTLCResolution { .. } => {},
1473+
} => (channel_id, counterparty_node_id),
1474+
BumpTransactionEvent::HTLCResolution {
1475+
ref channel_id,
1476+
ref counterparty_node_id,
1477+
..
1478+
} => (channel_id, counterparty_node_id),
1479+
};
1480+
1481+
if let Some(anchor_channels_config) = self.config.anchor_channels_config.as_ref() {
1482+
if anchor_channels_config
1483+
.trusted_peers_no_reserve
1484+
.contains(counterparty_node_id)
1485+
{
1486+
log_debug!(self.logger,
1487+
"Ignoring BumpTransactionEvent for channel {} due to trusted counterparty {}",
1488+
channel_id, counterparty_node_id
1489+
);
1490+
return Ok(());
1491+
}
14911492
}
14921493

14931494
self.bump_tx_event_handler.handle_event(&bte).await;

0 commit comments

Comments
 (0)