Explorar o código

fix: send proofs change

thesimplekid hai 1 ano
pai
achega
cebf289613
Modificáronse 1 ficheiros con 2 adicións e 2 borrados
  1. 2 2
      src/cashu_wallet.rs

+ 2 - 2
src/cashu_wallet.rs

@@ -162,13 +162,13 @@ impl CashuWallet {
         let mut send_proofs = SendProofs::default();
 
         for proof in proofs {
+            let proof_value = proof.amount;
             if amount_available > amount {
                 send_proofs.change_proofs.push(proof);
-                break;
             } else {
-                amount_available += proof.amount;
                 send_proofs.send_proofs.push(proof);
             }
+            amount_available += proof_value;
         }
 
         if amount_available.lt(&amount) {