Commit 62ed083f authored by Iuri Matias's avatar Iuri Matias

refactor: remove unnecessary level of depth from runInVm

parent adfdea8b
...@@ -68,13 +68,16 @@ TxRunner.prototype.execute = function (args, callback) { ...@@ -68,13 +68,16 @@ TxRunner.prototype.execute = function (args, callback) {
if (!executionContext.isVM()) { if (!executionContext.isVM()) {
self.runInNode(args.from, args.to, data, args.value, args.gasLimit, args.useCall, callback) self.runInNode(args.from, args.to, data, args.value, args.gasLimit, args.useCall, callback)
} else { } else {
try {
self.runInVm(args.from, args.to, data, args.value, args.gasLimit, args.useCall, callback) self.runInVm(args.from, args.to, data, args.value, args.gasLimit, args.useCall, callback)
} catch (e) {
callback(e, null)
}
} }
} }
TxRunner.prototype.runInVm = function (from, to, data, value, gasLimit, useCall, callback) { TxRunner.prototype.runInVm = function (from, to, data, value, gasLimit, useCall, callback) {
const self = this const self = this
try {
var account = self.vmaccounts[from] var account = self.vmaccounts[from]
if (!account) { if (!account) {
return callback('Invalid account selected') return callback('Invalid account selected')
...@@ -119,9 +122,6 @@ TxRunner.prototype.runInVm = function (from, to, data, value, gasLimit, useCall, ...@@ -119,9 +122,6 @@ TxRunner.prototype.runInVm = function (from, to, data, value, gasLimit, useCall,
transactionHash: ethJSUtil.bufferToHex(new Buffer(tx.hash())) transactionHash: ethJSUtil.bufferToHex(new Buffer(tx.hash()))
}) })
}) })
} catch (e) {
callback(e, null)
}
} }
TxRunner.prototype.runInNode = function (from, to, data, value, gasLimit, useCall, callback) { TxRunner.prototype.runInNode = function (from, to, data, value, gasLimit, useCall, callback) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment