mirror of
https://github.com/aljazceru/nutshell.git
synced 2026-01-06 18:34:20 +01:00
fix tests
This commit is contained in:
@@ -561,6 +561,10 @@ class Wallet(LedgerAPI):
|
||||
] # "or not p.id" is for backwards compatibility with proofs without a keyset id
|
||||
# select proofs that are not reserved
|
||||
proofs = [p for p in proofs if not p.reserved]
|
||||
|
||||
if sum_proofs(proofs) < amount_to_send:
|
||||
raise Exception("balance too low.")
|
||||
|
||||
# select proofs based on amount to send
|
||||
sorted_proofs = sorted(proofs, key=lambda p: p.amount)
|
||||
send_proofs: List[Proof] = []
|
||||
@@ -598,8 +602,7 @@ class Wallet(LedgerAPI):
|
||||
if scnd_secret:
|
||||
logger.debug(f"Spending conditions: {scnd_secret}")
|
||||
spendable_proofs = await self._select_proofs_to_send(proofs, amount)
|
||||
if sum_proofs(spendable_proofs) < amount:
|
||||
raise Exception("balance too low.")
|
||||
|
||||
keep_proofs, send_proofs = await self.split(
|
||||
[p for p in spendable_proofs if not p.reserved], amount, scnd_secret
|
||||
)
|
||||
|
||||
@@ -101,7 +101,7 @@ async def test_split_to_send(wallet1: Wallet):
|
||||
keep_proofs, spendable_proofs = await wallet1.split_to_send(
|
||||
wallet1.proofs, 32, set_reserved=True
|
||||
)
|
||||
get_spendable = await wallet1._get_spendable_proofs(wallet1.proofs)
|
||||
get_spendable = await wallet1._select_proofs_to_send(wallet1.proofs, 32)
|
||||
assert keep_proofs == get_spendable
|
||||
|
||||
assert sum_proofs(spendable_proofs) == 32
|
||||
|
||||
Reference in New Issue
Block a user