core, eth, les, trie: remove the sync bloom, used by fast sync
This commit is contained in:
@ -29,7 +29,6 @@ import (
|
||||
"github.com/ethereum/go-ethereum/p2p/enode"
|
||||
"github.com/ethereum/go-ethereum/p2p/enr"
|
||||
"github.com/ethereum/go-ethereum/params"
|
||||
"github.com/ethereum/go-ethereum/trie"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -69,9 +68,6 @@ type Backend interface {
|
||||
// Chain retrieves the blockchain object to serve data.
|
||||
Chain() *core.BlockChain
|
||||
|
||||
// StateBloom retrieves the bloom filter - if any - for state trie nodes.
|
||||
StateBloom() *trie.SyncBloom
|
||||
|
||||
// TxPool retrieves the transaction pool object to serve data.
|
||||
TxPool() TxPool
|
||||
|
||||
|
@ -34,7 +34,6 @@ import (
|
||||
"github.com/ethereum/go-ethereum/p2p"
|
||||
"github.com/ethereum/go-ethereum/p2p/enode"
|
||||
"github.com/ethereum/go-ethereum/params"
|
||||
"github.com/ethereum/go-ethereum/trie"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -91,9 +90,8 @@ func (b *testBackend) close() {
|
||||
b.chain.Stop()
|
||||
}
|
||||
|
||||
func (b *testBackend) Chain() *core.BlockChain { return b.chain }
|
||||
func (b *testBackend) StateBloom() *trie.SyncBloom { return nil }
|
||||
func (b *testBackend) TxPool() TxPool { return b.txpool }
|
||||
func (b *testBackend) Chain() *core.BlockChain { return b.chain }
|
||||
func (b *testBackend) TxPool() TxPool { return b.txpool }
|
||||
|
||||
func (b *testBackend) RunPeer(peer *Peer, handler Handler) error {
|
||||
// Normally the backend would do peer mainentance and handshakes. All that
|
||||
|
@ -164,13 +164,13 @@ func handleGetNodeData66(backend Backend, msg Decoder, peer *Peer) error {
|
||||
if err := msg.Decode(&query); err != nil {
|
||||
return fmt.Errorf("%w: message %v: %v", errDecode, msg, err)
|
||||
}
|
||||
response := ServiceGetNodeDataQuery(backend.Chain(), backend.StateBloom(), query.GetNodeDataPacket)
|
||||
response := ServiceGetNodeDataQuery(backend.Chain(), query.GetNodeDataPacket)
|
||||
return peer.ReplyNodeData(query.RequestId, response)
|
||||
}
|
||||
|
||||
// ServiceGetNodeDataQuery assembles the response to a node data query. It is
|
||||
// exposed to allow external packages to test protocol behavior.
|
||||
func ServiceGetNodeDataQuery(chain *core.BlockChain, bloom *trie.SyncBloom, query GetNodeDataPacket) [][]byte {
|
||||
func ServiceGetNodeDataQuery(chain *core.BlockChain, query GetNodeDataPacket) [][]byte {
|
||||
// Gather state data until the fetch or network limits is reached
|
||||
var (
|
||||
bytes int
|
||||
@ -182,10 +182,6 @@ func ServiceGetNodeDataQuery(chain *core.BlockChain, bloom *trie.SyncBloom, quer
|
||||
break
|
||||
}
|
||||
// Retrieve the requested state entry
|
||||
if bloom != nil && !bloom.Contains(hash[:]) {
|
||||
// Only lookup the trie node if there's chance that we actually have it
|
||||
continue
|
||||
}
|
||||
entry, err := chain.TrieNode(hash)
|
||||
if len(entry) == 0 || err != nil {
|
||||
// Read the contract code with prefix only to save unnecessary lookups.
|
||||
|
@ -546,7 +546,7 @@ func (s *Syncer) Sync(root common.Hash, cancel chan struct{}) error {
|
||||
s.lock.Lock()
|
||||
s.root = root
|
||||
s.healer = &healTask{
|
||||
scheduler: state.NewStateSync(root, s.db, nil, s.onHealState),
|
||||
scheduler: state.NewStateSync(root, s.db, s.onHealState),
|
||||
trieTasks: make(map[common.Hash]trie.SyncPath),
|
||||
codeTasks: make(map[common.Hash]struct{}),
|
||||
}
|
||||
|
Reference in New Issue
Block a user