refactor: remove unnecessary level of depth from runInNode

pull/1/head
Iuri Matias 7 years ago
parent 9937c9c4a9
commit 9e3c80298f
  1. 12
      src/app/execution/txRunner.js

@ -126,22 +126,17 @@ TxRunner.prototype.runInVm = function (from, to, data, value, gasLimit, useCall,
TxRunner.prototype.runInNode = function (from, to, data, value, gasLimit, useCall, callback) { TxRunner.prototype.runInNode = function (from, to, data, value, gasLimit, useCall, callback) {
const self = this const self = this
var tx = { var tx = { from: from, to: to, data: data, value: value }
from: from,
to: to,
data: data,
value: value
}
if (useCall) { if (useCall) {
tx.gas = gasLimit tx.gas = gasLimit
executionContext.web3().eth.call(tx, function (error, result) { return executionContext.web3().eth.call(tx, function (error, result) {
callback(error, { callback(error, {
result: result, result: result,
transactionHash: result.transactionHash transactionHash: result.transactionHash
}) })
}) })
} else { }
executionContext.web3().eth.estimateGas(tx, function (err, gasEstimation) { executionContext.web3().eth.estimateGas(tx, function (err, gasEstimation) {
if (err) { if (err) {
return callback(err, gasEstimation) return callback(err, gasEstimation)
@ -193,7 +188,6 @@ TxRunner.prototype.runInNode = function (from, to, data, value, gasLimit, useCal
} }
}) })
} }
}
function tryTillResponse (txhash, done) { function tryTillResponse (txhash, done) {
executionContext.web3().eth.getTransactionReceipt(txhash, function (err, result) { executionContext.web3().eth.getTransactionReceipt(txhash, function (err, result) {

Loading…
Cancel
Save