diff --git a/aggregator/aggregator.go b/aggregator/aggregator.go index b3daee1a2..38c5b6bdf 100644 --- a/aggregator/aggregator.go +++ b/aggregator/aggregator.go @@ -1753,16 +1753,16 @@ func (w *Writer) accountFn(plainKey []byte, cell *commitment.Cell) ([]byte, erro if len(plainKey) != length.Addr { // Accessing account key and value via "thin reference" to the state file and offset fileI := int(plainKey[0]) offset := decodeU64(plainKey[1:]) - plainKey, enc = readByOffset("accounts", &w.a.accountsFiles, fileI, offset) - } else { // Full account key is provided, search as usual - // Look in the summary table first - w.search.k = plainKey - if encI := w.a.accountsTree.Get(&w.search); encI != nil { - enc = encI.(*AggregateItem).v - } else { - // Look in the files - enc = readFromFiles("accounts", &w.a.accountsFiles, nil /* lock */, w.blockNum, plainKey, false /* trace */) - } + plainKey, _ = readByOffset("accounts", &w.a.accountsFiles, fileI, offset) + } + // Full account key is provided, search as usual + // Look in the summary table first + w.search.k = plainKey + if encI := w.a.accountsTree.Get(&w.search); encI != nil { + enc = encI.(*AggregateItem).v + } else { + // Look in the files + enc = readFromFiles("accounts", &w.a.accountsFiles, nil /* lock */, w.blockNum, plainKey, false /* trace */) } cell.Nonce = 0 cell.Balance.Clear() @@ -1802,16 +1802,16 @@ func (w *Writer) storageFn(plainKey []byte, cell *commitment.Cell) ([]byte, erro if len(plainKey) != length.Addr+length.Hash { // Accessing storage key and value via "thin reference" to the state file and offset fileI := int(plainKey[0]) offset := decodeU64(plainKey[1:]) - plainKey, enc = readByOffset("storage", &w.a.storageFiles, fileI, offset) - } else { // Full storage key is provided, search as usual - // Look in the summary table first - w.search.k = plainKey - if encI := w.a.storageTree.Get(&w.search); encI != nil { - enc = encI.(*AggregateItem).v - } else { - // Look in the files - enc = readFromFiles("storage", &w.a.storageFiles, nil /* lock */, w.blockNum, plainKey, false /* trace */) - } + plainKey, _ = readByOffset("storage", &w.a.storageFiles, fileI, offset) + } + // Full storage key is provided, search as usual + // Look in the summary table first + w.search.k = plainKey + if encI := w.a.storageTree.Get(&w.search); encI != nil { + enc = encI.(*AggregateItem).v + } else { + // Look in the files + enc = readFromFiles("storage", &w.a.storageFiles, nil /* lock */, w.blockNum, plainKey, false /* trace */) } cell.StorageLen = len(enc) copy(cell.Storage[:], enc)