From cfcbbc5bfa2c268e990dce4881feea2922a4d100 Mon Sep 17 00:00:00 2001 From: callebtc <93376500+callebtc@users.noreply.github.com> Date: Wed, 23 Oct 2024 01:20:29 +0200 Subject: [PATCH] coinselect: consider fees for edge case in selection --- cashu/wallet/transactions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cashu/wallet/transactions.py b/cashu/wallet/transactions.py index 51b0343e..f1a6499f 100644 --- a/cashu/wallet/transactions.py +++ b/cashu/wallet/transactions.py @@ -95,8 +95,8 @@ def coinselect( smaller_proofs[1:], remainder, include_fees=include_fees ) sum_selected_proofs = sum_proofs(selected_proofs) - - if sum_selected_proofs < amount_to_send and next_bigger: + fee_ppk_selected = self.get_fees_for_proofs_ppk(selected_proofs) + if sum_selected_proofs < amount_to_send + fee_ppk_selected and next_bigger: logger.trace("> adding next bigger proof") return [next_bigger]