eth/protocols/snap, eth/downloader: don't use bloom filter in snap sync

This commit is contained in:
Martin Holst Swende
2021-03-17 09:36:34 +01:00
parent 91726e8aad
commit 410089afea
4 changed files with 11 additions and 12 deletions

View File

@ -177,7 +177,11 @@ func newHandler(config *handlerConfig) (*handler, error) {
// Construct the downloader (long sync) and its backing state bloom if fast
// sync is requested. The downloader is responsible for deallocating the state
// bloom when it's done.
if atomic.LoadUint32(&h.fastSync) == 1 {
// Note: we don't enable it if snap-sync is performed, since it's very heavy
// and the heal-portion of the snap sync is much lighter than fast. What we particularly
// want to avoid, is a 90%-finished (but restarted) snap-sync to begin
// indexing the entire trie
if atomic.LoadUint32(&h.fastSync) == 1 && atomic.LoadUint32(&h.snapSync) == 0 {
h.stateBloom = trie.NewSyncBloom(config.BloomCache, config.Database)
}
h.downloader = downloader.New(h.checkpointNumber, config.Database, h.stateBloom, h.eventMux, h.chain, nil, h.removePeer)