From e13816f3fd7c5848b3ede5ac019c40f82e926bb3 Mon Sep 17 00:00:00 2001 From: AnnaShaleva Date: Wed, 27 Oct 2021 18:36:40 +0300 Subject: [PATCH] core: handle empty MPT batch properly It's OK to have it. --- pkg/core/mpt/batch.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/core/mpt/batch.go b/pkg/core/mpt/batch.go index d2b0349ac..11f26752c 100644 --- a/pkg/core/mpt/batch.go +++ b/pkg/core/mpt/batch.go @@ -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