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.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) {
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
} }

Loading…
Cancel
Save