only take care of the first outofgas

pull/7/head
yann300 8 years ago
parent 88b92d5c03
commit ba9c610ad6
  1. 17
      src/trace/traceCache.js

@ -9,7 +9,7 @@ TraceCache.prototype.init = function () {
this.returnValues = {} this.returnValues = {}
this.callChanges = [] this.callChanges = []
this.calls = {} this.calls = {}
this.callsRef = [0] // track of calls during the vm trace analysis this.callsRef = [] // track of calls during the vm trace analysis
this.callsData = {} this.callsData = {}
this.contractCreation = {} this.contractCreation = {}
this.steps = {} this.steps = {}
@ -35,18 +35,23 @@ TraceCache.prototype.pushMemoryChanges = function (value) {
} }
TraceCache.prototype.pushCall = function (step, index, address, callStack, outofGas) { TraceCache.prototype.pushCall = function (step, index, address, callStack, outofGas) {
this.callChanges.push(index) var call = {
this.calls[index] = {
op: step.op, op: step.op,
address: address, address: address,
callStack: callStack, callStack: callStack,
outofGas: outofGas outofGas: outofGas
} }
if (step.op === 'RETURN' || step.op === 'STOP' || outofGas) { if (step.op === 'RETURN' || step.op === 'STOP' || outofGas) {
var call = this.callsRef.pop() if (this.callsRef.length > 1) { // we are returning from an internal call
this.calls[index].call = call this.callChanges.push(index)
this.calls[call].return = index this.calls[index] = call
var callIndex = this.callsRef.pop()
this.calls[index].call = callIndex
this.calls[callIndex].return = index
}
} else { } else {
this.callChanges.push(index)
this.calls[index] = call
this.callsRef.push(index) this.callsRef.push(index)
} }
} }

Loading…
Cancel
Save