fix pushCall

pull/7/head
yann300 8 years ago
parent bdad659a74
commit df0dcbd9f7
  1. 4
      src/trace/traceAnalyser.js
  2. 11
      src/trace/traceCache.js

@ -112,9 +112,9 @@ TraceAnalyser.prototype.buildDepth = function (index, step, tx, callStack, conte
context.lastCallIndex = context.currentCallIndex
context.currentCallIndex = 0
} 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()
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.traceCache.pushSteps(index, context.currentCallIndex)
context.currentCallIndex = context.lastCallIndex + 1

@ -33,17 +33,18 @@ TraceCache.prototype.pushMemoryChanges = function (value) {
this.memoryChanges.push(value)
}
TraceCache.prototype.pushCall = function (step, index, address, callStack, outofGas) {
if (step.op === 'RETURN' || step.op === 'STOP' || outofGas) {
this.currentCall.call.return = index
TraceCache.prototype.pushCall = function (step, index, address, callStack, reverted, outOfGas) {
if (step.op === 'RETURN' || step.op === 'STOP' || reverted) {
this.currentCall.call.return = index - 1
this.currentCall.call.reverted = reverted
this.currentCall.call.outOfGas = outOfGas
var parent = this.currentCall.parent
this.currentCall = { call: parent.call, parent: parent.parent }
this.currentCall = parent ? { call: parent.call, parent: parent.parent } : null
} else {
var call = {
op: step.op,
address: address,
callStack: callStack,
outofGas: outofGas,
calls: {},
start: index
}

Loading…
Cancel
Save