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

Loading…
Cancel
Save