-
Notifications
You must be signed in to change notification settings - Fork 890
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
Part 2: connectd onionmessage improvements #7455
Part 2: connectd onionmessage improvements #7455
Conversation
99699f1
to
966b15e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 966b15e
lightningd/onion_message.c
Outdated
if (sphinx_path_payloads_size(sphinx_path) <= ROUTING_INFO_SIZE) | ||
onion_size = ROUTING_INFO_SIZE; | ||
else | ||
onion_size = 32768; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the spec snippet above says "32834" but here it's 32768?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! Indeed, 66 bytes is framing overhead. Added comment!
msec = time_to_msec(timemono_between(now, peer->onionmsg_last_incoming)); | ||
peer->onionmsg_incoming_tokens += msec; | ||
if (peer->onionmsg_incoming_tokens > ONION_MSG_TOKENS_MAX) | ||
peer->onionmsg_incoming_tokens = ONION_MSG_TOKENS_MAX; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would it be worth flipping onionmsg_limit_warned false here? (so resetting after frequency has decreased to less than 4/sec)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, I don't expect it to happen at all? If it does, we might start logging more?
966b15e
to
a94558c
Compare
Added comment about 66 byte difference, and rebased on master. |
a94558c
to
9f87e0c
Compare
Allows for caller to log, but more importantly, when we add a command to inject onion messages, allows for us to capture the error. Signed-off-by: Rusty Russell <[email protected]>
Unlike "sendonionmessage" which instructs us to send to a peer, this process it locally (presumably, it contains the next hop). This is useful because it allows us to process an onion message which starts with us (a legal case for a blinded path supplied by someone else!). It also opens the door to bolt12 self-pay. Signed-off-by: Rusty Russell <[email protected]>
This will let us fwd onion messages via scid, even if they're aliases. Signed-off-by: Rusty Russell <[email protected]>
When we set them (i.e. at lockin), when we fire up channeld (for aliases, which we create at channel init, but aren't really useful until we have finished channel opening), and at startup. Signed-off-by: Rusty Russell <[email protected]>
This is now permitted in the offers PR, so we should support it. But we can't just look up in the gossmap, since the "short_channel_id" could be an alias. So we get lightningd to tell us all scid->peer mappings, and look up in that. Changelog-Added: Protocol: onion messages can now be forwarded by short_channel_id. Signed-off-by: Rusty Russell <[email protected]>
However fast we can handle them, it's antisocial to allow others to make us spam the rest of the network. Changelog-Protocol: onion messages: we limit incoming to 4 per second, allowing a little burst. Signed-off-by: Rusty Russell <[email protected]>
Changelog-Added: Protocol: onion messages are now supported by default. Changelog-Deprecated: Config: the --experimental-onion-messages option is ignored (on by default).
9f87e0c
to
e8d244c
Compare
Rebased on master. |
} else | ||
return false; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like useful information to log, no? like "ignoring message blabla ..
" but this can be a followup PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK e8d244c
029034a
into
ElementsProject:master
(Based on #7454)- Merged, rebased!This enhanced connectd's handling of onion messages: we ratelimit them, we handle forwarding them via scid (not just node_id) and we turn them on by default now they're in the spec.