-
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
base: elle-base-branch-payment-service
Are you sure you want to change the base?
Changes from 3 commits
2fbe283
d256721
131981a
f33cd8d
df0c8b6
23dbe7f
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 |
|---|---|---|
|
|
@@ -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); | ||
|
|
||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.