@@ -492,15 +492,6 @@ func (d *Downloader) fetchHeight61(p *peer) (uint64, error) {
492
492
case <- d .cancelCh :
493
493
return 0 , errCancelBlockFetch
494
494
495
- case <- d .headerCh :
496
- // Out of bounds eth/62 block headers received, ignore them
497
-
498
- case <- d .bodyCh :
499
- // Out of bounds eth/62 block bodies received, ignore them
500
-
501
- case <- d .hashCh :
502
- // Out of bounds hashes received, ignore them
503
-
504
495
case packet := <- d .blockCh :
505
496
// Discard anything not from the origin peer
506
497
if packet .PeerId () != p .id {
@@ -518,6 +509,16 @@ func (d *Downloader) fetchHeight61(p *peer) (uint64, error) {
518
509
case <- timeout :
519
510
glog .V (logger .Debug ).Infof ("%v: head block timeout" , p )
520
511
return 0 , errTimeout
512
+
513
+ case <- d .hashCh :
514
+ // Out of bounds hashes received, ignore them
515
+
516
+ case <- d .headerCh :
517
+ case <- d .bodyCh :
518
+ case <- d .stateCh :
519
+ case <- d .receiptCh :
520
+ // Ignore eth/{62,63} packets because this is eth/61.
521
+ // These can arrive as a late delivery from a previous sync.
521
522
}
522
523
}
523
524
}
@@ -568,18 +569,19 @@ func (d *Downloader) findAncestor61(p *peer) (uint64, error) {
568
569
}
569
570
}
570
571
572
+ case <- timeout :
573
+ glog .V (logger .Debug ).Infof ("%v: head hash timeout" , p )
574
+ return 0 , errTimeout
575
+
571
576
case <- d .blockCh :
572
577
// Out of bounds blocks received, ignore them
573
578
574
579
case <- d .headerCh :
575
- // Out of bounds eth/62 block headers received, ignore them
576
-
577
580
case <- d .bodyCh :
578
- // Out of bounds eth/62 block bodies received, ignore them
579
-
580
- case <- timeout :
581
- glog .V (logger .Debug ).Infof ("%v: head hash timeout" , p )
582
- return 0 , errTimeout
581
+ case <- d .stateCh :
582
+ case <- d .receiptCh :
583
+ // Ignore eth/{62,63} packets because this is eth/61.
584
+ // These can arrive as a late delivery from a previous sync.
583
585
}
584
586
}
585
587
// If the head fetch already found an ancestor, return
@@ -628,18 +630,19 @@ func (d *Downloader) findAncestor61(p *peer) (uint64, error) {
628
630
}
629
631
start = check
630
632
633
+ case <- timeout :
634
+ glog .V (logger .Debug ).Infof ("%v: search hash timeout" , p )
635
+ return 0 , errTimeout
636
+
631
637
case <- d .blockCh :
632
638
// Out of bounds blocks received, ignore them
633
639
634
640
case <- d .headerCh :
635
- // Out of bounds eth/62 block headers received, ignore them
636
-
637
641
case <- d .bodyCh :
638
- // Out of bounds eth/62 block bodies received, ignore them
639
-
640
- case <- timeout :
641
- glog .V (logger .Debug ).Infof ("%v: search hash timeout" , p )
642
- return 0 , errTimeout
642
+ case <- d .stateCh :
643
+ case <- d .receiptCh :
644
+ // Ignore eth/{62,63} packets because this is eth/61.
645
+ // These can arrive as a late delivery from a previous sync.
643
646
}
644
647
}
645
648
}
@@ -673,12 +676,6 @@ func (d *Downloader) fetchHashes61(p *peer, td *big.Int, from uint64) error {
673
676
case <- d .cancelCh :
674
677
return errCancelHashFetch
675
678
676
- case <- d .headerCh :
677
- // Out of bounds eth/62 block headers received, ignore them
678
-
679
- case <- d .bodyCh :
680
- // Out of bounds eth/62 block bodies received, ignore them
681
-
682
679
case packet := <- d .hashCh :
683
680
// Make sure the active peer is giving us the hashes
684
681
if packet .PeerId () != p .id {
@@ -747,6 +744,13 @@ func (d *Downloader) fetchHashes61(p *peer, td *big.Int, from uint64) error {
747
744
glog .V (logger .Debug ).Infof ("%v: hash request timed out" , p )
748
745
hashTimeoutMeter .Mark (1 )
749
746
return errTimeout
747
+
748
+ case <- d .headerCh :
749
+ case <- d .bodyCh :
750
+ case <- d .stateCh :
751
+ case <- d .receiptCh :
752
+ // Ignore eth/{62,63} packets because this is eth/61.
753
+ // These can arrive as a late delivery from a previous sync.
750
754
}
751
755
}
752
756
}
@@ -771,12 +775,6 @@ func (d *Downloader) fetchBlocks61(from uint64) error {
771
775
case <- d .cancelCh :
772
776
return errCancelBlockFetch
773
777
774
- case <- d .headerCh :
775
- // Out of bounds eth/62 block headers received, ignore them
776
-
777
- case <- d .bodyCh :
778
- // Out of bounds eth/62 block bodies received, ignore them
779
-
780
778
case packet := <- d .blockCh :
781
779
// If the peer was previously banned and failed to deliver it's pack
782
780
// in a reasonable time frame, ignore it's message.
@@ -904,6 +902,13 @@ func (d *Downloader) fetchBlocks61(from uint64) error {
904
902
if ! throttled && ! d .queue .InFlightBlocks () && len (idles ) == total {
905
903
return errPeersUnavailable
906
904
}
905
+
906
+ case <- d .headerCh :
907
+ case <- d .bodyCh :
908
+ case <- d .stateCh :
909
+ case <- d .receiptCh :
910
+ // Ignore eth/{62,63} packets because this is eth/61.
911
+ // These can arrive as a late delivery from a previous sync.
907
912
}
908
913
}
909
914
}
@@ -936,18 +941,19 @@ func (d *Downloader) fetchHeight(p *peer) (uint64, error) {
936
941
}
937
942
return headers [0 ].Number .Uint64 (), nil
938
943
944
+ case <- timeout :
945
+ glog .V (logger .Debug ).Infof ("%v: head header timeout" , p )
946
+ return 0 , errTimeout
947
+
939
948
case <- d .bodyCh :
940
- // Out of bounds block bodies received, ignore them
949
+ case <- d .stateCh :
950
+ case <- d .receiptCh :
951
+ // Out of bounds delivery, ignore
941
952
942
953
case <- d .hashCh :
943
- // Out of bounds eth/61 hashes received, ignore them
944
-
945
954
case <- d .blockCh :
946
- // Out of bounds eth/61 blocks received, ignore them
947
-
948
- case <- timeout :
949
- glog .V (logger .Debug ).Infof ("%v: head header timeout" , p )
950
- return 0 , errTimeout
955
+ // Ignore eth/61 packets because this is eth/62+.
956
+ // These can arrive as a late delivery from a previous sync.
951
957
}
952
958
}
953
959
}
@@ -1003,18 +1009,19 @@ func (d *Downloader) findAncestor(p *peer) (uint64, error) {
1003
1009
}
1004
1010
}
1005
1011
1012
+ case <- timeout :
1013
+ glog .V (logger .Debug ).Infof ("%v: head header timeout" , p )
1014
+ return 0 , errTimeout
1015
+
1006
1016
case <- d .bodyCh :
1007
- // Out of bounds block bodies received, ignore them
1017
+ case <- d .stateCh :
1018
+ case <- d .receiptCh :
1019
+ // Out of bounds delivery, ignore
1008
1020
1009
1021
case <- d .hashCh :
1010
- // Out of bounds eth/61 hashes received, ignore them
1011
-
1012
1022
case <- d .blockCh :
1013
- // Out of bounds eth/61 blocks received, ignore them
1014
-
1015
- case <- timeout :
1016
- glog .V (logger .Debug ).Infof ("%v: head header timeout" , p )
1017
- return 0 , errTimeout
1023
+ // Ignore eth/61 packets because this is eth/62+.
1024
+ // These can arrive as a late delivery from a previous sync.
1018
1025
}
1019
1026
}
1020
1027
// If the head fetch already found an ancestor, return
@@ -1063,18 +1070,19 @@ func (d *Downloader) findAncestor(p *peer) (uint64, error) {
1063
1070
}
1064
1071
start = check
1065
1072
1073
+ case <- timeout :
1074
+ glog .V (logger .Debug ).Infof ("%v: search header timeout" , p )
1075
+ return 0 , errTimeout
1076
+
1066
1077
case <- d .bodyCh :
1067
- // Out of bounds block bodies received, ignore them
1078
+ case <- d .stateCh :
1079
+ case <- d .receiptCh :
1080
+ // Out of bounds delivery, ignore
1068
1081
1069
1082
case <- d .hashCh :
1070
- // Out of bounds eth/61 hashes received, ignore them
1071
-
1072
1083
case <- d .blockCh :
1073
- // Out of bounds eth/61 blocks received, ignore them
1074
-
1075
- case <- timeout :
1076
- glog .V (logger .Debug ).Infof ("%v: search header timeout" , p )
1077
- return 0 , errTimeout
1084
+ // Ignore eth/61 packets because this is eth/62+.
1085
+ // These can arrive as a late delivery from a previous sync.
1078
1086
}
1079
1087
}
1080
1088
}
@@ -1136,12 +1144,6 @@ func (d *Downloader) fetchHeaders(p *peer, td *big.Int, from uint64) error {
1136
1144
case <- d .cancelCh :
1137
1145
return errCancelHeaderFetch
1138
1146
1139
- case <- d .hashCh :
1140
- // Out of bounds eth/61 hashes received, ignore them
1141
-
1142
- case <- d .blockCh :
1143
- // Out of bounds eth/61 blocks received, ignore them
1144
-
1145
1147
case packet := <- d .headerCh :
1146
1148
// Make sure the active peer is giving us the headers
1147
1149
if packet .PeerId () != p .id {
@@ -1263,6 +1265,11 @@ func (d *Downloader) fetchHeaders(p *peer, td *big.Int, from uint64) error {
1263
1265
}
1264
1266
}
1265
1267
return nil
1268
+
1269
+ case <- d .hashCh :
1270
+ case <- d .blockCh :
1271
+ // Ignore eth/61 packets because this is eth/62+.
1272
+ // These can arrive as a late delivery from a previous sync.
1266
1273
}
1267
1274
}
1268
1275
}
@@ -1383,12 +1390,6 @@ func (d *Downloader) fetchParts(errCancel error, deliveryCh chan dataPack, deliv
1383
1390
case <- d .cancelCh :
1384
1391
return errCancel
1385
1392
1386
- case <- d .hashCh :
1387
- // Out of bounds eth/61 hashes received, ignore them
1388
-
1389
- case <- d .blockCh :
1390
- // Out of bounds eth/61 blocks received, ignore them
1391
-
1392
1393
case packet := <- deliveryCh :
1393
1394
// If the peer was previously banned and failed to deliver it's pack
1394
1395
// in a reasonable time frame, ignore it's message.
@@ -1529,6 +1530,11 @@ func (d *Downloader) fetchParts(errCancel error, deliveryCh chan dataPack, deliv
1529
1530
if ! progressed && ! throttled && ! running && len (idles ) == total && pending () > 0 {
1530
1531
return errPeersUnavailable
1531
1532
}
1533
+
1534
+ case <- d .hashCh :
1535
+ case <- d .blockCh :
1536
+ // Ignore eth/61 packets because this is eth/62+.
1537
+ // These can arrive as a late delivery from a previous sync.
1532
1538
}
1533
1539
}
1534
1540
}
0 commit comments