LUD-XX: verifyBatch — batched and streamed settlement checking for LNURL-verify - #299
Open
Kukks wants to merge 1 commit into
Open
LUD-XX: verifyBatch — batched and streamed settlement checking for LNURL-verify#299Kukks wants to merge 1 commit into
Kukks wants to merge 1 commit into
Conversation
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.
LUD-21 gives one
verifyURL per invoice, checked with one GET. A merchant backend tracking N pending invoices against a single LNURL-pay endpoint (say a BTCPay Server instance behind a Lightning address) ends up making N requests per poll cycle, and settlement latency is stuck at the poll interval — awkward when checkout wants sub-second confirmation.This proposes an optional
verifyBatchendpoint, advertised alongsideverifyin the LUD-06 callback (and optionally in LUD-21verifyresponses, so already-deployed clients can pick it up mid-flight). One GET checks a whole set of pending invoices at once. The same endpoint answers in two ways depending on theAcceptheader: a one-shot JSON snapshot by default, or an SSE stream (Accept: text/event-stream) that sends the snapshot first and then pushes settlements as they happen — openable directly with a browserEventSource. There is no capability flag: a service that does not stream just ignores the header and returns the snapshot, so a client that hoped for a stream still gets a usable answer and falls back to polling.It stays inside LUD-21's trust model exactly. A caller only ever learns about
verifyURLs it already holds; each supplied URL is looked up against what the service issued and is never fetched (so no request-forgery surface); and every returned key is echoed byte-for-byte so the client's opaque-URL lookup still matches. It is optional and additive — a LUD-21-only service or client is unaffected, and a single invoice still just uses the plainverifyGET.Worth flagging for discussion: this overlaps with #281 (long-held request for LUD-21
verify). They come at overlapping problems from different angles — #281 removes the latency floor for a single invoice by holding one request open per URL, whileverifyBatchcovers a whole pending set on one connection and also removes the N-requests-per-poll cost. They are compatible, and a service can implement either or both. If the group would rather fold the streaming idea into #281's single-endpoint approach, or name the field differently, I am happy to adjust.Filed as
XX.mdper CONTRIBUTING (no self-assigned number); happy to renumber at merge. This is a draft for feedback, and I have not touched the README index or the dependency graph — glad to add those once a number is assigned.