|
|
@ -101,9 +101,13 @@ class TxRunner { |
|
|
|
return callback('Invalid account selected') |
|
|
|
return callback('Invalid account selected') |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
executionContext.vm().stateManager.getAccount(Buffer.from(from.replace('0x', ''), 'hex'), (err, res) => { |
|
|
|
|
|
|
|
if (err) { |
|
|
|
|
|
|
|
callback('Account not found') |
|
|
|
|
|
|
|
} else { |
|
|
|
var tx = new EthJSTX({ |
|
|
|
var tx = new EthJSTX({ |
|
|
|
timestamp: timestamp, |
|
|
|
timestamp: timestamp, |
|
|
|
nonce: new BN(account.nonce++), |
|
|
|
nonce: new BN(res.nonce), |
|
|
|
gasPrice: new BN(1), |
|
|
|
gasPrice: new BN(1), |
|
|
|
gasLimit: gasLimit, |
|
|
|
gasLimit: gasLimit, |
|
|
|
to: to, |
|
|
|
to: to, |
|
|
@ -127,20 +131,28 @@ class TxRunner { |
|
|
|
}) |
|
|
|
}) |
|
|
|
if (!useCall) { |
|
|
|
if (!useCall) { |
|
|
|
++self.blockNumber |
|
|
|
++self.blockNumber |
|
|
|
|
|
|
|
this.runBlockInVm(tx, block, callback) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
executionContext.vm().stateManager.checkpoint(() => { }) |
|
|
|
executionContext.vm().stateManager.checkpoint(() => { |
|
|
|
|
|
|
|
this.runBlockInVm(tx, block, (err, result) => { |
|
|
|
|
|
|
|
executionContext.vm().stateManager.revert(() => { |
|
|
|
|
|
|
|
callback(err, result) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
executionContext.checkpointAndCommit(() => { |
|
|
|
runBlockInVm (tx, block, callback) { |
|
|
|
executionContext.vm().runBlock({ block: block, generate: true, skipBlockValidation: true, skipBalance: false }, function (err, results) { |
|
|
|
executionContext.vm().runBlock({ block: block, generate: true, skipBlockValidation: true, skipBalance: false }, function (err, results) { |
|
|
|
err = err ? err.message : err |
|
|
|
err = err ? err.message : err |
|
|
|
if (err) { |
|
|
|
if (err) { |
|
|
|
return callback(err) |
|
|
|
return callback(err) |
|
|
|
} |
|
|
|
} |
|
|
|
let result = results.results[0] |
|
|
|
let result = results.results[0] |
|
|
|
if (useCall) { |
|
|
|
|
|
|
|
executionContext.vm().stateManager.revert(function () { }) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (result) { |
|
|
|
if (result) { |
|
|
|
result.status = '0x' + result.vm.exception.toString(16) |
|
|
|
result.status = '0x' + result.vm.exception.toString(16) |
|
|
|
} |
|
|
|
} |
|
|
@ -153,7 +165,6 @@ class TxRunner { |
|
|
|
transactionHash: ethJSUtil.bufferToHex(Buffer.from(tx.hash())) |
|
|
|
transactionHash: ethJSUtil.bufferToHex(Buffer.from(tx.hash())) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, 1) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
runInNode (from, to, data, value, gasLimit, useCall, confirmCb, gasEstimationForceSend, promptCb, callback) { |
|
|
|
runInNode (from, to, data, value, gasLimit, useCall, confirmCb, gasEstimationForceSend, promptCb, callback) { |
|
|
|