Conversation
- Fix double msat conversion bug in Breez wallet (remove *1000) - Add fees_paid_msat to TypeScript pay_invoice response type - Update TypeScript client payInvoice() to return fees_paid_msat - Fix indentation in breez.rs - fix issue #148
portal-wheatley
left a comment
There was a problem hiding this comment.
Review
The implementation looks correct overall. A few notes:
✅ What looks good
- Trait signature change is clean:
Result<(String, u64)>whereu64is fees in sats is a sensible contract ws.rscorrectly converts sats → msat (fees_paid_sats * 1000) for the wire format- TS client properly updated in both
types.tsandclient.ts - NWC:
response.fees_paid.unwrap_or(0) / 1000correctly normalizes NIP-47 millisats to sats
🟡 Minor points
breez.rs — non-Lightning payment methods always return 0 fees
fee_sats is initialized to 0 and only updated inside the PaymentMethod::Lightning { ... } branch. If a payment goes through a different method variant, fees will silently be reported as 0. Probably fine for now, but worth a comment noting the assumption:
let mut fee_sats = 0u64; // only set for Lightning; other payment methods report 0nwc.rs — integer truncation on msat → sat conversion
fees_paid.unwrap_or(0) / 1000 truncates. E.g. a 999 msat fee becomes 0 sats. Acceptable given the scale of typical Lightning fees, but worth knowing.
lib.rs — doc comment not updated
The pay_invoice doc comment still says nothing about the return value. Minor, but since the signature is now a tuple it'd be helpful to add: /// Returns (preimage, fees_paid_sats) on success.
Empty PR description
Would be good to have a short description referencing issue #148.
None of the above are blockers — the core logic is sound. Good to merge after adding the PR description.
|
In the portal wallet trait definition, I would return to A future task I might assign myself could be to create a type like |
|
LGTM |
No description provided.