Commit 6f96dc57 authored by yann300's avatar yann300

storageRangeAt implementation changed

parent 7641c37d
......@@ -62,7 +62,7 @@ function storageRangeInternal (self, slotKey, tx, stepIndex, address, callback)
if (cached && cached.storage[slotKey]) { // we have the current slot in the cache and maybe the next 1000...
return callback(null, cached.storage)
}
storageRangeWeb3Call(tx, address, slotKey, self.maxSize, (error, storage, complete) => {
storageRangeWeb3Call(tx, address, slotKey, self.maxSize, (error, storage, nextKey) => {
if (error) {
return callback(error)
}
......@@ -73,7 +73,7 @@ function storageRangeInternal (self, slotKey, tx, stepIndex, address, callback)
}
}
toCache(self, address, storage)
if (slotKey === zeroSlot && Object.keys(storage).length < self.maxSize) { // only working if keys are sorted !!
if (slotKey === zeroSlot && !nextKey) { // only working if keys are sorted !!
self.storageByAddress[address].complete = true
}
callback(null, storage)
......@@ -121,7 +121,7 @@ function storageRangeWeb3Call (tx, address, start, maxSize, callback) {
if (error) {
callback(error)
} else if (result.storage) {
callback(null, result.storage, result.complete)
callback(null, result.storage, result.nextKey)
} else {
callback('the storage has not been provided')
}
......
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