@@ -413,8 +413,11 @@ func (p *Peer) RequestOneHeader(hash common.Hash) error {
413413 Reverse : false ,
414414 }
415415 if p .Version () >= ETH66 {
416+ id := rand .Uint64 ()
417+
418+ requestTracker .Track (p .id , p .version , GetBlockHeadersMsg , BlockHeadersMsg , id )
416419 return p2p .Send (p .rw , GetBlockHeadersMsg , & GetBlockHeadersPacket66 {
417- RequestId : rand . Uint64 () ,
420+ RequestId : id ,
418421 GetBlockHeadersPacket : & query ,
419422 })
420423 }
@@ -432,8 +435,11 @@ func (p *Peer) RequestHeadersByHash(origin common.Hash, amount int, skip int, re
432435 Reverse : reverse ,
433436 }
434437 if p .Version () >= ETH66 {
438+ id := rand .Uint64 ()
439+
440+ requestTracker .Track (p .id , p .version , GetBlockHeadersMsg , BlockHeadersMsg , id )
435441 return p2p .Send (p .rw , GetBlockHeadersMsg , & GetBlockHeadersPacket66 {
436- RequestId : rand . Uint64 () ,
442+ RequestId : id ,
437443 GetBlockHeadersPacket : & query ,
438444 })
439445 }
@@ -451,8 +457,11 @@ func (p *Peer) RequestHeadersByNumber(origin uint64, amount int, skip int, rever
451457 Reverse : reverse ,
452458 }
453459 if p .Version () >= ETH66 {
460+ id := rand .Uint64 ()
461+
462+ requestTracker .Track (p .id , p .version , GetBlockHeadersMsg , BlockHeadersMsg , id )
454463 return p2p .Send (p .rw , GetBlockHeadersMsg , & GetBlockHeadersPacket66 {
455- RequestId : rand . Uint64 () ,
464+ RequestId : id ,
456465 GetBlockHeadersPacket : & query ,
457466 })
458467 }
@@ -476,8 +485,11 @@ func (p *Peer) ExpectRequestHeadersByNumber(origin uint64, amount int, skip int,
476485func (p * Peer ) RequestBodies (hashes []common.Hash ) error {
477486 p .Log ().Debug ("Fetching batch of block bodies" , "count" , len (hashes ))
478487 if p .Version () >= ETH66 {
488+ id := rand .Uint64 ()
489+
490+ requestTracker .Track (p .id , p .version , GetBlockBodiesMsg , BlockBodiesMsg , id )
479491 return p2p .Send (p .rw , GetBlockBodiesMsg , & GetBlockBodiesPacket66 {
480- RequestId : rand . Uint64 () ,
492+ RequestId : id ,
481493 GetBlockBodiesPacket : hashes ,
482494 })
483495 }
@@ -489,8 +501,11 @@ func (p *Peer) RequestBodies(hashes []common.Hash) error {
489501func (p * Peer ) RequestNodeData (hashes []common.Hash ) error {
490502 p .Log ().Debug ("Fetching batch of state data" , "count" , len (hashes ))
491503 if p .Version () >= ETH66 {
504+ id := rand .Uint64 ()
505+
506+ requestTracker .Track (p .id , p .version , GetNodeDataMsg , NodeDataMsg , id )
492507 return p2p .Send (p .rw , GetNodeDataMsg , & GetNodeDataPacket66 {
493- RequestId : rand . Uint64 () ,
508+ RequestId : id ,
494509 GetNodeDataPacket : hashes ,
495510 })
496511 }
@@ -501,8 +516,11 @@ func (p *Peer) RequestNodeData(hashes []common.Hash) error {
501516func (p * Peer ) RequestReceipts (hashes []common.Hash ) error {
502517 p .Log ().Debug ("Fetching batch of receipts" , "count" , len (hashes ))
503518 if p .Version () >= ETH66 {
519+ id := rand .Uint64 ()
520+
521+ requestTracker .Track (p .id , p .version , GetReceiptsMsg , ReceiptsMsg , id )
504522 return p2p .Send (p .rw , GetReceiptsMsg , & GetReceiptsPacket66 {
505- RequestId : rand . Uint64 () ,
523+ RequestId : id ,
506524 GetReceiptsPacket : hashes ,
507525 })
508526 }
@@ -513,8 +531,11 @@ func (p *Peer) RequestReceipts(hashes []common.Hash) error {
513531func (p * Peer ) RequestTxs (hashes []common.Hash ) error {
514532 p .Log ().Debug ("Fetching batch of transactions" , "count" , len (hashes ))
515533 if p .Version () >= ETH66 {
534+ id := rand .Uint64 ()
535+
536+ requestTracker .Track (p .id , p .version , GetPooledTransactionsMsg , PooledTransactionsMsg , id )
516537 return p2p .Send (p .rw , GetPooledTransactionsMsg , & GetPooledTransactionsPacket66 {
517- RequestId : rand . Uint64 () ,
538+ RequestId : id ,
518539 GetPooledTransactionsPacket : hashes ,
519540 })
520541 }
0 commit comments