Fix #b1eb4f2 so test checks sendfrom as originally intended.
Also reduce number of z_sendmany calls made so test runs quicker.
This commit is contained in:
@@ -31,20 +31,34 @@ class MempoolTxInputLimitTest(BitcoinTestFramework):
|
|||||||
recipients = []
|
recipients = []
|
||||||
recipients.append({"address": to_addr, "amount": amount})
|
recipients.append({"address": to_addr, "amount": amount})
|
||||||
myopid = self.nodes[0].z_sendmany(from_addr, recipients)
|
myopid = self.nodes[0].z_sendmany(from_addr, recipients)
|
||||||
|
return self.wait_and_assert_operationid_status(myopid)
|
||||||
|
|
||||||
|
def wait_and_assert_operationid_status(self, myopid, in_status='success', in_errormsg=None):
|
||||||
|
print('waiting for async operation {}'.format(myopid))
|
||||||
opids = []
|
opids = []
|
||||||
opids.append(myopid)
|
opids.append(myopid)
|
||||||
|
timeout = 300
|
||||||
timeout = 120
|
|
||||||
status = None
|
status = None
|
||||||
|
errormsg = None
|
||||||
|
txid = None
|
||||||
for x in xrange(1, timeout):
|
for x in xrange(1, timeout):
|
||||||
results = self.nodes[0].z_getoperationresult(opids)
|
results = self.nodes[0].z_getoperationresult(opids)
|
||||||
if len(results)==0:
|
if len(results)==0:
|
||||||
sleep(1)
|
sleep(1)
|
||||||
else:
|
else:
|
||||||
status = results[0]["status"]
|
status = results[0]["status"]
|
||||||
assert_equal("success", status)
|
if status == "failed":
|
||||||
return results[0]["result"]["txid"]
|
errormsg = results[0]['error']['message']
|
||||||
|
elif status == "success":
|
||||||
|
txid = results[0]['result']['txid']
|
||||||
|
break
|
||||||
|
print('...returned status: {}'.format(status))
|
||||||
|
assert_equal(in_status, status)
|
||||||
|
if errormsg is not None:
|
||||||
|
assert(in_errormsg is not None)
|
||||||
|
assert_equal(in_errormsg in errormsg, True)
|
||||||
|
print('...returned error: {}'.format(errormsg))
|
||||||
|
return txid
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
start_count = self.nodes[0].getblockcount()
|
start_count = self.nodes[0].getblockcount()
|
||||||
@@ -106,20 +120,20 @@ class MempoolTxInputLimitTest(BitcoinTestFramework):
|
|||||||
recipients = []
|
recipients = []
|
||||||
spend_taddr_amount = spend_zaddr_amount - Decimal('0.0001')
|
spend_taddr_amount = spend_zaddr_amount - Decimal('0.0001')
|
||||||
spend_taddr_output = Decimal('8')
|
spend_taddr_output = Decimal('8')
|
||||||
|
|
||||||
# Create three outputs
|
# Create three outputs
|
||||||
self.call_z_sendmany(node0_zaddr, node1_taddr, spend_taddr_output - Decimal('0.0001'))
|
recipients.append({"address":self.nodes[1].getnewaddress(), "amount": spend_taddr_output})
|
||||||
self.nodes[1].generate(1)
|
recipients.append({"address":self.nodes[1].getnewaddress(), "amount": spend_taddr_output})
|
||||||
self.sync_all()
|
recipients.append({"address":self.nodes[1].getnewaddress(), "amount": spend_taddr_amount - spend_taddr_output - spend_taddr_output})
|
||||||
self.call_z_sendmany(node0_zaddr, node1_taddr, spend_taddr_output - Decimal('0.0001'))
|
|
||||||
self.nodes[1].generate(1)
|
myopid = self.nodes[0].z_sendmany(node0_zaddr, recipients)
|
||||||
self.sync_all()
|
self.wait_and_assert_operationid_status(myopid)
|
||||||
self.call_z_sendmany(node0_zaddr, node1_taddr, spend_taddr_amount - spend_taddr_output - spend_taddr_output - Decimal('0.0001')) # note amount less fees
|
|
||||||
self.nodes[1].generate(1)
|
self.nodes[1].generate(1)
|
||||||
self.sync_all()
|
self.sync_all()
|
||||||
|
|
||||||
# Should use three UTXOs and fail
|
# Should use three UTXOs and fail
|
||||||
try:
|
try:
|
||||||
self.nodes[1].sendtoaddress(node0_taddr, spend_taddr_amount - Decimal('1'))
|
self.nodes[1].sendfrom("", node0_taddr, spend_taddr_amount - Decimal('1'))
|
||||||
assert(False)
|
assert(False)
|
||||||
except JSONRPCException,e:
|
except JSONRPCException,e:
|
||||||
msg = e.error['message']
|
msg = e.error['message']
|
||||||
|
|||||||
Reference in New Issue
Block a user