core, eth, les, trie: remove the sync bloom, used by fast sync
This commit is contained in:
@ -36,7 +36,6 @@ import (
|
||||
"github.com/ethereum/go-ethereum/event"
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
"github.com/ethereum/go-ethereum/params"
|
||||
"github.com/ethereum/go-ethereum/trie"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -101,8 +100,7 @@ type Downloader struct {
|
||||
queue *queue // Scheduler for selecting the hashes to download
|
||||
peers *peerSet // Set of active peers from which download can proceed
|
||||
|
||||
stateDB ethdb.Database // Database to state sync into (and deduplicate via)
|
||||
stateBloom *trie.SyncBloom // Bloom filter for snap trie node and contract code existence checks
|
||||
stateDB ethdb.Database // Database to state sync into (and deduplicate via)
|
||||
|
||||
// Statistics
|
||||
syncStatsChainOrigin uint64 // Origin block number where syncing started at
|
||||
@ -203,13 +201,12 @@ type BlockChain interface {
|
||||
}
|
||||
|
||||
// New creates a new downloader to fetch hashes and blocks from remote peers.
|
||||
func New(checkpoint uint64, stateDb ethdb.Database, stateBloom *trie.SyncBloom, mux *event.TypeMux, chain BlockChain, lightchain LightChain, dropPeer peerDropFn) *Downloader {
|
||||
func New(checkpoint uint64, stateDb ethdb.Database, mux *event.TypeMux, chain BlockChain, lightchain LightChain, dropPeer peerDropFn) *Downloader {
|
||||
if lightchain == nil {
|
||||
lightchain = chain
|
||||
}
|
||||
dl := &Downloader{
|
||||
stateDB: stateDb,
|
||||
stateBloom: stateBloom,
|
||||
mux: mux,
|
||||
checkpoint: checkpoint,
|
||||
queue: newQueue(blockCacheMaxItems, blockCacheInitialItems),
|
||||
@ -365,12 +362,6 @@ func (d *Downloader) synchronise(id string, hash common.Hash, td *big.Int, mode
|
||||
if atomic.CompareAndSwapInt32(&d.notified, 0, 1) {
|
||||
log.Info("Block synchronisation started")
|
||||
}
|
||||
// If we are already full syncing, but have a snap-sync bloom filter laying
|
||||
// around, make sure it doesn't use memory any more. This is a special case
|
||||
// when the user attempts to snap sync a new empty network.
|
||||
if mode == FullSync && d.stateBloom != nil {
|
||||
d.stateBloom.Close()
|
||||
}
|
||||
// If snap sync was requested, create the snap scheduler and switch to snap
|
||||
// sync mode. Long term we could drop snap sync or merge the two together,
|
||||
// but until snap becomes prevalent, we should support both. TODO(karalabe).
|
||||
@ -612,9 +603,6 @@ func (d *Downloader) Terminate() {
|
||||
default:
|
||||
close(d.quitCh)
|
||||
}
|
||||
if d.stateBloom != nil {
|
||||
d.stateBloom.Close()
|
||||
}
|
||||
d.quitLock.Unlock()
|
||||
|
||||
// Cancel any pending download requests
|
||||
@ -1599,15 +1587,6 @@ func (d *Downloader) commitPivotBlock(result *fetchResult) error {
|
||||
return err
|
||||
}
|
||||
atomic.StoreInt32(&d.committed, 1)
|
||||
|
||||
// If we had a bloom filter for the state sync, deallocate it now. Note, we only
|
||||
// deallocate internally, but keep the empty wrapper. This ensures that if we do
|
||||
// a rollback after committing the pivot and restarting snap sync, we don't end
|
||||
// up using a nil bloom. Empty bloom is fine, it just returns that it does not
|
||||
// have the info we need, so reach down to the database instead.
|
||||
if d.stateBloom != nil {
|
||||
d.stateBloom.Close()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user