Commit df0dcbd9 authored by yann300's avatar yann300

fix pushCall

parent bdad659a
...@@ -112,9 +112,9 @@ TraceAnalyser.prototype.buildDepth = function (index, step, tx, callStack, conte ...@@ -112,9 +112,9 @@ TraceAnalyser.prototype.buildDepth = function (index, step, tx, callStack, conte
context.lastCallIndex = context.currentCallIndex context.lastCallIndex = context.currentCallIndex
context.currentCallIndex = 0 context.currentCallIndex = 0
} else if (traceHelper.isReturnInstruction(step) || traceHelper.isStopInstruction(step) || outOfGas || step.error || step.invalidDepthChange) { } else if (traceHelper.isReturnInstruction(step) || traceHelper.isStopInstruction(step) || outOfGas || step.error || step.invalidDepthChange) {
if (index + 1 < this.trace.length) { if (index < this.trace.length) {
callStack.pop() callStack.pop()
this.traceCache.pushCall(step, index + 1, null, callStack.slice(0), outOfGas) this.traceCache.pushCall(step, index + 1, null, callStack.slice(0), outOfGas || step.error || step.invalidDepthChange, outOfGas)
this.buildCalldata(index, step, tx, false) this.buildCalldata(index, step, tx, false)
this.traceCache.pushSteps(index, context.currentCallIndex) this.traceCache.pushSteps(index, context.currentCallIndex)
context.currentCallIndex = context.lastCallIndex + 1 context.currentCallIndex = context.lastCallIndex + 1
......
...@@ -33,17 +33,18 @@ TraceCache.prototype.pushMemoryChanges = function (value) { ...@@ -33,17 +33,18 @@ TraceCache.prototype.pushMemoryChanges = function (value) {
this.memoryChanges.push(value) this.memoryChanges.push(value)
} }
TraceCache.prototype.pushCall = function (step, index, address, callStack, outofGas) { TraceCache.prototype.pushCall = function (step, index, address, callStack, reverted, outOfGas) {
if (step.op === 'RETURN' || step.op === 'STOP' || outofGas) { if (step.op === 'RETURN' || step.op === 'STOP' || reverted) {
this.currentCall.call.return = index this.currentCall.call.return = index - 1
this.currentCall.call.reverted = reverted
this.currentCall.call.outOfGas = outOfGas
var parent = this.currentCall.parent var parent = this.currentCall.parent
this.currentCall = { call: parent.call, parent: parent.parent } this.currentCall = parent ? { call: parent.call, parent: parent.parent } : null
} else { } else {
var call = { var call = {
op: step.op, op: step.op,
address: address, address: address,
callStack: callStack, callStack: callStack,
outofGas: outofGas,
calls: {}, calls: {},
start: index start: index
} }
......
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