From cad32ee1cf664c6943a374302275bcbfbdfb70d3 Mon Sep 17 00:00:00 2001 From: Giulio rebuffo Date: Tue, 14 Jun 2022 21:43:44 +0200 Subject: [PATCH] added deletion support (#4451) --- ethdb/olddb/memorymutation.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/ethdb/olddb/memorymutation.go b/ethdb/olddb/memorymutation.go index 6636b9e9b..1154212c9 100644 --- a/ethdb/olddb/memorymutation.go +++ b/ethdb/olddb/memorymutation.go @@ -289,6 +289,20 @@ func (m *memorymutation) Flush(tx kv.RwTx) error { if err != nil { return err } + // Obliterate buckets who are to be deleted + for bucket := range m.clearedTables { + if err := tx.ClearBucket(bucket); err != nil { + return err + } + } + // Obliterate entries who are to be deleted + for bucket, keys := range m.deletedEntries { + for key := range keys { + if err := tx.Delete(bucket, []byte(key), nil); err != nil { + return err + } + } + } // Iterate over each bucket and apply changes accordingly. for _, bucket := range buckets { if _, ok := m.dupsortTables[bucket]; ok && bucket != kv.HashedStorage {