Skip to content

Commit

Permalink
fix all tests
Browse files Browse the repository at this point in the history
  • Loading branch information
callebtc committed May 25, 2024
1 parent 6aefdea commit 561c0cc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions cashu/wallet/transactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ async def _select_proofs_to_send_(
async def _select_proofs_to_send(
self, proofs: List[Proof], amount_to_send: int
) -> List[Proof]:
# check that enough spendable proofs exist
if sum_proofs(proofs) < amount_to_send:
logger.trace("_select_proofs_to_send: not enough proofs to pay the amount.")
return []
raise Exception("balance too low.")
logger.trace(
f"_select_proofs_to_send – amount_to_send: {amount_to_send} – amounts we have: {amount_summary(proofs, self.unit)}"
)
Expand Down
8 changes: 4 additions & 4 deletions tests/test_mint_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,14 +177,14 @@ async def test_split_with_input_less_than_outputs(wallet1: Wallet, ledger: Ledge
wallet1.proofs, 10, set_reserved=False
)

all_send_proofs = send_proofs + keep_proofs
too_many_proofs = send_proofs + send_proofs

# generate outputs for all proofs, not only the sent ones
# generate more outputs than inputs
secrets, rs, derivation_paths = await wallet1.generate_n_secrets(
len(all_send_proofs)
len(too_many_proofs)
)
outputs, rs = wallet1._construct_outputs(
[p.amount for p in all_send_proofs], secrets, rs
[p.amount for p in too_many_proofs], secrets, rs
)

await assert_err(
Expand Down
4 changes: 2 additions & 2 deletions tests/test_wallet_restore.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ async def test_restore_wallet_after_send_and_self_receive_nonquadratic_value(
assert wallet3.balance == 0
await wallet3.restore_promises_from_to(0, 20)
box.add(wallet3.proofs)
assert wallet3.balance == 90
assert wallet3.balance == 84
await wallet3.invalidate(wallet3.proofs, check_spendable=True)
assert wallet3.balance == 64

Expand All @@ -389,6 +389,6 @@ async def test_restore_wallet_after_send_and_self_receive_nonquadratic_value(
assert wallet3.proofs == []
assert wallet3.balance == 0
await wallet3.restore_promises_from_to(0, 50)
assert wallet3.balance == 118
assert wallet3.balance == 108
await wallet3.invalidate(wallet3.proofs, check_spendable=True)
assert wallet3.balance == 64

0 comments on commit 561c0cc

Please sign in to comment.