Commit f14e82da authored by yann300's avatar yann300

add status info

parent f2c47edb
...@@ -76,6 +76,7 @@ class TxListener { ...@@ -76,6 +76,7 @@ class TxListener {
} }
tx.envMode = executionContext.getProvider() tx.envMode = executionContext.getProvider()
tx.status = txResult.result.status // 0x0 or 0x1
this._resolve([tx], () => { this._resolve([tx], () => {
}) })
}) })
......
...@@ -182,7 +182,8 @@ function renderKnownTransaction (self, data) { ...@@ -182,7 +182,8 @@ function renderKnownTransaction (self, data) {
logs: data.logs, logs: data.logs,
val: data.tx.value, val: data.tx.value,
transactionCost: data.tx.transactionCost, transactionCost: data.tx.transactionCost,
executionCost: data.tx.executionCost executionCost: data.tx.executionCost,
status: data.tx.status
}) })
tx.appendChild(table) tx.appendChild(table)
} }
...@@ -248,7 +249,8 @@ function renderUnknownTransaction (self, data) { ...@@ -248,7 +249,8 @@ function renderUnknownTransaction (self, data) {
gas: data.tx.gas, gas: data.tx.gas,
logs: data.logs, logs: data.logs,
transactionCost: data.tx.transactionCost, transactionCost: data.tx.transactionCost,
executionCost: data.tx.executionCost executionCost: data.tx.executionCost,
status: data.tx.status
}) })
tx.appendChild(table) tx.appendChild(table)
} }
...@@ -289,6 +291,20 @@ module.exports = TxLogger ...@@ -289,6 +291,20 @@ module.exports = TxLogger
function createTable (opts) { function createTable (opts) {
var table = yo`<table class="${css.txTable}" id="txTable"></table>` var table = yo`<table class="${css.txTable}" id="txTable"></table>`
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`
<tr class="${css.tr}">
<td class="${css.td}"> status </td>
<td class="${css.td}">${opts.status}${msg}</td>
</tr class="${css.tr}">`)
}
var contractAddress = yo` var contractAddress = yo`
<tr class="${css.tr}"> <tr class="${css.tr}">
<td class="${css.td}"> contractAddress </td> <td class="${css.td}"> contractAddress </td>
......
...@@ -120,6 +120,7 @@ TxRunner.prototype.execute = function (args, callback) { ...@@ -120,6 +120,7 @@ TxRunner.prototype.execute = function (args, callback) {
executionContext.vm().stateManager.revert(function () {}) executionContext.vm().stateManager.revert(function () {})
} }
err = err ? err.message : err err = err ? err.message : err
result.status = '0x' + result.vm.exception.toString(16)
callback(err, { callback(err, {
result: result, result: result,
transactionHash: ethJSUtil.bufferToHex(new Buffer(tx.hash())) transactionHash: ethJSUtil.bufferToHex(new Buffer(tx.hash()))
......
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