From bae5f83146fb27720898cb50b867c00d4be0bea7 Mon Sep 17 00:00:00 2001 From: callebtc <93376500+callebtc@users.noreply.github.com> Date: Sun, 15 Oct 2023 14:39:53 +0200 Subject: [PATCH] fees were not returned if the fees were zero --- cashu/mint/ledger.py | 2 +- tests/test_wallet.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cashu/mint/ledger.py b/cashu/mint/ledger.py index cc53102c..a00d8259 100644 --- a/cashu/mint/ledger.py +++ b/cashu/mint/ledger.py @@ -482,7 +482,7 @@ async def melt( # prepare change to compensate wallet for overpaid fees return_promises: List[BlindedSignature] = [] - if outputs and fee_msat: + if outputs and fee_msat is not None: return_promises = await self._generate_change_promises( total_provided=total_provided, invoice_amount=invoice_amount, diff --git a/tests/test_wallet.py b/tests/test_wallet.py index 575e0bdf..0bf01868 100644 --- a/tests/test_wallet.py +++ b/tests/test_wallet.py @@ -227,7 +227,8 @@ async def test_melt(wallet1: Wallet): await wallet1.pay_lightning( send_proofs, invoice=invoice.pr, fee_reserve_sat=fee_reserve_sat ) - assert wallet1.balance == 128 - total_amount + # the payment was without fees so we need to remove it from the total amount + assert wallet1.balance == 128 - (total_amount - fee_reserve_sat) @pytest.mark.asyncio