Restore: a seller restored at waiting-payment cannot recover the hold invoice
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Domain
- backend-api-design
Research direction
Start by reading mostrod's util.rs take path and its Action::PayInvoice send, then trace how Action::Orders and RestoreSession rebuild a waiting-payment trade. The issue leaves the recovery approach open, so first determine which option should be pursued and how the app can request or receive the invoice. Done means a restored seller can recover the hold invoice when the relay no longer has the message; the issue names no tests.
Written by the indexing model from the issue text.
Description
Summary
After a restore, a trade rebuilt from the daemon's own record (#546) carries no hold invoice. A seller restored at waiting-payment sees the trade but not the bolt11 to pay. If the relays no longer hold the daemon's pay-invoice message, nothing brings the invoice back, and the daemon cannot resend it today.
Low priority: the window is short (see How often). Filed so the gap is tracked rather than lost, now that #216 is closed.
What happens today
- The bolt11 reaches the client once, in
pay-invoice, when the order is taken (mostrodutil.rs, theAction::PayInvoicesend in the take path). - mostrod does not store it afterwards. The
orderstable keepshashandpreimage, not the payment request; the onlypayment_requestcolumn is onbonds. - A restore rebuilds the row in one of two ways:
- by replaying the daemon's kind-14 messages, which works when the relay still holds
pay-invoice; - from
Action::Orders(#546), whoseSmallOrdercarries no hold invoice. mostrod also stripsbuyer_invoicefrom that reply on purpose.
- by replaying the daemon's kind-14 messages, which works when the relay still holds
How often
hold_invoice_expiration_window = 300 by default, so the seller has 5 minutes to pay before the scheduler acts. The gap needs all of the following at once:
- a seller restores (new device or re-import) inside those 5 minutes;
- the relays have lost that one
pay-invoicemessage; - and the trade is still waiting on that payment.
That is rare, but when it happens the seller cannot pay from the app until the order expires.
The buyer side (waiting-buyer-invoice) is different. The buyer sends an invoice, and the amount is in the rebuilt order, so nothing from the daemon is missing. Worth confirming in the UI that a restored buyer is actually offered the add-invoice step.
Options
- The daemon re-sends
pay-invoiceon request. It can recover the bolt11 from its Lightning node by the storedhash(e.g. an LND invoice lookup returns the payment request). This needs a way to ask: a new action, or answeringRestoreSession/Ordersfor awaiting-paymentseller by re-sending the message. - Include the payment request in the restore reply for a seller at
waiting-payment. mostrod would first have to start persisting it at take time. - Do nothing, and let the order expire and return to the book. The seller can take or republish afterwards. This is the current behaviour.
Option 1 changes the least: it reuses the existing message the client already handles.
Context
Closing #216 (authoritative RestoreData snapshot). Its goals are otherwise met by composition: the peer trade pubkey (#544, mostro#966), role and order fields from Action::Orders (#546), and the solver pubkey, which was already in RestoredDisputesInfo. This is the one piece of "the order fields needed to build TradeInfo" that no current path recovers. Part of #142.
- Dominant language
- Dart
- Stars
- 11
- Forks
- 9
- Avg merge
- 13h 4m
- Merged PRs (30d)
- 259
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from MostroP2P/app
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
Add-invoice screen stays on "Sent, waiting for the node" after a late acceptance on a sell orderOpenbug priority: medium
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
area: ui
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
MostroP2P/app#341 · 1 comment ·
Maintainers usually reply within 1 day
Similar issues
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
bggRGjQaUbCoE/PiliPlus#3235 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
intel/rohd-wave-viewer#11 ·
-
DOCS UPDATE: README.md and BACKEND.md reference a search-meetings edge function that does not existOpendocumentation
Difficulty 1/5 1-3 hours Newbie friendliness 93/100
AOSSIE-Org/Ell-ena#337 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 66/100
Maintainers usually reply within 1 day
-
cat: puzzle
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
lichess-org/mobile#3826 ·
Maintainers usually reply within 2 days