|
|
@ -101,14 +101,7 @@ TraceManager.prototype.getStorageAt = function (stepIndex, tx, callback, address |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
TraceManager.prototype.getAddresses = function (callback) { |
|
|
|
TraceManager.prototype.getAddresses = function (callback) { |
|
|
|
var addresses = [ this.tx.to ] |
|
|
|
callback(null, this.traceCache.addresses) |
|
|
|
for (var k in this.traceCache.calls) { |
|
|
|
|
|
|
|
var address = this.traceCache.calls[k].address |
|
|
|
|
|
|
|
if (address && addresses.join('').indexOf(address) === -1) { |
|
|
|
|
|
|
|
addresses.push(address) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
callback(null, addresses) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
TraceManager.prototype.getCallDataAt = function (stepIndex, callback) { |
|
|
|
TraceManager.prototype.getCallDataAt = function (stepIndex, callback) { |
|
|
@ -126,9 +119,9 @@ TraceManager.prototype.getCallStackAt = function (stepIndex, callback) { |
|
|
|
if (check) { |
|
|
|
if (check) { |
|
|
|
return callback(check, null) |
|
|
|
return callback(check, null) |
|
|
|
} |
|
|
|
} |
|
|
|
var callStackChange = util.findLowerBoundValue(stepIndex, this.traceCache.callChanges) |
|
|
|
var call = util.findCall(stepIndex, this.traceCache.callsTree.call) |
|
|
|
if (callStackChange === null) return callback('no callstack found', null) |
|
|
|
if (call === null) return callback('no callstack found', null) |
|
|
|
callback(null, this.traceCache.calls[callStackChange].callStack) |
|
|
|
callback(null, call.callStack) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
TraceManager.prototype.getStackAt = function (stepIndex, callback) { |
|
|
|
TraceManager.prototype.getStackAt = function (stepIndex, callback) { |
|
|
@ -151,7 +144,7 @@ TraceManager.prototype.getLastCallChangeSince = function (stepIndex, callback) { |
|
|
|
if (check) { |
|
|
|
if (check) { |
|
|
|
return callback(check, null) |
|
|
|
return callback(check, null) |
|
|
|
} |
|
|
|
} |
|
|
|
var callChange = util.findLowerBoundValue(stepIndex, this.traceCache.callChanges) |
|
|
|
var callChange = util.findCall(stepIndex, this.traceCache.callsTree.call) |
|
|
|
if (callChange === null) { |
|
|
|
if (callChange === null) { |
|
|
|
callback(null, 0) |
|
|
|
callback(null, 0) |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -164,21 +157,14 @@ TraceManager.prototype.getCurrentCalledAddressAt = function (stepIndex, callback |
|
|
|
if (check) { |
|
|
|
if (check) { |
|
|
|
return callback(check, null) |
|
|
|
return callback(check, null) |
|
|
|
} |
|
|
|
} |
|
|
|
var self = this |
|
|
|
this.getLastCallChangeSince(stepIndex, function (error, resp) { |
|
|
|
this.getLastCallChangeSince(stepIndex, function (error, addressIndex) { |
|
|
|
|
|
|
|
if (error) { |
|
|
|
if (error) { |
|
|
|
callback(error, null) |
|
|
|
callback(error, null) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
if (addressIndex === 0) { |
|
|
|
if (resp) { |
|
|
|
callback(null, self.tx.to) |
|
|
|
callback(null, resp.address) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
var callStack = self.traceCache.calls[addressIndex].callStack |
|
|
|
callback('unable to get current called address. ' + stepIndex + ' does not match with a CALL') |
|
|
|
var calledAddress = callStack[callStack.length - 1] |
|
|
|
|
|
|
|
if (calledAddress) { |
|
|
|
|
|
|
|
callback(null, calledAddress) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
callback('unable to get current called address. ' + stepIndex + ' does not match with a CALL', null) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|