mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
fix: alignment of values whose len is < 32
This commit is contained in:
parent
12c65cb520
commit
a926f60699
1 changed files with 5 additions and 1 deletions
|
|
@ -205,7 +205,11 @@ func (trie *VerkleTrie) UpdateStem(key []byte, values [][]byte) error {
|
||||||
func (trie *VerkleTrie) UpdateStorage(address common.Address, key, value []byte) error {
|
func (trie *VerkleTrie) UpdateStorage(address common.Address, key, value []byte) error {
|
||||||
k := utils.GetTreeKeyStorageSlotWithEvaluatedAddress(trie.pointCache.GetTreeKeyHeader(address[:]), key)
|
k := utils.GetTreeKeyStorageSlotWithEvaluatedAddress(trie.pointCache.GetTreeKeyHeader(address[:]), key)
|
||||||
var v [32]byte
|
var v [32]byte
|
||||||
copy(v[:], value[:])
|
if len(value) >= 32 {
|
||||||
|
copy(v[:], value[:32])
|
||||||
|
} else {
|
||||||
|
copy(v[32-len(value):], value[:])
|
||||||
|
}
|
||||||
return trie.root.Insert(k, v[:], trie.flatdbNodeResolver)
|
return trie.root.Insert(k, v[:], trie.flatdbNodeResolver)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue