Skip to content

Commit

Permalink
Clean up functional wallet test amount calculation
Browse files Browse the repository at this point in the history
It makes more sense to add the untrusted balance to the trusted one.
  • Loading branch information
t-bast committed Apr 30, 2021
1 parent 0b9c89b commit a5c3d9c
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions test/functional/wallet_send.py
Expand Up @@ -38,10 +38,9 @@ def test_send(self, from_wallet, to_wallet=None, amount=None, data=None,
expect_error=None):
assert (amount is None) != (data is None)

from_balance_before = from_wallet.getbalances()["mine"]["trusted"]
if include_unsafe:
from_balance_before = from_wallet.getbalances()["mine"]["untrusted_pending"]
else:
from_balance_before = from_wallet.getbalances()["mine"]["trusted"]
from_balance_before += from_wallet.getbalances()["mine"]["untrusted_pending"]

if to_wallet is None:
assert amount is None
Expand Down Expand Up @@ -139,10 +138,9 @@ def test_send(self, from_wallet, to_wallet=None, amount=None, data=None,
assert not "txid" in res
assert "psbt" in res

from_balance = from_wallet.getbalances()["mine"]["trusted"]
if include_unsafe:
from_balance = from_wallet.getbalances()["mine"]["untrusted_pending"]
else:
from_balance = from_wallet.getbalances()["mine"]["trusted"]
from_balance += from_wallet.getbalances()["mine"]["untrusted_pending"]

if add_to_wallet and not include_watching:
# Ensure transaction exists in the wallet:
Expand Down

0 comments on commit a5c3d9c

Please sign in to comment.