Skip to content

Refine async payment cache admission#910

Open
tnull wants to merge 1 commit into
lightningdevkit:mainfrom
tnull:2026-05-async-payment-cache-admission
Open

Refine async payment cache admission#910
tnull wants to merge 1 commit into
lightningdevkit:mainfrom
tnull:2026-05-async-payment-cache-admission

Conversation

@tnull
Copy link
Copy Markdown
Collaborator

@tnull tnull commented May 19, 2026

Keep existing onion-message mailbox queues when the peer map is full, and recycle rate limiter bucket state when admitting a new user at capacity.

Keep existing onion-message mailbox queues when the peer map is full,
and recycle rate limiter bucket state when admitting a new user at
capacity.

Signed-off-by: Elias Rohrer <dev@tnull.de>
@tnull tnull requested a review from joostjager May 19, 2026 12:45
@ldk-reviews-bot
Copy link
Copy Markdown

ldk-reviews-bot commented May 19, 2026

👋 Thanks for assigning @joostjager as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

Copy link
Copy Markdown
Contributor

@joostjager joostjager left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m fine with these changes, but I’m not sure they make the system strictly better so much as change the failure mode.

The more fundamental issue is of course that onion-message handling is exposed to Sybil-style pressure. Not sure if it was a good idea to rely on it for async payments.

pub(crate) fn onion_message_intercepted(&self, peer_node_id: PublicKey, message: OnionMessage) {
let mut map = self.map.lock().expect("lock");

if !map.contains_key(&peer_node_id) && map.len() >= Self::MAX_PEERS {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we talked about this before. Is it really better to allow an attacker to fill up all slots and DoS legit users?

self.garbage_collect(self.max_idle);
if self.users.len() >= MAX_USERS {
return false;
self.evict_least_recently_seen();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can now be a rate-limiter bypass for attackers?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants