mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
Revert "core/rawdb: allocate database keys with explicit size to avoid slice growth (#27772)"
This reverts commit 4639725b10.
This commit is contained in:
parent
6746642e93
commit
2443349b31
1 changed files with 2 additions and 10 deletions
|
|
@ -195,11 +195,7 @@ func accountSnapshotKey(hash common.Hash) []byte {
|
||||||
|
|
||||||
// storageSnapshotKey = SnapshotStoragePrefix + account hash + storage hash
|
// storageSnapshotKey = SnapshotStoragePrefix + account hash + storage hash
|
||||||
func storageSnapshotKey(accountHash, storageHash common.Hash) []byte {
|
func storageSnapshotKey(accountHash, storageHash common.Hash) []byte {
|
||||||
buf := make([]byte, len(SnapshotStoragePrefix)+common.HashLength+common.HashLength)
|
return append(append(SnapshotStoragePrefix, accountHash.Bytes()...), storageHash.Bytes()...)
|
||||||
n := copy(buf, SnapshotStoragePrefix)
|
|
||||||
n += copy(buf[n:], accountHash.Bytes())
|
|
||||||
copy(buf[n:], storageHash.Bytes())
|
|
||||||
return buf
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// storageSnapshotsKey = SnapshotStoragePrefix + account hash + storage hash
|
// storageSnapshotsKey = SnapshotStoragePrefix + account hash + storage hash
|
||||||
|
|
@ -263,11 +259,7 @@ func accountTrieNodeKey(path []byte) []byte {
|
||||||
|
|
||||||
// storageTrieNodeKey = trieNodeStoragePrefix + accountHash + nodePath.
|
// storageTrieNodeKey = trieNodeStoragePrefix + accountHash + nodePath.
|
||||||
func storageTrieNodeKey(accountHash common.Hash, path []byte) []byte {
|
func storageTrieNodeKey(accountHash common.Hash, path []byte) []byte {
|
||||||
buf := make([]byte, len(trieNodeStoragePrefix)+common.HashLength+len(path))
|
return append(append(trieNodeStoragePrefix, accountHash.Bytes()...), path...)
|
||||||
n := copy(buf, trieNodeStoragePrefix)
|
|
||||||
n += copy(buf[n:], accountHash.Bytes())
|
|
||||||
copy(buf[n:], path)
|
|
||||||
return buf
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsLegacyTrieNode reports whether a provided database entry is a legacy trie
|
// IsLegacyTrieNode reports whether a provided database entry is a legacy trie
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue