storageRangeAt implementation changed

pull/7/head
yann300 8 years ago
parent 7641c37dc1
commit 6f96dc5737
  1. 6
      src/storage/storageResolver.js

@ -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')
}

Loading…
Cancel
Save