fix(wallet): read payment status from status, not the unserialized pending #161
No reviewers
Labels
No labels
app:activities
app:chat
app:chatelet
app:events
app:forum
app:libra
app:market
app:restaurant
app:tasks
app:wallet
app:webapp
bug
enhancement
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
aiolabs/webapp!161
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/wallet-payment-status-mapping"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Every payment in the wallet history rendered as "confirmed". Pending invoices looked settled, and failed payments looked successful. The receive dialog's "Paid" indicator reads the same data, so it inherited the defect.
Cause
Payment.pendingis a Python@propertyon the LNbits model, and LNbits pins pydantic 1.x, which never serializes properties. The field is absent from every REST and WebSocket payload, sopayment.pendingwas alwaysundefined, and the ternary fell through toconfirmedfor every row.The payload actually carries
status, one ofpending/success/failed.Verification
Against the live LNbits on this machine, a payment payload has these keys and no
pending:Creating an unpaid invoice and listing it back:
Second bug, same cause
The WebSocket mapper read
fee_msat, which does not exist either. The field isfee, signed millisats likeamount. Live-added rows never showed a fee.Two near-duplicate mappers had drifted apart, which is how the fields fell out of sync.
loadTransactionsnow delegates to the single shared mapper, so there is one place to get this right.An unrecognized status maps to
pendingrather thanconfirmed, and warns. Showing a payment as still in flight is the safe direction to be wrong.vue-tsc --noEmitis clean.status, not the unserializedpending9c9a29f93aEvery payment in the history list rendered as "confirmed" — pending invoices looked settled and failed payments looked successful. The receive dialog's "Paid" indicator inherited the same defect. `Payment.pending` is a Python `@property` on the LNbits model, and LNbits pins pydantic 1.x, which never serializes properties. The field is therefore absent from every REST and WebSocket payload, so `payment.pending` was always `undefined` — falsy — and the ternary fell through to "confirmed" for every row. Verified against a live LNbits instance: the payload carries `status` ("pending" | "success" | "failed") and no `pending` key. A freshly created, unpaid invoice now maps to "pending" where it previously mapped to "confirmed". The same drift hid a second bug: the WebSocket mapper read `fee_msat`, which does not exist either. The field is `fee`, signed millisats like `amount`, so live-added rows never showed a fee. Both mappers existed as near-duplicates that had diverged, which is how the two fields fell out of sync in the first place. `loadTransactions` now delegates to the single shared mapper.pending#169fee_msatread in core/market/events — the LNbits field isfee#170