mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-25 06:06:44 +00:00
triedb/pathdb: fix journal resolution in pathdb
This commit is contained in:
parent
a92f2b86e3
commit
fd40142558
1 changed files with 24 additions and 4 deletions
|
|
@ -388,7 +388,12 @@ func (s *stateSet) decode(r *rlp.Stream) error {
|
||||||
return fmt.Errorf("load diff accounts: %v", err)
|
return fmt.Errorf("load diff accounts: %v", err)
|
||||||
}
|
}
|
||||||
for i := 0; i < len(dec.AddrHashes); i++ {
|
for i := 0; i < len(dec.AddrHashes); i++ {
|
||||||
|
if len(dec.Accounts[i]) > 0 {
|
||||||
accountSet[dec.AddrHashes[i]] = dec.Accounts[i]
|
accountSet[dec.AddrHashes[i]] = dec.Accounts[i]
|
||||||
|
} else {
|
||||||
|
// RLP loses nil-ness, but `[]byte{}` is not a valid item, so reinterpret that
|
||||||
|
accountSet[dec.AddrHashes[i]] = nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
s.accountData = accountSet
|
s.accountData = accountSet
|
||||||
|
|
||||||
|
|
@ -408,7 +413,12 @@ func (s *stateSet) decode(r *rlp.Stream) error {
|
||||||
for _, entry := range storages {
|
for _, entry := range storages {
|
||||||
storageSet[entry.AddrHash] = make(map[common.Hash][]byte, len(entry.Keys))
|
storageSet[entry.AddrHash] = make(map[common.Hash][]byte, len(entry.Keys))
|
||||||
for i := 0; i < len(entry.Keys); i++ {
|
for i := 0; i < len(entry.Keys); i++ {
|
||||||
|
if len(entry.Vals[i]) > 0 {
|
||||||
storageSet[entry.AddrHash][entry.Keys[i]] = entry.Vals[i]
|
storageSet[entry.AddrHash][entry.Keys[i]] = entry.Vals[i]
|
||||||
|
} else {
|
||||||
|
// RLP loses nil-ness, but `[]byte{}` is not a valid item, so reinterpret that
|
||||||
|
storageSet[entry.AddrHash][entry.Keys[i]] = nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
s.storageData = storageSet
|
s.storageData = storageSet
|
||||||
|
|
@ -551,7 +561,12 @@ func (s *StateSetWithOrigin) decode(r *rlp.Stream) error {
|
||||||
return fmt.Errorf("load diff account origin set: %v", err)
|
return fmt.Errorf("load diff account origin set: %v", err)
|
||||||
}
|
}
|
||||||
for i := 0; i < len(accounts.Accounts); i++ {
|
for i := 0; i < len(accounts.Accounts); i++ {
|
||||||
|
if len(accounts.Accounts[i]) > 0 {
|
||||||
accountSet[accounts.Addresses[i]] = accounts.Accounts[i]
|
accountSet[accounts.Addresses[i]] = accounts.Accounts[i]
|
||||||
|
} else {
|
||||||
|
// RLP loses nil-ness, but `[]byte{}` is not a valid item, so reinterpret that
|
||||||
|
accountSet[accounts.Addresses[i]] = nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
s.accountOrigin = accountSet
|
s.accountOrigin = accountSet
|
||||||
|
|
||||||
|
|
@ -571,7 +586,12 @@ func (s *StateSetWithOrigin) decode(r *rlp.Stream) error {
|
||||||
for _, storage := range storages {
|
for _, storage := range storages {
|
||||||
storageSet[storage.Address] = make(map[common.Hash][]byte)
|
storageSet[storage.Address] = make(map[common.Hash][]byte)
|
||||||
for i := 0; i < len(storage.Keys); i++ {
|
for i := 0; i < len(storage.Keys); i++ {
|
||||||
|
if len(storage.Vals[i]) > 0 {
|
||||||
storageSet[storage.Address][storage.Keys[i]] = storage.Vals[i]
|
storageSet[storage.Address][storage.Keys[i]] = storage.Vals[i]
|
||||||
|
} else {
|
||||||
|
// RLP loses nil-ness, but `[]byte{}` is not a valid item, so reinterpret that
|
||||||
|
storageSet[storage.Address][storage.Keys[i]] = nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
s.storageOrigin = storageSet
|
s.storageOrigin = storageSet
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue