@@ -129,19 +129,17 @@ type Sync struct {
129
129
codeReqs map [common.Hash ]* request // Pending requests pertaining to a code hash
130
130
queue * prque.Prque [int64 , any ] // Priority queue with the pending requests
131
131
fetches map [int ]int // Number of active fetches per trie node depth
132
- bloom * SyncBloom // Bloom filter for fast state existence checks
133
132
}
134
133
135
134
// NewSync creates a new trie data download scheduler.
136
- func NewSync (root common.Hash , database ethdb.KeyValueReader , callback LeafCallback , bloom * SyncBloom ) * Sync {
135
+ func NewSync (root common.Hash , database ethdb.KeyValueReader , callback LeafCallback ) * Sync {
137
136
ts := & Sync {
138
137
database : database ,
139
138
membatch : newSyncMemBatch (),
140
139
nodeReqs : make (map [common.Hash ]* request ),
141
140
codeReqs : make (map [common.Hash ]* request ),
142
141
queue : prque.New [int64 , any ](nil ), // Ugh, can contain both string and hash, whyyy
143
142
fetches : make (map [int ]int ),
144
- bloom : bloom ,
145
143
}
146
144
ts .AddSubTrie (root , nil , common.Hash {}, callback )
147
145
return ts
@@ -156,16 +154,11 @@ func (s *Sync) AddSubTrie(root common.Hash, path []byte, parent common.Hash, cal
156
154
if s .membatch .hasNode (root ) {
157
155
return
158
156
}
159
- if s .bloom == nil || s .bloom .Contains (root [:]) {
160
- // Bloom filter says this might be a duplicate, double check.
161
- // If database says yes, then at least the trie node is present
162
- // and we hold the assumption that it's NOT legacy contract code.
163
- blob := rawdb .ReadTrieNode (s .database , root )
164
- if len (blob ) > 0 {
165
- return
166
- }
167
- // False positive, bump fault meter
168
- bloomFaultMeter .Mark (1 )
157
+ // If database says this is a duplicate, then at least the trie node is
158
+ // present, and we hold the assumption that it's NOT legacy contract code.
159
+ blob := rawdb .ReadTrieNode (s .database , root )
160
+ if len (blob ) > 0 {
161
+ return
169
162
}
170
163
// Assemble the new sub-trie sync request
171
164
req := & request {
@@ -196,18 +189,13 @@ func (s *Sync) AddCodeEntry(hash common.Hash, path []byte, parent common.Hash) {
196
189
if s .membatch .hasCode (hash ) {
197
190
return
198
191
}
199
- if s .bloom == nil || s .bloom .Contains (hash [:]) {
200
- // Bloom filter says this might be a duplicate, double check.
201
- // If database says yes, the blob is present for sure.
202
- // Note we only check the existence with new code scheme, fast
203
- // sync is expected to run with a fresh new node. Even there
204
- // exists the code with legacy format, fetch and store with
205
- // new scheme anyway.
206
- if blob := rawdb .ReadCodeWithPrefix (s .database , hash ); len (blob ) > 0 {
207
- return
208
- }
209
- // False positive, bump fault meter
210
- bloomFaultMeter .Mark (1 )
192
+ // If database says duplicate, the blob is present for sure.
193
+ // Note we only check the existence with new code scheme, fast
194
+ // sync is expected to run with a fresh new node. Even there
195
+ // exists the code with legacy format, fetch and store with
196
+ // new scheme anyway.
197
+ if blob := rawdb .ReadCodeWithPrefix (s .database , hash ); len (blob ) > 0 {
198
+ return
211
199
}
212
200
// Assemble the new sub-trie sync request
213
201
req := & request {
@@ -314,15 +302,9 @@ func (s *Sync) Commit(dbw ethdb.Batch) error {
314
302
// Dump the membatch into a database dbw
315
303
for key , value := range s .membatch .nodes {
316
304
rawdb .WriteTrieNode (dbw , key , value )
317
- if s .bloom != nil {
318
- s .bloom .Add (key [:])
319
- }
320
305
}
321
306
for key , value := range s .membatch .codes {
322
307
rawdb .WriteCode (dbw , key , value )
323
- if s .bloom != nil {
324
- s .bloom .Add (key [:])
325
- }
326
308
}
327
309
// Drop the membatch data and return
328
310
s .membatch = newSyncMemBatch ()
@@ -418,15 +400,10 @@ func (s *Sync) children(req *request, object node) ([]*request, error) {
418
400
if s .membatch .hasNode (hash ) {
419
401
continue
420
402
}
421
- if s .bloom == nil || s .bloom .Contains (node ) {
422
- // Bloom filter says this might be a duplicate, double check.
423
- // If database says yes, then at least the trie node is present
424
- // and we hold the assumption that it's NOT legacy contract code.
425
- if blob := rawdb .ReadTrieNode (s .database , common .BytesToHash (node )); len (blob ) > 0 {
426
- continue
427
- }
428
- // False positive, bump fault meter
429
- bloomFaultMeter .Mark (1 )
403
+ // If database says duplicate, then at least the trie node is present
404
+ // and we hold the assumption that it's NOT legacy contract code.
405
+ if blob := rawdb .ReadTrieNode (s .database , hash ); len (blob ) > 0 {
406
+ continue
430
407
}
431
408
// Locally unknown Node, schedule for retrieval
432
409
requests = append (requests , & request {
0 commit comments