Closed callebtc closed 1 month ago
Ack. Lightning payments should be modelled as async by the mint api.
Implemented in CDK https://github.com/cashubtc/cdk/pull/181, is backwards compatible
Ack. Lightning payments should be modelled as async by the mint api.
I suggest we add a new endpoint in a different NUT-05 PR that is async (returns immediately) so we can have both. This should be very easy to add to mints.
Should there be a FAILED
state? Otherwise, if the lighting payment fails would the lifecycle of a quote be UNPAID
-> PENDING
-> UNPAID
?
I feel PENDING
and UNPAID
sound a little to close to each other. Maybe PENDING
should be called something like ONGOING
Should there be a
FAILED
state? Otherwise, if the lighting payment fails would the lifecycle of a quote beUNPAID
->PENDING
->UNPAID
?
Correct, it would go back to UNPAID
if it fails.
LFG
What
New enum field:
state
This change to NUT-05 deprecates the
paid
field toPostMeltQuoteBolt11Response
and replaces it with astate
field that is a string enum with three possible values:UNPAID
,PENDING
,PAID
."UNPAID"
means that the request has not been paid yet."PENDING"
means that the request is currently being paid."PAID"
means that the request has been paid successfully.New return type for
/v1/melt/bolt11
We also replace
PostMeltBolt11Response
byPostMeltQuoteBolt11Response
as the response ofPOST /v1/melt/bolt11
but in a backwards-compatible way.This means
payment_preimage
toPostMeltQuoteBolt11Response
, which holds the bolt11 preimage after a successful paymentchange
toPostMeltQuoteBolt11Response
, which returns overspent Lightning feesWhy
This change enables wallet to know whether a Lightning payment is still in flight, if the user closes the wallet during a payment. When the wallet comes back online, it can request the melt quote via
GET /v1/melt/quote/bolt11/{quote_id}
and check itsstate
.payment_preimage
there.change
and can unblind the response. Previously, wallets would have to restore these tokens to get the overpaid fees back if the payment was interrupted.Implementation
Mints
state
field toPostMeltQuoteBolt11Response
paid
field around until all wallets updatePostMeltBolt11Response
byPostMeltQuoteBolt11Response
payment_preimage
change
toPostMeltQuoteBolt11Response
PostMeltQuoteBolt11Response
forPOST /v1/melt/bolt11
Wallets
paid
field withstate
and check it insteadAs long as
paid
is kept around, wallets can still function the same way as before, also when thePOST /v1/melt/bolt11
is changed (since JSON is "backwards compatible" to new fields).Tracking progress: