fix test again

Signed-off-by: jsvisa <delweng@gmail.com>
This commit is contained in:
jsvisa 2025-07-17 23:08:43 +08:00
parent 15d22b1db5
commit 501dd0535c

View file

@ -199,18 +199,21 @@ func TestBatchIndexerWrite(t *testing.T) {
storages = make(map[common.Hash]map[common.Hash][]uint64) storages = make(map[common.Hash]map[common.Hash][]uint64)
) )
for i, h := range histories { for i, h := range histories {
for _, addr := range h.accountList { for addr := range h.accounts {
addrHash := crypto.Keccak256Hash(addr.Bytes()) addrHash := crypto.Keccak256Hash(addr.Bytes())
accounts[addrHash] = append(accounts[addrHash], uint64(i+1)) accounts[addrHash] = append(accounts[addrHash], uint64(i+1))
if _, ok := storages[addrHash]; !ok { if _, ok := storages[addrHash]; !ok {
storages[addrHash] = make(map[common.Hash][]uint64) storages[addrHash] = make(map[common.Hash][]uint64)
} }
for _, slot := range h.storageList[addr] { slots, ok := h.storages[addr]
if ok {
for slot := range slots {
storages[addrHash][slot] = append(storages[addrHash][slot], uint64(i+1)) storages[addrHash][slot] = append(storages[addrHash][slot], uint64(i+1))
} }
} }
} }
}
for addrHash, indexes := range accounts { for addrHash, indexes := range accounts {
ir, _ := newIndexReader(db, newAccountIdent(addrHash)) ir, _ := newIndexReader(db, newAccountIdent(addrHash))
for i := 0; i < len(indexes)-1; i++ { for i := 0; i < len(indexes)-1; i++ {