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
Allow responding asynchronously to OnionMessage #2996
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #2996 +/- ##
==========================================
- Coverage 89.83% 89.78% -0.05%
==========================================
Files 116 116
Lines 96465 96533 +68
Branches 96465 96533 +68
==========================================
+ Hits 86657 86670 +13
- Misses 7263 7310 +47
- Partials 2545 2553 +8 ☔ View full report in Codecov by Sentry. |
Updated from pr2996.01 to pr2996.02 (diff): Update:
|
cc @jkczyz, @TheBlueMatt |
Updated from pr2996.03 to pr2996.04 (diff): Updates:
|
Updated from pr2996.04 to pr2996.05 (diff): Updates:
|
Updated from pr2996.05 to pr2996.06 (diff): Updates:
|
…st coverage This commit modifies handle_onion_message_response to be accessible publicly as handle_onion_message, enabling users to respond asynchronously. Additionally, a new test is introduced to validate this functionality.
And expand handle_onion_message_response return Type 1. Introduce a new function in OnionMessenger to create blinded paths. 2. Use it in handle_onion_message_response to create a reply_path for the right variant and use it in onion_message. 3. Expand the return type of handle_onion_message_response to handle three cases: 1. Ok(None) in case of no response to be sent. 2. Ok(Some(SendSuccess) and Err(SendError) in case of successful and unsuccessful queueing up of response messages respectively. This allows the user to get access to the Success/Failure status of the sending of response and handle it accordingly.
Updated from pr2996.07 to pr2996.08 (diff): Changes:
|
|
||
/// Creates a [`ResponseInstruction::WithReplyPath`] for a given response. | ||
/// | ||
/// Use when the recipient need to send back a reply to us. |
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.
s/need/needs
let log_suffix = format!( | ||
"when responding with {} to an onion message with path_id {:02x?}", | ||
message_type, | ||
response.path_id | ||
); |
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.
We may actually want to inline this in both places using format_args!
. Otherwise, we are allocating a string even if the user's log level doesn't trigger any logging.
This PR addresses second part of #2882 and builds on #2907
This PR converts
handle_onion_message_response
into the public function which can be used for asynchronous response to a separately created ResponseInstruction.Also, this introduces a new variant of ResponseInstruction. This allows creating a reply_path for the receiver while responding to their message.