nutshell icon indicating copy to clipboard operation
nutshell copied to clipboard

fix: increment fees for correct keysets

Open cloudsupper opened this issue 2 months ago • 0 comments

Fix for Issue #779: Spending fiat ecash increments fees paid for wrong keyset

Description

This PR fixes a bug where fees from spent proofs were being incorrectly attributed to the currently active keyset rather than to the keyset that the proofs belong to. This caused incorrect fee accounting, especially when dealing with multiple currencies (e.g., spending USD proofs would increment fees on the active SAT keyset).

Changes

  • Modified the _invalidate_proofs method in ledger.py to:
    • Group proofs by keyset ID
    • Calculate fees for each keyset separately
    • Call bump_keyset_fees_paid for each keyset with their respective fees

Issue Reference

Fixes #779

cloudsupper avatar Nov 14 '25 17:11 cloudsupper