-
Notifications
You must be signed in to change notification settings - Fork 2.2k
switchrpc: add idempotent external HTLC dispatch via SendOnion #10473
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
Open
calvinrzachman
wants to merge
6
commits into
lightningnetwork:elle-base-branch-payment-service
Choose a base branch
from
calvinrzachman:switchrpc-idempotent
base: elle-base-branch-payment-service
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
2fbe283
switchrpc: add AttemptStore access
calvinrzachman d256721
switchrpc: make external htlc dispatch (SendOnion) idempotent
calvinrzachman 131981a
switchrpc: update sendonion rpc docs
calvinrzachman f33cd8d
itest: update sendonion itest given duplicate protection
calvinrzachman df0c8b6
itest: add SendOnion concurrency test
calvinrzachman 23dbe7f
docs: update v0.21 release notes
calvinrzachman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,9 +10,34 @@ option go_package = "github.com/lightningnetwork/lnd/lnrpc/switchrpc"; | |
| // subsystem of the daemon. | ||
| service Switch { | ||
| /* | ||
| SendOnion attempts to make a payment via the specified onion. This | ||
| method differs from SendPayment in that the instance need not be aware of | ||
| the full details of the payment route. | ||
| SendOnion provides an idempotent API for dispatching a pre-formed onion | ||
| packet, which is the primary entry point for a remote router. | ||
|
|
||
| To safely handle network failures, a client can and should retry this RPC | ||
| after a timeout or disconnection. Retries MUST use the exact same | ||
| attempt_id to allow the server to correctly detect duplicate requests. | ||
|
|
||
| A client interacting with this RPC must handle four distinct categories of | ||
| outcomes, communicated via gRPC status codes: | ||
|
|
||
| 1. SUCCESS (gRPC code OK): A definitive confirmation that the HTLC has | ||
| been successfully dispatched. The client can proceed to track the | ||
| payment's final result via the `TrackOnion` RPC. | ||
|
|
||
| 2. DUPLICATE ACKNOWLEDGMENT (gRPC code AlreadyExists): A definitive | ||
| acknowledgment that a request with the same attempt_id has already | ||
| been successfully processed. A retrying client should interpret this | ||
| as a success and proceed to tracking the payment's result. | ||
|
|
||
| 3. AMBIGUOUS FAILURE (gRPC code Unavailable or DeadlineExceeded): An | ||
|
Collaborator
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. perhaps we should add that context cancelled is also such an error and that this should be the fallback if an error can't be classified in terms of the other cases (we could make this the last point), since it's always safe to retry this RPC. |
||
| ambiguous error occurred (e.g., the server is shutting down or the | ||
| client timed out). The state of the HTLC dispatch is unknown. The | ||
| client MUST retry the exact same request to resolve the ambiguity. | ||
|
|
||
| 4. DEFINITIVE FAILURE (gRPC code FailedPrecondition, InvalidArgument, etc.): | ||
| A definitive failure is a guarantee that the HTLC was not and will not be | ||
| dispatched. The client should fail the attempt and may retry with a new | ||
| route and/or new attempt_id. | ||
| */ | ||
| rpc SendOnion (SendOnionRequest) returns (SendOnionResponse); | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.