fix(settlements): process cash-in (outbound) payments, not just cash-out #30
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/cash-in-settlement"
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?
What
The
_handle_paymentcash-in branch existed but had never run end-to-end — bitSpire cash-in payouts only started reaching it onceaiolabs/withdraw#3let an LNURL-withdraw payout carrysource=bitspire. With that merged, the first real cash-in surfaced two bugs:payment.satis signed by direction — negative for an outbound (cash-in) payout. It was passed straight toparse_settlementaswire_sats, which enforceswire_sats >= 0, so every cash-in was rejected (wire_sats must be >= 0, got -75795). A settlement'swire_satsis a magnitude (direction lives intx_type) → passabs(payment.sat). Same in_record_rejected._record_rejectedhard-codedtx_type="cash_out", so a rejected cash-in showed the wrong direction in the dashboard. The parsed tx_type isn't available there, but the authenticated protocol direction is — derive it: outbound →cash_in, inbound →cash_out.Verification (dev stack)
A stamped cash-in now lands a
cash_insettlement and pays the platform:black+ruffclean on the changed file (the two remaining E501s are pre-existing, outside this diff).Depends on / context
aiolabs/withdraw#3(merged) — theextrapassthrough that lets a cash-in payout be stamped.extra={source, type:cash_in, principal_sats, fee_sats, nostr attribution}— spec'd to bitspire separately. This PR is the operator-side half; it's a no-op safety improvement until bitSpire stamps cash-ins.Post-merge
Tag
v0.1.1and bump theaiolabs/lnbits-extensionscatalog entry.🤖 Generated with Claude Code
create_withdrawnostr-transport RPC (#31) #32