core, eth, ethdb, trie: simplify range proofs

This commit is contained in:
Péter Szilágyi
2021-04-28 23:09:15 +03:00
parent a81cf0d2b3
commit fae165a5de
12 changed files with 149 additions and 237 deletions

View File

@ -448,7 +448,6 @@ func (db *Database) meter(refresh time.Duration) {
type batch struct {
db *leveldb.DB
b *leveldb.Batch
keys int
size int
}
@ -462,16 +461,10 @@ func (b *batch) Put(key, value []byte) error {
// Delete inserts the a key removal into the batch for later committing.
func (b *batch) Delete(key []byte) error {
b.b.Delete(key)
b.keys++
b.size += len(key)
return nil
}
// KeyCount retrieves the number of keys queued up for writing.
func (b *batch) KeyCount() int {
return b.keys
}
// ValueSize retrieves the amount of data queued up for writing.
func (b *batch) ValueSize() int {
return b.size
@ -485,7 +478,7 @@ func (b *batch) Write() error {
// Reset resets the batch for reuse.
func (b *batch) Reset() {
b.b.Reset()
b.keys, b.size = 0, 0
b.size = 0
}
// Replay replays the batch contents.