fee_msat read in core/market/events — the LNbits field is fee #170
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#170
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Same bug as the one fixed in the wallet by #161, still present in three other places. Found by grepping the merged tree after that batch landed.
LNbits payment payloads carry
fee(signed millisats, likeamount). There is nofee_msatfield. Reading it yieldsundefined.Verified live against
POST /api/v1/paymentswithout: true, which is exactly whatPaymentService.payInvoicereturns:Sites
src/core/services/PaymentService.tsPaymentResult.fee_msat: number— the type asserts a field that never arrives, so TS trusts it downstreamsrc/core/services/PaymentService.tsundefinedsrc/modules/market/composables/useLightningPayment.tsfeeMsat: undefinedpersistedsrc/modules/events/services/LnbitsPaymentProvider.ts?? 0masks it — every payment records a zero feeSeverity
Low. Nothing computes a balance or total from these, so no money is miscounted; the fee is simply recorded as missing or zero. The lying type on
PaymentResultis the part most worth fixing, since it hides the problem from the compiler.Fix
Rename to
feeat the read sites, keeping the internalfeeMsatproperty names if preferred, and takeMath.abs()since the value is signed for outgoing payments.PaymentResultshould also stop declaring a field the API does not return.See the field contract for why this class of bug is silent: LNbits pins pydantic 1.x, so
@propertymembers likependingare never serialized, andfeeis stored under its own name.fee, not the absentfee_msat#171