@@ -194,7 +194,7 @@ func TestSequentialAnnouncements(t *testing.T) {
194194 tester .fetcher .importedHook = func (block * types.Block ) { imported <- block }
195195
196196 for i := len (hashes ) - 2 ; i >= 0 ; i -- {
197- tester .fetcher .Notify ("valid" , hashes [i ], time .Now ().Add (- arriveTimeout ), fetcher )
197+ tester .fetcher .Notify ("valid" , hashes [i ], 0 , time .Now ().Add (- arriveTimeout ), fetcher )
198198 verifyImportEvent (t , imported )
199199 }
200200 verifyImportDone (t , imported )
@@ -221,9 +221,9 @@ func TestConcurrentAnnouncements(t *testing.T) {
221221 tester .fetcher .importedHook = func (block * types.Block ) { imported <- block }
222222
223223 for i := len (hashes ) - 2 ; i >= 0 ; i -- {
224- tester .fetcher .Notify ("first" , hashes [i ], time .Now ().Add (- arriveTimeout ), wrapper )
225- tester .fetcher .Notify ("second" , hashes [i ], time .Now ().Add (- arriveTimeout + time .Millisecond ), wrapper )
226- tester .fetcher .Notify ("second" , hashes [i ], time .Now ().Add (- arriveTimeout - time .Millisecond ), wrapper )
224+ tester .fetcher .Notify ("first" , hashes [i ], 0 , time .Now ().Add (- arriveTimeout ), wrapper )
225+ tester .fetcher .Notify ("second" , hashes [i ], 0 , time .Now ().Add (- arriveTimeout + time .Millisecond ), wrapper )
226+ tester .fetcher .Notify ("second" , hashes [i ], 0 , time .Now ().Add (- arriveTimeout - time .Millisecond ), wrapper )
227227
228228 verifyImportEvent (t , imported )
229229 }
@@ -252,7 +252,7 @@ func TestOverlappingAnnouncements(t *testing.T) {
252252 tester .fetcher .importedHook = func (block * types.Block ) { imported <- block }
253253
254254 for i := len (hashes ) - 2 ; i >= 0 ; i -- {
255- tester .fetcher .Notify ("valid" , hashes [i ], time .Now ().Add (- arriveTimeout ), fetcher )
255+ tester .fetcher .Notify ("valid" , hashes [i ], 0 , time .Now ().Add (- arriveTimeout ), fetcher )
256256 select {
257257 case <- fetching :
258258 case <- time .After (time .Second ):
@@ -286,7 +286,7 @@ func TestPendingDeduplication(t *testing.T) {
286286 }
287287 // Announce the same block many times until it's fetched (wait for any pending ops)
288288 for tester .getBlock (hashes [0 ]) == nil {
289- tester .fetcher .Notify ("repeater" , hashes [0 ], time .Now ().Add (- arriveTimeout ), wrapper )
289+ tester .fetcher .Notify ("repeater" , hashes [0 ], 0 , time .Now ().Add (- arriveTimeout ), wrapper )
290290 time .Sleep (time .Millisecond )
291291 }
292292 time .Sleep (delay )
@@ -317,12 +317,12 @@ func TestRandomArrivalImport(t *testing.T) {
317317
318318 for i := len (hashes ) - 1 ; i >= 0 ; i -- {
319319 if i != skip {
320- tester .fetcher .Notify ("valid" , hashes [i ], time .Now ().Add (- arriveTimeout ), fetcher )
320+ tester .fetcher .Notify ("valid" , hashes [i ], 0 , time .Now ().Add (- arriveTimeout ), fetcher )
321321 time .Sleep (time .Millisecond )
322322 }
323323 }
324324 // Finally announce the skipped entry and check full import
325- tester .fetcher .Notify ("valid" , hashes [skip ], time .Now ().Add (- arriveTimeout ), fetcher )
325+ tester .fetcher .Notify ("valid" , hashes [skip ], 0 , time .Now ().Add (- arriveTimeout ), fetcher )
326326 verifyImportCount (t , imported , len (hashes )- 1 )
327327}
328328
@@ -343,7 +343,7 @@ func TestQueueGapFill(t *testing.T) {
343343
344344 for i := len (hashes ) - 1 ; i >= 0 ; i -- {
345345 if i != skip {
346- tester .fetcher .Notify ("valid" , hashes [i ], time .Now ().Add (- arriveTimeout ), fetcher )
346+ tester .fetcher .Notify ("valid" , hashes [i ], 0 , time .Now ().Add (- arriveTimeout ), fetcher )
347347 time .Sleep (time .Millisecond )
348348 }
349349 }
@@ -374,7 +374,7 @@ func TestImportDeduplication(t *testing.T) {
374374 tester .fetcher .importedHook = func (block * types.Block ) { imported <- block }
375375
376376 // Announce the duplicating block, wait for retrieval, and also propagate directly
377- tester .fetcher .Notify ("valid" , hashes [0 ], time .Now ().Add (- arriveTimeout ), fetcher )
377+ tester .fetcher .Notify ("valid" , hashes [0 ], 0 , time .Now ().Add (- arriveTimeout ), fetcher )
378378 <- fetching
379379
380380 tester .fetcher .Enqueue ("valid" , blocks [hashes [0 ]])
@@ -437,9 +437,9 @@ func TestHashMemoryExhaustionAttack(t *testing.T) {
437437 // Feed the tester a huge hashset from the attacker, and a limited from the valid peer
438438 for i := 0 ; i < len (attack ); i ++ {
439439 if i < maxQueueDist {
440- tester .fetcher .Notify ("valid" , hashes [len (hashes )- 2 - i ], time .Now (), valid )
440+ tester .fetcher .Notify ("valid" , hashes [len (hashes )- 2 - i ], 0 , time .Now (), valid )
441441 }
442- tester .fetcher .Notify ("attacker" , attack [i ], time .Now (), attacker )
442+ tester .fetcher .Notify ("attacker" , attack [i ], 0 , time .Now (), attacker )
443443 }
444444 if len (tester .fetcher .announced ) != hashLimit + maxQueueDist {
445445 t .Fatalf ("queued announce count mismatch: have %d, want %d" , len (tester .fetcher .announced ), hashLimit + maxQueueDist )
@@ -449,7 +449,7 @@ func TestHashMemoryExhaustionAttack(t *testing.T) {
449449
450450 // Feed the remaining valid hashes to ensure DOS protection state remains clean
451451 for i := len (hashes ) - maxQueueDist - 2 ; i >= 0 ; i -- {
452- tester .fetcher .Notify ("valid" , hashes [i ], time .Now ().Add (- arriveTimeout ), valid )
452+ tester .fetcher .Notify ("valid" , hashes [i ], 0 , time .Now ().Add (- arriveTimeout ), valid )
453453 verifyImportEvent (t , imported )
454454 }
455455 verifyImportDone (t , imported )
0 commit comments