Update failing tests after fixing ANY_TADDR behavior
This commit is contained in:
parent
7abdade2cc
commit
5f0681a601
|
@ -80,51 +80,39 @@ class WalletListUnspent(BitcoinTestFramework):
|
||||||
|
|
||||||
opid = self.nodes[0].z_sendmany(
|
opid = self.nodes[0].z_sendmany(
|
||||||
'ANY_TADDR',
|
'ANY_TADDR',
|
||||||
# FIXME: #6262 The amount here _should_ be 2, but because of a
|
[{'address': n1uaddr, 'amount': 2}],
|
||||||
# bug in the selector for `ANY_TADDR`, it’s selecting
|
|
||||||
# transparent coinbase, which also means we can’t have
|
|
||||||
# change. When that bug is fixed, the test should fail
|
|
||||||
# here, and we can switch it back to 2 (and cascade the
|
|
||||||
# corrected amounts mentioned below.
|
|
||||||
[{'address': n1uaddr, 'amount': 10}],
|
|
||||||
1, 0, 'AllowRevealedSenders')
|
1, 0, 'AllowRevealedSenders')
|
||||||
wait_and_assert_operationid_status(self.nodes[0], opid)
|
wait_and_assert_operationid_status(self.nodes[0], opid)
|
||||||
|
|
||||||
self.nodes[0].generate(2)
|
self.nodes[0].generate(2)
|
||||||
self.sync_all() # height 207
|
self.sync_all() # height 207
|
||||||
# FIXME: #6262, should be `expected_matured_at_height(207) - 10 + 10 - 2`
|
assert_equal(self.nodes[0].getbalance(), expected_matured_at_height(207) - 10 + 10 - 2)
|
||||||
assert_equal(self.nodes[0].getbalance(), expected_matured_at_height(207) - 10 + 10 - 10)
|
|
||||||
|
|
||||||
opid = self.nodes[0].z_sendmany(
|
opid = self.nodes[0].z_sendmany(
|
||||||
'ANY_TADDR',
|
'ANY_TADDR',
|
||||||
# FIXME: Should be 3 (see above)
|
[{'address': n1uaddr, 'amount': 3}],
|
||||||
[{'address': n1uaddr, 'amount': 10}],
|
|
||||||
1, 0, 'AllowRevealedSenders')
|
1, 0, 'AllowRevealedSenders')
|
||||||
wait_and_assert_operationid_status(self.nodes[0], opid)
|
wait_and_assert_operationid_status(self.nodes[0], opid)
|
||||||
|
|
||||||
self.nodes[0].generate(2)
|
self.nodes[0].generate(2)
|
||||||
self.sync_all() # height 209
|
self.sync_all() # height 209
|
||||||
# FIXME: #6262, should be `expected_matured_at_height(209) - 10 + 10 - 2 - 3`
|
assert_equal(self.nodes[0].getbalance(), expected_matured_at_height(209) - 10 + 10 - 2 - 3)
|
||||||
assert_equal(self.nodes[0].getbalance(), expected_matured_at_height(209) - 10 + 10 - 10 - 10)
|
|
||||||
|
|
||||||
opid = self.nodes[0].z_sendmany(
|
opid = self.nodes[0].z_sendmany(
|
||||||
'ANY_TADDR',
|
'ANY_TADDR',
|
||||||
# FIXME: Should be 5 (see above)
|
[{'address': n1uaddr, 'amount': 5}],
|
||||||
[{'address': n1uaddr, 'amount': 10}],
|
|
||||||
1, 0, 'AllowRevealedSenders')
|
1, 0, 'AllowRevealedSenders')
|
||||||
wait_and_assert_operationid_status(self.nodes[0], opid)
|
wait_and_assert_operationid_status(self.nodes[0], opid)
|
||||||
|
|
||||||
self.nodes[0].generate(2)
|
self.nodes[0].generate(2)
|
||||||
self.sync_all() # height 211
|
self.sync_all() # height 211
|
||||||
# FIXME: #6262, should be `expected_matured_at_height(211) - 10 + 10 - 2 - 3 - 5`
|
assert_equal(self.nodes[0].getbalance(), expected_matured_at_height(211) - 10 + 10 - 2 - 3 - 5)
|
||||||
assert_equal(self.nodes[0].getbalance(), expected_matured_at_height(211) - 10 + 10 - 10 - 10 - 10)
|
|
||||||
|
|
||||||
# check balances at various past points in the chain
|
# check balances at various past points in the chain
|
||||||
# FIXME: #6262, change the comparison amounts when the above changes are made.
|
|
||||||
assert_equal(self.matured_at_height(205), expected_matured_at_height(205) - 10 + 10)
|
assert_equal(self.matured_at_height(205), expected_matured_at_height(205) - 10 + 10)
|
||||||
assert_equal(self.matured_at_height(207), expected_matured_at_height(207) - 10 + 10 - 10)
|
assert_equal(self.matured_at_height(207), expected_matured_at_height(207) - 10 + 10 - 2)
|
||||||
assert_equal(self.matured_at_height(209), expected_matured_at_height(209) - 10 + 10 - 10 - 10)
|
assert_equal(self.matured_at_height(209), expected_matured_at_height(209) - 10 + 10 - 2 - 3)
|
||||||
assert_equal(self.matured_at_height(211), expected_matured_at_height(211) - 10 + 10 - 10 - 10 - 10)
|
assert_equal(self.matured_at_height(211), expected_matured_at_height(211) - 10 + 10 - 2 - 3 - 5)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
WalletListUnspent().main()
|
WalletListUnspent().main()
|
||||||
|
|
|
@ -97,7 +97,7 @@ class WalletSendManyAnyTaddr(BitcoinTestFramework):
|
||||||
|
|
||||||
# Check that ANY_TADDR note selection doesn't attempt a double-spend
|
# Check that ANY_TADDR note selection doesn't attempt a double-spend
|
||||||
myopid = self.nodes[3].z_sendmany('ANY_TADDR', [{'address': recipient, 'amount': 20}], 1)
|
myopid = self.nodes[3].z_sendmany('ANY_TADDR', [{'address': recipient, 'amount': 20}], 1)
|
||||||
wait_and_assert_operationid_status(self.nodes[3], myopid, "failed", "Insufficient funds: have 14.99998, need 20.00001")
|
wait_and_assert_operationid_status(self.nodes[3], myopid, "failed", "Insufficient funds: have 14.99998, need 20.00001; note that coinbase outputs will not be selected if you specify ANY_TADDR or if any transparent recipients are included.")
|
||||||
|
|
||||||
# Create an expired transaction on node 3.
|
# Create an expired transaction on node 3.
|
||||||
self.split_network()
|
self.split_network()
|
||||||
|
@ -123,7 +123,7 @@ class WalletSendManyAnyTaddr(BitcoinTestFramework):
|
||||||
assert_equal(0, self.nodes[2].getbalance())
|
assert_equal(0, self.nodes[2].getbalance())
|
||||||
|
|
||||||
# Check that ANY_TADDR doesn't select an expired output.
|
# Check that ANY_TADDR doesn't select an expired output.
|
||||||
wait_and_assert_operationid_status(self.nodes[2], self.nodes[2].z_sendmany('ANY_TADDR', [{'address': recipient, 'amount': 13}]), "failed", "Insufficient funds: have 0.00, need 13.00001")
|
wait_and_assert_operationid_status(self.nodes[2], self.nodes[2].z_sendmany('ANY_TADDR', [{'address': recipient, 'amount': 13}]), "failed", "Insufficient funds: have 0.00, need 13.00001; note that coinbase outputs will not be selected if you specify ANY_TADDR or if any transparent recipients are included.")
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
WalletSendManyAnyTaddr().main()
|
WalletSendManyAnyTaddr().main()
|
||||||
|
|
|
@ -225,7 +225,7 @@ class WalletShieldingCoinbaseTest (BitcoinTestFramework):
|
||||||
amount = Decimal('10.0') - DEFAULT_FEE - Decimal('0.00000001') # this leaves change at 1 zatoshi less than dust threshold
|
amount = Decimal('10.0') - DEFAULT_FEE - Decimal('0.00000001') # this leaves change at 1 zatoshi less than dust threshold
|
||||||
recipients.append({"address":self.nodes[0].getnewaddress(), "amount":amount })
|
recipients.append({"address":self.nodes[0].getnewaddress(), "amount":amount })
|
||||||
myopid = self.nodes[0].z_sendmany(mytaddr, recipients, 1)
|
myopid = self.nodes[0].z_sendmany(mytaddr, recipients, 1)
|
||||||
wait_and_assert_operationid_status(self.nodes[0], myopid, "failed", "Insufficient funds: have 10.00, need 0.00000053 more to avoid creating invalid change output 0.00000001 (dust threshold is 0.00000054)")
|
wait_and_assert_operationid_status(self.nodes[0], myopid, "failed", "Insufficient funds: have 10.00, need 0.00000053 more to avoid creating invalid change output 0.00000001 (dust threshold is 0.00000054); note that coinbase outputs will not be selected if you specify ANY_TADDR or if any transparent recipients are included.")
|
||||||
|
|
||||||
# Send will fail because send amount is too big, even when including coinbase utxos
|
# Send will fail because send amount is too big, even when including coinbase utxos
|
||||||
errorString = ""
|
errorString = ""
|
||||||
|
|
|
@ -11,6 +11,7 @@ from test_framework.util import (
|
||||||
assert_greater_than,
|
assert_greater_than,
|
||||||
assert_raises_message,
|
assert_raises_message,
|
||||||
connect_nodes_bi,
|
connect_nodes_bi,
|
||||||
|
get_coinbase_address,
|
||||||
nuparams,
|
nuparams,
|
||||||
start_nodes,
|
start_nodes,
|
||||||
wait_and_assert_operationid_status,
|
wait_and_assert_operationid_status,
|
||||||
|
@ -170,9 +171,8 @@ class WalletZSendmanyTest(BitcoinTestFramework):
|
||||||
n0account0 = self.nodes[0].z_getnewaccount()['account']
|
n0account0 = self.nodes[0].z_getnewaccount()['account']
|
||||||
n0ua0 = self.nodes[0].z_getaddressforaccount(n0account0)['address']
|
n0ua0 = self.nodes[0].z_getaddressforaccount(n0account0)['address']
|
||||||
|
|
||||||
# Change went to a fresh address, so use `ANY_TADDR` which
|
# Prepare to fund the UA from coinbase
|
||||||
# should hold the rest of our transparent funds.
|
source = get_coinbase_address(self.nodes[2])
|
||||||
source = 'ANY_TADDR'
|
|
||||||
recipients = []
|
recipients = []
|
||||||
recipients.append({"address":n0ua0, "amount":10})
|
recipients.append({"address":n0ua0, "amount":10})
|
||||||
|
|
||||||
|
@ -357,12 +357,13 @@ class WalletZSendmanyTest(BitcoinTestFramework):
|
||||||
#
|
#
|
||||||
|
|
||||||
# Send some legacy transparent funds to n1ua0, creating Sapling outputs.
|
# Send some legacy transparent funds to n1ua0, creating Sapling outputs.
|
||||||
|
source = get_coinbase_address(self.nodes[2])
|
||||||
recipients = [{"address":n1ua0, "amount":10}]
|
recipients = [{"address":n1ua0, "amount":10}]
|
||||||
# This requires the AllowRevealedSenders policy...
|
# This requires the AllowRevealedSenders policy...
|
||||||
opid = self.nodes[2].z_sendmany('ANY_TADDR', recipients, 1, 0)
|
opid = self.nodes[2].z_sendmany(source, recipients, 1, 0)
|
||||||
wait_and_assert_operationid_status(self.nodes[2], opid, 'failed', revealed_senders_msg)
|
wait_and_assert_operationid_status(self.nodes[2], opid, 'failed', revealed_senders_msg)
|
||||||
# ... which we can always override with the NoPrivacy policy.
|
# ... which we can always override with the NoPrivacy policy.
|
||||||
opid = self.nodes[2].z_sendmany('ANY_TADDR', recipients, 1, 0, 'NoPrivacy')
|
opid = self.nodes[2].z_sendmany(source, recipients, 1, 0, 'NoPrivacy')
|
||||||
wait_and_assert_operationid_status(self.nodes[2], opid)
|
wait_and_assert_operationid_status(self.nodes[2], opid)
|
||||||
|
|
||||||
self.sync_all()
|
self.sync_all()
|
||||||
|
|
Loading…
Reference in New Issue