stackernews / stacker.news

Internet communities that pay you Bitcoin
https://stacker.news
MIT License
430 stars 109 forks source link

Timeout wallet payments #1558

Open huumn opened 14 hours ago

huumn commented 14 hours ago

Wallet payments can fail silently, e.g. the NWC consumer doesn't respond to a payment request, in which case we will wait until the invoice expires (10 minutes in most cases) - which is way too long. Stackers will assume we're unresponsive.

It's not as simple as timing out and displaying a QR code for the same invoice however. It's possible the QR code is paid and then the NWC consumer comes online and attempts to pay the same invoice. This is dangerous because once the QR code is paid, the preimage for the payment has been revealed, and the sats in the second payment can be stolen by nodes along the route that know the preimage.

To timeout safely, we'll want to cancel the original invoice, then generate a new invoice to display in the QR.

riccardobl commented 9 hours ago

this is solved by https://github.com/stackernews/stacker.news/pull/1523