From f14e82da7d99ebeaac5b9d9531de22195303b203 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 16 Oct 2017 15:13:22 +0200 Subject: [PATCH] add status info --- src/app/execution/txListener.js | 1 + src/app/execution/txLogger.js | 20 ++++++++++++++++++-- src/app/execution/txRunner.js | 1 + 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/app/execution/txListener.js b/src/app/execution/txListener.js index 82cc87ee30..79616fdf9b 100644 --- a/src/app/execution/txListener.js +++ b/src/app/execution/txListener.js @@ -76,6 +76,7 @@ class TxListener { } tx.envMode = executionContext.getProvider() + tx.status = txResult.result.status // 0x0 or 0x1 this._resolve([tx], () => { }) }) diff --git a/src/app/execution/txLogger.js b/src/app/execution/txLogger.js index 828bfea654..d2e17b06c2 100644 --- a/src/app/execution/txLogger.js +++ b/src/app/execution/txLogger.js @@ -182,7 +182,8 @@ function renderKnownTransaction (self, data) { logs: data.logs, val: data.tx.value, transactionCost: data.tx.transactionCost, - executionCost: data.tx.executionCost + executionCost: data.tx.executionCost, + status: data.tx.status }) tx.appendChild(table) } @@ -248,7 +249,8 @@ function renderUnknownTransaction (self, data) { gas: data.tx.gas, logs: data.logs, transactionCost: data.tx.transactionCost, - executionCost: data.tx.executionCost + executionCost: data.tx.executionCost, + status: data.tx.status }) tx.appendChild(table) } @@ -289,6 +291,20 @@ module.exports = TxLogger function createTable (opts) { var table = yo`
` + if (opts.status) { + var msg = '' + if (opts.status === '0x0') { + msg = ' Transaction mined but execution failed' + } else if (opts.status === '0x1') { + msg = ' Transaction mined and execution succeed' + } + table.appendChild(yo` + + status + ${opts.status}${msg} + `) + } + var contractAddress = yo` contractAddress diff --git a/src/app/execution/txRunner.js b/src/app/execution/txRunner.js index 889c789dab..2470b35260 100644 --- a/src/app/execution/txRunner.js +++ b/src/app/execution/txRunner.js @@ -120,6 +120,7 @@ TxRunner.prototype.execute = function (args, callback) { executionContext.vm().stateManager.revert(function () {}) } err = err ? err.message : err + result.status = '0x' + result.vm.exception.toString(16) callback(err, { result: result, transactionHash: ethJSUtil.bufferToHex(new Buffer(tx.hash()))