提交 14827605 编写于 作者: B Brian Johnson

Added exitOnError flag to Node.transferFunds.

上级 91ba62b4
......@@ -460,7 +460,6 @@ class Cluster(object):
Utils.Print("Transfer %s units from account %s to %s on eos server port %d" % (
transferAmountStr, fromm.name, to.name, node.port))
trans=node.transferFunds(fromm, to, transferAmountStr)
assert(trans)
transId=Node.getTransId(trans)
if transId is None:
return False
......
......@@ -546,7 +546,7 @@ class Node(object):
return ret
# Trasfer funds. Returns "transfer" json return object
def transferFunds(self, source, destination, amountStr, memo="memo", force=False, waitForTransBlock=False):
def transferFunds(self, source, destination, amountStr, memo="memo", force=False, waitForTransBlock=False, exitOnError=True):
assert isinstance(amountStr, str)
assert(source)
assert(isinstance(source, Account))
......@@ -568,11 +568,19 @@ class Node(object):
except subprocess.CalledProcessError as ex:
msg=ex.output.decode("utf-8")
Utils.Print("ERROR: Exception during funds transfer. %s" % (msg))
if exitOnError:
Utils.cmdError("could not transfer \"%s\" from %s to %s" % (amountStr, source, destination))
errorExit("Failed to transfer \"%s\" from %s to %s" % (amountStr, source, destination))
return None
assert(trans)
if trans is None:
Utils.cmdError("could not transfer \"%s\" from %s to %s" % (amountStr, source, destination))
errorExit("Failed to transfer \"%s\" from %s to %s" % (amountStr, source, destination))
transId=Node.getTransId(trans)
if waitForTransBlock and not self.waitForTransInBlock(transId):
if exitOnError:
Utils.cmdError("could not find transfer with transId=%s in block" % (transId))
errorExit("Failed to find transfer with transId=%s in block" % (transId))
return None
return trans
......
......@@ -220,10 +220,7 @@ try:
transferAmount="97.5321 {0}".format(CORE_SYMBOL)
Print("Transfer funds %s from account %s to %s" % (transferAmount, defproduceraAccount.name, testeraAccount.name))
if node.transferFunds(defproduceraAccount, testeraAccount, transferAmount, "test transfer") is None:
cmdError("%s transfer" % (ClientName))
errorExit("Failed to transfer funds %d from account %s to %s" % (
transferAmount, defproduceraAccount.name, testeraAccount.name))
node.transferFunds(defproduceraAccount, testeraAccount, transferAmount, "test transfer")
expectedAmount=transferAmount
Print("Verify transfer, Expected: %s" % (expectedAmount))
......@@ -235,10 +232,7 @@ try:
transferAmount="0.0100 {0}".format(CORE_SYMBOL)
Print("Force transfer funds %s from account %s to %s" % (
transferAmount, defproduceraAccount.name, testeraAccount.name))
if node.transferFunds(defproduceraAccount, testeraAccount, transferAmount, "test transfer", force=True) is None:
cmdError("%s transfer" % (ClientName))
errorExit("Failed to force transfer funds %d from account %s to %s" % (
transferAmount, defproduceraAccount.name, testeraAccount.name))
node.transferFunds(defproduceraAccount, testeraAccount, transferAmount, "test transfer", force=True)
expectedAmount="97.5421 {0}".format(CORE_SYMBOL)
Print("Verify transfer, Expected: %s" % (expectedAmount))
......@@ -265,10 +259,6 @@ try:
Print("Transfer funds %s from account %s to %s" % (
transferAmount, testeraAccount.name, currencyAccount.name))
trans=node.transferFunds(testeraAccount, currencyAccount, transferAmount, "test transfer a->b")
if trans is None:
cmdError("%s transfer" % (ClientName))
errorExit("Failed to transfer funds %d from account %s to %s" % (
transferAmount, testeraAccount.name, currencyAccount.name))
transId=Node.getTransId(trans)
expectedAmount="98.0311 {0}".format(CORE_SYMBOL) # 5000 initial deposit
......
......@@ -124,9 +124,7 @@ try:
trans=nodes[0].createInitializeAccount(account, cluster.eosioAccount, stakedDeposit=500000, waitForTransBlock=False, stakeNet=50000, stakeCPU=50000, buyRAM=50000, exitOnError=True)
transferAmount="70000000.0000 {0}".format(CORE_SYMBOL)
Print("Transfer funds %s from account %s to %s" % (transferAmount, cluster.eosioAccount.name, account.name))
if nodes[0].transferFunds(cluster.eosioAccount, account, transferAmount, "test transfer") is None:
errorExit("Failed to transfer funds %d from account %s to %s" % (
transferAmount, cluster.eosioAccount.name, account.name))
nodes[0].transferFunds(cluster.eosioAccount, account, transferAmount, "test transfer")
trans=nodes[0].delegatebw(account, 1000000.0000, 68000000.0000, exitOnError=True)
contractAccount=cluster.createAccountKeys(1)[0]
......@@ -136,9 +134,7 @@ try:
trans=nodes[0].createInitializeAccount(contractAccount, cluster.eosioAccount, stakedDeposit=500000, waitForTransBlock=False, stakeNet=50000, stakeCPU=50000, buyRAM=50000, exitOnError=True)
transferAmount="90000000.0000 {0}".format(CORE_SYMBOL)
Print("Transfer funds %s from account %s to %s" % (transferAmount, cluster.eosioAccount.name, contractAccount.name))
if nodes[0].transferFunds(cluster.eosioAccount, contractAccount, transferAmount, "test transfer") is None:
errorExit("Failed to transfer funds %d from account %s to %s" % (
transferAmount, cluster.eosioAccount.name, contractAccount.name))
nodes[0].transferFunds(cluster.eosioAccount, contractAccount, transferAmount, "test transfer")
trans=nodes[0].delegatebw(contractAccount, 1000000.0000, 88000000.0000, exitOnError=True)
contractDir="contracts/integration_test"
......
......@@ -258,9 +258,7 @@ try:
trans=node.createInitializeAccount(account, cluster.eosioAccount, stakedDeposit=0, waitForTransBlock=False, stakeNet=1000, stakeCPU=1000, buyRAM=1000, exitOnError=True)
transferAmount="100000000.0000 {0}".format(CORE_SYMBOL)
Print("Transfer funds %s from account %s to %s" % (transferAmount, cluster.eosioAccount.name, account.name))
if node.transferFunds(cluster.eosioAccount, account, transferAmount, "test transfer") is None:
errorExit("Failed to transfer funds %d from account %s to %s" % (
transferAmount, cluster.eosioAccount.name, account.name))
node.transferFunds(cluster.eosioAccount, account, transferAmount, "test transfer")
trans=node.delegatebw(account, 20000000.0000, 20000000.0000, exitOnError=True)
# containers for tracking producers
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册