trie: avoid index oob

This commit is contained in:
Martin Holst Swende 2023-10-09 11:39:11 +02:00
parent d3b0894f3f
commit 06d1b5299f
No known key found for this signature in database
GPG key ID: 683B438C05A5DDF0

View file

@ -452,6 +452,9 @@ func (g *GenerativeTrie) AddProof(rootHash common.Hash, origin []byte, proof eth
} }
func (g *GenerativeTrie) UpdateAll(keys []common.Hash, values [][]byte) error { func (g *GenerativeTrie) UpdateAll(keys []common.Hash, values [][]byte) error {
if len(keys) == 0 {
return nil
}
for i := 0; i < len(keys); i++ { for i := 0; i < len(keys); i++ {
g.stack.Update(keys[i][:], values[i]) g.stack.Update(keys[i][:], values[i])
} }