diff --git a/ethdb/leveldb/leveldb.go b/ethdb/leveldb/leveldb.go index 9ff1a2ce1d..9a782dedbe 100644 --- a/ethdb/leveldb/leveldb.go +++ b/ethdb/leveldb/leveldb.go @@ -455,7 +455,7 @@ type batch struct { // Put inserts the given value into the batch for later committing. func (b *batch) Put(key, value []byte) error { b.b.Put(key, value) - b.size += len(value) + b.size += len(key) + len(value) return nil } diff --git a/ethdb/memorydb/memorydb.go b/ethdb/memorydb/memorydb.go index fedc9e326c..78181e860c 100644 --- a/ethdb/memorydb/memorydb.go +++ b/ethdb/memorydb/memorydb.go @@ -204,7 +204,7 @@ type batch struct { // Put inserts the given value into the batch for later committing. func (b *batch) Put(key, value []byte) error { b.writes = append(b.writes, keyvalue{common.CopyBytes(key), common.CopyBytes(value), false}) - b.size += len(value) + b.size += len(key) + len(value) return nil }