Make tests always pass by ensuring there is only 1 coinbase utxo to shield
This commit is contained in:
@@ -109,10 +109,6 @@ class ShieldCoinbaseDonationTest (BitcoinTestFramework):
|
||||
# sendAmount/donationAmount arithmetic leads to a situation where the
|
||||
# exact amount in satoshis must deal with truncation/rounding
|
||||
|
||||
# generate some new coinbase funds
|
||||
rpc.generate(1)
|
||||
self.sync_all()
|
||||
|
||||
# shield funds to a new zaddr in this wallet with non-default fee
|
||||
fee = 0.00000001 # 1 puposhi fee will lead to some kind of rounding/truncation arithmetic
|
||||
response = rpc.z_shieldcoinbase('*', zaddr1, fee, 1, donation)
|
||||
@@ -120,8 +116,9 @@ class ShieldCoinbaseDonationTest (BitcoinTestFramework):
|
||||
print("opid=" + opid)
|
||||
|
||||
shieldingValue = response['shieldingValue']
|
||||
# sanity check
|
||||
assert_greater_than_or_equal( shieldingValue , 3.0 )
|
||||
# sanity check. None of the expected values below will be correct if
|
||||
# this is different
|
||||
assert_equal( str(shieldingValue) , "3.00010000" )
|
||||
|
||||
# TODO: this might not be enough time for slow machines, better
|
||||
# solution would be to wait until the opid finishes
|
||||
@@ -140,19 +137,18 @@ class ShieldCoinbaseDonationTest (BitcoinTestFramework):
|
||||
|
||||
rpc.z_listunspent()
|
||||
|
||||
# (300000000 - 1)*.95
|
||||
# 284999999.05
|
||||
# (300000000 - 1)*.05
|
||||
# 14999999.95
|
||||
# (300010000 - 1)*.05
|
||||
# 15000499.95
|
||||
# (300010000 - 1) - 15000499
|
||||
# 285009500
|
||||
# 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 - 1 (the fee) - 14999999 = 285000000
|
||||
# double to CAmount/int64_t which means the donation will be 15000499
|
||||
# and the sendAmount will be 300010000 - 1 (the fee) - 15000499 = 285009500
|
||||
|
||||
expectedSendAmount = 285000000
|
||||
expectedDonationAmount = 14999999
|
||||
|
||||
# actually seeing this: 2.84990500 + 0.14999500 = 2.99990000
|
||||
# logging: donation=5, sendAmount=299999999, donationAmount=14999999
|
||||
# these values assume that 3.0001 was shielded
|
||||
expectedSendAmount = 285009500
|
||||
expectedDonationAmount = 15000499
|
||||
|
||||
# lookup txid
|
||||
rawtx1 = rpc.z_viewtransaction(txid)
|
||||
|
||||
Reference in New Issue
Block a user