core: handle empty MPT batch properly
It's OK to have it.
This commit is contained in:
parent
e3443b82a4
commit
e13816f3fd
1 changed files with 3 additions and 0 deletions
|
@ -43,6 +43,9 @@ func (b *Batch) Add(key []byte, value []byte) {
|
||||||
// and won't strip the resulting branch node.
|
// 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.
|
// 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) {
|
func (t *Trie) PutBatch(b Batch) (int, error) {
|
||||||
|
if len(b.kv) == 0 {
|
||||||
|
return 0, nil
|
||||||
|
}
|
||||||
r, n, err := t.putBatch(b.kv)
|
r, n, err := t.putBatch(b.kv)
|
||||||
t.root = r
|
t.root = r
|
||||||
return n, err
|
return n, err
|
||||||
|
|
Loading…
Reference in a new issue