mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 15:16:43 +00:00
core/filtermaps: delete old bloombits database at startup
This commit is contained in:
parent
5b92e650c1
commit
5fde98fcce
2 changed files with 10 additions and 2 deletions
|
|
@ -242,7 +242,8 @@ func (f *FilterMaps) Start() {
|
||||||
log.Error("Could not load head filter map snapshot", "error", err)
|
log.Error("Could not load head filter map snapshot", "error", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
f.closeWg.Add(1)
|
f.closeWg.Add(2)
|
||||||
|
go f.removeBloomBits()
|
||||||
go f.indexerLoop()
|
go f.indexerLoop()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -335,6 +336,13 @@ func (f *FilterMaps) init() error {
|
||||||
return batch.Write()
|
return batch.Write()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// removeBloomBits removes old bloom bits data from the database.
|
||||||
|
func (f *FilterMaps) removeBloomBits() {
|
||||||
|
f.removeDbWithPrefix(rawdb.BloomBitsPrefix, "Removing old bloom bits database")
|
||||||
|
f.removeDbWithPrefix(rawdb.BloomBitsIndexPrefix, "Removing old bloom bits chain index")
|
||||||
|
f.closeWg.Done()
|
||||||
|
}
|
||||||
|
|
||||||
// removeDbWithPrefix removes data with the given prefix from the database and
|
// removeDbWithPrefix removes data with the given prefix from the database and
|
||||||
// returns true if everything was successfully removed.
|
// returns true if everything was successfully removed.
|
||||||
func (f *FilterMaps) removeDbWithPrefix(prefix []byte, action string) bool {
|
func (f *FilterMaps) removeDbWithPrefix(prefix []byte, action string) bool {
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,7 @@ var (
|
||||||
blockReceiptsPrefix = []byte("r") // blockReceiptsPrefix + num (uint64 big endian) + hash -> block receipts
|
blockReceiptsPrefix = []byte("r") // blockReceiptsPrefix + num (uint64 big endian) + hash -> block receipts
|
||||||
|
|
||||||
txLookupPrefix = []byte("l") // txLookupPrefix + hash -> transaction/receipt lookup metadata
|
txLookupPrefix = []byte("l") // txLookupPrefix + hash -> transaction/receipt lookup metadata
|
||||||
bloomBitsPrefix = []byte("B") // bloomBitsPrefix + bit (uint16 big endian) + section (uint64 big endian) + hash -> bloom bits
|
BloomBitsPrefix = []byte("B") // BloomBitsPrefix + bit (uint16 big endian) + section (uint64 big endian) + hash -> bloom bits
|
||||||
SnapshotAccountPrefix = []byte("a") // SnapshotAccountPrefix + account hash -> account trie value
|
SnapshotAccountPrefix = []byte("a") // SnapshotAccountPrefix + account hash -> account trie value
|
||||||
SnapshotStoragePrefix = []byte("o") // SnapshotStoragePrefix + account hash + storage hash -> storage trie value
|
SnapshotStoragePrefix = []byte("o") // SnapshotStoragePrefix + account hash + storage hash -> storage trie value
|
||||||
CodePrefix = []byte("c") // CodePrefix + code hash -> account code
|
CodePrefix = []byte("c") // CodePrefix + code hash -> account code
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue