core: handle empty MPT batch properly

It's OK to have it.
This commit is contained in:
AnnaShaleva 2021-10-27 18:36:40 +03:00
parent e3443b82a4
commit e13816f3fd

View file

@ -43,6 +43,9 @@ func (b *Batch) Add(key []byte, value []byte) {
// and won't strip the resulting branch node.
// However it is used mostly after the block processing to update MPT and error is not expected.
func (t *Trie) PutBatch(b Batch) (int, error) {
if len(b.kv) == 0 {
return 0, nil
}
r, n, err := t.putBatch(b.kv)
t.root = r
return n, err