[RFC] Add pay --wait for Lightning payment terminal state - #293
Merged
benthecarman merged 1 commit intoSep 22, 2026
Merged
Conversation
|
👋 Thanks for assigning @benthecarman as a reviewer! |
benthecarman
requested changes
Sep 22, 2026
Collaborator
I do like this better and then just have |
This comment was marked as resolved.
This comment was marked as resolved.
benthecarman
requested changes
Sep 22, 2026
pay dispatches and returns a payment id while Lightning settlement finishes in the background. --wait subscribes to events before the send, then waits for PaymentSuccessful or PaymentFailed. With no --wait-timeout it waits until the payment finishes. The payment id is printed to stderr first so it survives Ctrl-C. Exit 0/2/3 distinguish success, failure, and timeout. On-chain payments are not waited on. A dropped event stream is an error. Assisted-by: goose (AI)
vincenzopalazzo
force-pushed
the
feat/cli-pay-wait
branch
from
September 22, 2026 03:20
b1f11b3 to
74c78dd
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
paystill dispatches and returns a payment id.--waitsubscribes to events before the send, then waits forPaymentSuccessfulorPaymentFailed.--wait-timeout,--waithangs until the payment finishes.--wait-timeout <secs>still bounds it (minimum 1).--wait, output is unchanged.Review Notes
ldk-server-cli/src/pay_wait.rs.Decision Log
Hardest decision: Keep the wait in the CLI instead of blocking
UnifiedSendon the server. The server returns as soon as ldk-node dispatches the payment. Holding the HTTP call would change the contract for every client.Review follow-ups:
unified_sendso a fast terminal event is not missed. The stream is live-only.--waitwaits forever.--wait 90is not used: clap consumes the next positional, so an invoice can be parsed as the timeout.Test plan
pay --helpshows--waitand--wait-timeoutpay --wait <uri>waits with no deadlinepay --wait --wait-timeout 90 <uri>parsespay --wait --wait-timeout 0 <uri>is rejectedpaywithout--waitstill prints the dispatch response