mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-22 04:36:42 +00:00
triedb/pathdb: polish code
This commit is contained in:
parent
3c1443e525
commit
c1729b7f52
3 changed files with 9 additions and 4 deletions
|
|
@ -275,8 +275,7 @@ func (dl *diskLayer) storage(accountHash, storageHash common.Hash, depth int) ([
|
|||
|
||||
// If the layer is being generated, ensure the requested storage slot
|
||||
// has already been covered by the generator.
|
||||
skey := storageKey(accountHash, storageHash)
|
||||
key := skey[:]
|
||||
key := storageKeySlice(accountHash, storageHash)
|
||||
marker := dl.genMarker()
|
||||
if marker != nil && bytes.Compare(key, marker) > 0 {
|
||||
return nil, errNotCoveredYet
|
||||
|
|
|
|||
|
|
@ -116,8 +116,7 @@ func writeStates(batch ethdb.Batch, genMarker []byte, accountData map[common.Has
|
|||
continue
|
||||
}
|
||||
slots += 1
|
||||
skey := storageKey(addrHash, storageHash)
|
||||
key := skey[:]
|
||||
key := storageKeySlice(addrHash, storageHash)
|
||||
if len(blob) == 0 {
|
||||
rawdb.DeleteStorageSnapshot(batch, addrHash, storageHash)
|
||||
if clean != nil {
|
||||
|
|
|
|||
|
|
@ -33,6 +33,13 @@ func storageKey(accountHash common.Hash, slotHash common.Hash) [64]byte {
|
|||
return key
|
||||
}
|
||||
|
||||
// storageKeySlice returns a key for uniquely identifying the storage slot in
|
||||
// the slice format.
|
||||
func storageKeySlice(accountHash common.Hash, slotHash common.Hash) []byte {
|
||||
key := storageKey(accountHash, slotHash)
|
||||
return key[:]
|
||||
}
|
||||
|
||||
// lookup is an internal structure used to efficiently determine the layer in
|
||||
// which a state entry resides.
|
||||
type lookup struct {
|
||||
|
|
|
|||
Loading…
Reference in a new issue