@@ -413,8 +413,11 @@ func (p *Peer) RequestOneHeader(hash common.Hash) error {
413
413
Reverse : false ,
414
414
}
415
415
if p .Version () >= ETH66 {
416
+ id := rand .Uint64 ()
417
+
418
+ requestTracker .Track (p .id , p .version , GetBlockHeadersMsg , BlockHeadersMsg , id )
416
419
return p2p .Send (p .rw , GetBlockHeadersMsg , & GetBlockHeadersPacket66 {
417
- RequestId : rand . Uint64 () ,
420
+ RequestId : id ,
418
421
GetBlockHeadersPacket : & query ,
419
422
})
420
423
}
@@ -432,8 +435,11 @@ func (p *Peer) RequestHeadersByHash(origin common.Hash, amount int, skip int, re
432
435
Reverse : reverse ,
433
436
}
434
437
if p .Version () >= ETH66 {
438
+ id := rand .Uint64 ()
439
+
440
+ requestTracker .Track (p .id , p .version , GetBlockHeadersMsg , BlockHeadersMsg , id )
435
441
return p2p .Send (p .rw , GetBlockHeadersMsg , & GetBlockHeadersPacket66 {
436
- RequestId : rand . Uint64 () ,
442
+ RequestId : id ,
437
443
GetBlockHeadersPacket : & query ,
438
444
})
439
445
}
@@ -451,8 +457,11 @@ func (p *Peer) RequestHeadersByNumber(origin uint64, amount int, skip int, rever
451
457
Reverse : reverse ,
452
458
}
453
459
if p .Version () >= ETH66 {
460
+ id := rand .Uint64 ()
461
+
462
+ requestTracker .Track (p .id , p .version , GetBlockHeadersMsg , BlockHeadersMsg , id )
454
463
return p2p .Send (p .rw , GetBlockHeadersMsg , & GetBlockHeadersPacket66 {
455
- RequestId : rand . Uint64 () ,
464
+ RequestId : id ,
456
465
GetBlockHeadersPacket : & query ,
457
466
})
458
467
}
@@ -476,8 +485,11 @@ func (p *Peer) ExpectRequestHeadersByNumber(origin uint64, amount int, skip int,
476
485
func (p * Peer ) RequestBodies (hashes []common.Hash ) error {
477
486
p .Log ().Debug ("Fetching batch of block bodies" , "count" , len (hashes ))
478
487
if p .Version () >= ETH66 {
488
+ id := rand .Uint64 ()
489
+
490
+ requestTracker .Track (p .id , p .version , GetBlockBodiesMsg , BlockBodiesMsg , id )
479
491
return p2p .Send (p .rw , GetBlockBodiesMsg , & GetBlockBodiesPacket66 {
480
- RequestId : rand . Uint64 () ,
492
+ RequestId : id ,
481
493
GetBlockBodiesPacket : hashes ,
482
494
})
483
495
}
@@ -489,8 +501,11 @@ func (p *Peer) RequestBodies(hashes []common.Hash) error {
489
501
func (p * Peer ) RequestNodeData (hashes []common.Hash ) error {
490
502
p .Log ().Debug ("Fetching batch of state data" , "count" , len (hashes ))
491
503
if p .Version () >= ETH66 {
504
+ id := rand .Uint64 ()
505
+
506
+ requestTracker .Track (p .id , p .version , GetNodeDataMsg , NodeDataMsg , id )
492
507
return p2p .Send (p .rw , GetNodeDataMsg , & GetNodeDataPacket66 {
493
- RequestId : rand . Uint64 () ,
508
+ RequestId : id ,
494
509
GetNodeDataPacket : hashes ,
495
510
})
496
511
}
@@ -501,8 +516,11 @@ func (p *Peer) RequestNodeData(hashes []common.Hash) error {
501
516
func (p * Peer ) RequestReceipts (hashes []common.Hash ) error {
502
517
p .Log ().Debug ("Fetching batch of receipts" , "count" , len (hashes ))
503
518
if p .Version () >= ETH66 {
519
+ id := rand .Uint64 ()
520
+
521
+ requestTracker .Track (p .id , p .version , GetReceiptsMsg , ReceiptsMsg , id )
504
522
return p2p .Send (p .rw , GetReceiptsMsg , & GetReceiptsPacket66 {
505
- RequestId : rand . Uint64 () ,
523
+ RequestId : id ,
506
524
GetReceiptsPacket : hashes ,
507
525
})
508
526
}
@@ -513,8 +531,11 @@ func (p *Peer) RequestReceipts(hashes []common.Hash) error {
513
531
func (p * Peer ) RequestTxs (hashes []common.Hash ) error {
514
532
p .Log ().Debug ("Fetching batch of transactions" , "count" , len (hashes ))
515
533
if p .Version () >= ETH66 {
534
+ id := rand .Uint64 ()
535
+
536
+ requestTracker .Track (p .id , p .version , GetPooledTransactionsMsg , PooledTransactionsMsg , id )
516
537
return p2p .Send (p .rw , GetPooledTransactionsMsg , & GetPooledTransactionsPacket66 {
517
- RequestId : rand . Uint64 () ,
538
+ RequestId : id ,
518
539
GetPooledTransactionsPacket : hashes ,
519
540
})
520
541
}
0 commit comments