From 6069a495082a68a68d1e797ece2b28edfde705ae Mon Sep 17 00:00:00 2001 From: Duke Date: Wed, 15 Oct 2025 13:26:50 -0400 Subject: [PATCH] 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"} --- qa/rpc-tests/shieldcoinbase_donation.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/qa/rpc-tests/shieldcoinbase_donation.py b/qa/rpc-tests/shieldcoinbase_donation.py index 42e6b7329..efbf4939d 100755 --- a/qa/rpc-tests/shieldcoinbase_donation.py +++ b/qa/rpc-tests/shieldcoinbase_donation.py @@ -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