-
Notifications
You must be signed in to change notification settings - Fork 418
Add LSPS5 DOS protections. #3993
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -572,6 +572,23 @@ where | |
&self.config | ||
} | ||
|
||
/// Returns whether the peer has any opening or open JIT channels. | ||
pub(crate) fn has_opening_or_open_jit_channel(&self, counterparty_node_id: &PublicKey) -> bool { | ||
let outer_state_lock = self.per_peer_state.read().unwrap(); | ||
outer_state_lock.get(counterparty_node_id).map_or(false, |inner| { | ||
let peer_state = inner.lock().unwrap(); | ||
peer_state.outbound_channels_by_intercept_scid.values().any(|chan| { | ||
matches!( | ||
chan.state, | ||
OutboundJITChannelState::PendingChannelOpen { .. } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wait, how do we imagine this to work for the initial LSPS2 receive? If we only allow clients to even register for notifications once we already have a (pending) channel open, how would a first-time user's phone get notified to wake up and accept the channel when they receive the very first payment? I think we'd need to extend this to also accept LSPS5 requests for |
||
| OutboundJITChannelState::PendingPaymentForward { .. } | ||
| OutboundJITChannelState::PendingPayment { .. } | ||
| OutboundJITChannelState::PaymentForwarded { .. } | ||
) | ||
}) | ||
}) | ||
} | ||
|
||
/// Used by LSP to inform a client requesting a JIT Channel the token they used is invalid. | ||
/// | ||
/// Should be called in response to receiving a [`LSPS2ServiceEvent::GetInfo`] event. | ||
|
Uh oh!
There was an error while loading. Please reload this page.