Allow passing timeout parameter to wait_and_assert_operationid_status
This commit is contained in:
parent
e39f0e16c2
commit
5602e1f1a6
|
@ -54,7 +54,7 @@ class MempoolTxInputLimitTest(BitcoinTestFramework):
|
|||
myopid = self.nodes[0].z_sendmany(node0_taddr, recipients)
|
||||
|
||||
# Spend should fail due to -mempooltxinputlimit
|
||||
wait_and_assert_operationid_status(self.nodes[0], myopid, "failed", "Too many transparent inputs 3 > limit 2")
|
||||
wait_and_assert_operationid_status(self.nodes[0], myopid, "failed", "Too many transparent inputs 3 > limit 2", 120)
|
||||
|
||||
# Mempool should be empty.
|
||||
assert_equal(set(self.nodes[0].getrawmempool()), set())
|
||||
|
|
|
@ -383,10 +383,10 @@ def assert_raises(exc, fun, *args, **kwds):
|
|||
raise AssertionError("No exception raised")
|
||||
|
||||
# Returns txid if operation was a success or None
|
||||
def wait_and_assert_operationid_status(node, myopid, in_status='success', in_errormsg=None):
|
||||
def wait_and_assert_operationid_status(node, myopid, in_status='success', in_errormsg=None, timeout=300):
|
||||
print('waiting for async operation {}'.format(myopid))
|
||||
result = None
|
||||
for x in xrange(1, 300): # 300 is the timeout
|
||||
for _ in xrange(1, timeout):
|
||||
results = node.z_getoperationresult([myopid])
|
||||
if len(results) > 0:
|
||||
result = results[0]
|
||||
|
|
|
@ -25,7 +25,7 @@ class WalletNullifiersTest (BitcoinTestFramework):
|
|||
recipients = []
|
||||
recipients.append({"address":myzaddr0, "amount":Decimal('10.0')-Decimal('0.0001')}) # utxo amount less fee
|
||||
|
||||
wait_and_assert_operationid_status(self.nodes[0], self.nodes[0].z_sendmany(mytaddr, recipients))
|
||||
wait_and_assert_operationid_status(self.nodes[0], self.nodes[0].z_sendmany(mytaddr, recipients), timeout=120)
|
||||
|
||||
self.sync_all()
|
||||
self.nodes[0].generate(1)
|
||||
|
@ -52,7 +52,7 @@ class WalletNullifiersTest (BitcoinTestFramework):
|
|||
recipients = []
|
||||
recipients.append({"address":myzaddr, "amount":7.0})
|
||||
|
||||
wait_and_assert_operationid_status(self.nodes[0], self.nodes[0].z_sendmany(myzaddr0, recipients))
|
||||
wait_and_assert_operationid_status(self.nodes[0], self.nodes[0].z_sendmany(myzaddr0, recipients), timeout=120)
|
||||
|
||||
self.sync_all()
|
||||
self.nodes[0].generate(1)
|
||||
|
@ -70,7 +70,7 @@ class WalletNullifiersTest (BitcoinTestFramework):
|
|||
recipients = []
|
||||
recipients.append({"address":myzaddr3, "amount":2.0})
|
||||
|
||||
wait_and_assert_operationid_status(self.nodes[2], self.nodes[2].z_sendmany(myzaddr, recipients))
|
||||
wait_and_assert_operationid_status(self.nodes[2], self.nodes[2].z_sendmany(myzaddr, recipients), timeout=120)
|
||||
|
||||
self.sync_all()
|
||||
self.nodes[2].generate(1)
|
||||
|
@ -97,7 +97,7 @@ class WalletNullifiersTest (BitcoinTestFramework):
|
|||
recipients = []
|
||||
recipients.append({"address":mytaddr1, "amount":1.0})
|
||||
|
||||
wait_and_assert_operationid_status(self.nodes[1], self.nodes[1].z_sendmany(myzaddr, recipients))
|
||||
wait_and_assert_operationid_status(self.nodes[1], self.nodes[1].z_sendmany(myzaddr, recipients), timeout=120)
|
||||
|
||||
self.sync_all()
|
||||
self.nodes[1].generate(1)
|
||||
|
|
|
@ -82,7 +82,7 @@ class WalletProtectCoinbaseTest (BitcoinTestFramework):
|
|||
recipients= [{"address":myzaddr, "amount": Decimal('1')}]
|
||||
myopid = self.nodes[3].z_sendmany(mytaddr, recipients)
|
||||
|
||||
wait_and_assert_operationid_status(self.nodes[3], myopid, "failed", "no UTXOs found for taddr from address")
|
||||
wait_and_assert_operationid_status(self.nodes[3], myopid, "failed", "no UTXOs found for taddr from address", 10)
|
||||
|
||||
# This send will fail because our wallet does not allow any change when protecting a coinbase utxo,
|
||||
# as it's currently not possible to specify a change address in z_sendmany.
|
||||
|
@ -90,7 +90,7 @@ class WalletProtectCoinbaseTest (BitcoinTestFramework):
|
|||
recipients.append({"address":myzaddr, "amount":Decimal('1.23456789')})
|
||||
|
||||
myopid = self.nodes[0].z_sendmany(mytaddr, recipients)
|
||||
error_result = wait_and_assert_operationid_status(self.nodes[0], myopid, "failed", "wallet does not allow any change")
|
||||
error_result = wait_and_assert_operationid_status(self.nodes[0], myopid, "failed", "wallet does not allow any change", 10)
|
||||
|
||||
# Test that the returned status object contains a params field with the operation's input parameters
|
||||
assert_equal(error_result["method"], "z_sendmany")
|
||||
|
|
Loading…
Reference in New Issue