WIP donation tests

These tests sometimes fail because sometimes a different amount is shielded (3 vs 3+fee)
which makes the expected amounts of sendAmount and donationAmount incorrect. The code
to calculate donations seems to work correctly but the tests need a bit more improvement.

When the tests pass:
DEBUG:RPC:<-43- {"remainingUTXOs": 1, "remainingValue": "3.00010000", "shieldingUTXOs": 1, "shieldingValue": "3.00000000", "donation": 5, "opid": "opid-868c81ad-885b-42b4-af85-dafa54e695a2"}

When they fail:
DEBUG:RPC:<-43- {"remainingUTXOs": 1, "remainingValue": "3.00000000", "shieldingUTXOs": 1, "shieldingValue": "3.00010000", "donation": 5, "opid": "opid-143309b6-e25a-45d6-9c0c-311f1f61de78"}
This commit is contained in:
Duke
2025-10-15 13:26:50 -04:00
parent 6435cd51a6
commit 6069a49508

View File

@@ -121,7 +121,7 @@ class ShieldCoinbaseDonationTest (BitcoinTestFramework):
shieldingValue = response['shieldingValue']
# sanity check
assert_greater_than_or_equal( shieldingValue , 1.0 )
assert_greater_than_or_equal( shieldingValue , 3.0 )
# TODO: this might not be enough time for slow machines, better
# solution would be to wait until the opid finishes
@@ -146,9 +146,9 @@ class ShieldCoinbaseDonationTest (BitcoinTestFramework):
# 14999999.95
# The above value will be truncated (not rounded) by casting from
# double to CAmount/int64_t which means the donation will be 14999999
# and the sendAmount will be 300000000 - 14999999 = 285000001
# and the sendAmount will be 300000000 - 1 (the fee) - 14999999 = 285000000
expectedSendAmount = 285000001
expectedSendAmount = 285000000
expectedDonationAmount = 14999999
# actually seeing this: 2.84990500 + 0.14999500 = 2.99990000
@@ -203,7 +203,7 @@ class ShieldCoinbaseDonationTest (BitcoinTestFramework):
#wait_and_assert_operationid_status(rpc, opid)
shieldingValue = response['shieldingValue']
assert_greater_than_or_equal( shieldingValue , 1.0 )
assert_greater_than_or_equal( shieldingValue , 3.0 )
time.sleep(2) # give some time for the ztx to complete