@@ -76,7 +76,7 @@ func newTesterWithNotification(t *testing.T, success func()) *downloadTester {
76
76
chain : chain ,
77
77
peers : make (map [string ]* downloadTesterPeer ),
78
78
}
79
- tester .downloader = New (db , new (event.TypeMux ), tester .chain , nil , tester .dropPeer , success )
79
+ tester .downloader = New (db , new (event.TypeMux ), tester .chain , tester .dropPeer , success )
80
80
return tester
81
81
}
82
82
@@ -384,9 +384,6 @@ func assertOwnChain(t *testing.T, tester *downloadTester, length int) {
384
384
t .Helper ()
385
385
386
386
headers , blocks , receipts := length , length , length
387
- if tester .downloader .getMode () == LightSync {
388
- blocks , receipts = 1 , 1
389
- }
390
387
if hs := int (tester .chain .CurrentHeader ().Number .Uint64 ()) + 1 ; hs != headers {
391
388
t .Fatalf ("synchronised headers mismatch: have %v, want %v" , hs , headers )
392
389
}
@@ -398,9 +395,8 @@ func assertOwnChain(t *testing.T, tester *downloadTester, length int) {
398
395
}
399
396
}
400
397
401
- func TestCanonicalSynchronisation68Full (t * testing.T ) { testCanonSync (t , eth .ETH68 , FullSync ) }
402
- func TestCanonicalSynchronisation68Snap (t * testing.T ) { testCanonSync (t , eth .ETH68 , SnapSync ) }
403
- func TestCanonicalSynchronisation68Light (t * testing.T ) { testCanonSync (t , eth .ETH68 , LightSync ) }
398
+ func TestCanonicalSynchronisation68Full (t * testing.T ) { testCanonSync (t , eth .ETH68 , FullSync ) }
399
+ func TestCanonicalSynchronisation68Snap (t * testing.T ) { testCanonSync (t , eth .ETH68 , SnapSync ) }
404
400
405
401
func testCanonSync (t * testing.T , protocol uint , mode SyncMode ) {
406
402
success := make (chan struct {})
@@ -505,9 +501,8 @@ func testThrottling(t *testing.T, protocol uint, mode SyncMode) {
505
501
}
506
502
507
503
// Tests that a canceled download wipes all previously accumulated state.
508
- func TestCancel68Full (t * testing.T ) { testCancel (t , eth .ETH68 , FullSync ) }
509
- func TestCancel68Snap (t * testing.T ) { testCancel (t , eth .ETH68 , SnapSync ) }
510
- func TestCancel68Light (t * testing.T ) { testCancel (t , eth .ETH68 , LightSync ) }
504
+ func TestCancel68Full (t * testing.T ) { testCancel (t , eth .ETH68 , FullSync ) }
505
+ func TestCancel68Snap (t * testing.T ) { testCancel (t , eth .ETH68 , SnapSync ) }
511
506
512
507
func testCancel (t * testing.T , protocol uint , mode SyncMode ) {
513
508
complete := make (chan struct {})
@@ -538,9 +533,8 @@ func testCancel(t *testing.T, protocol uint, mode SyncMode) {
538
533
539
534
// Tests that synchronisations behave well in multi-version protocol environments
540
535
// and not wreak havoc on other nodes in the network.
541
- func TestMultiProtoSynchronisation68Full (t * testing.T ) { testMultiProtoSync (t , eth .ETH68 , FullSync ) }
542
- func TestMultiProtoSynchronisation68Snap (t * testing.T ) { testMultiProtoSync (t , eth .ETH68 , SnapSync ) }
543
- func TestMultiProtoSynchronisation68Light (t * testing.T ) { testMultiProtoSync (t , eth .ETH68 , LightSync ) }
536
+ func TestMultiProtoSynchronisation68Full (t * testing.T ) { testMultiProtoSync (t , eth .ETH68 , FullSync ) }
537
+ func TestMultiProtoSynchronisation68Snap (t * testing.T ) { testMultiProtoSync (t , eth .ETH68 , SnapSync ) }
544
538
545
539
func testMultiProtoSync (t * testing.T , protocol uint , mode SyncMode ) {
546
540
complete := make (chan struct {})
@@ -578,9 +572,8 @@ func testMultiProtoSync(t *testing.T, protocol uint, mode SyncMode) {
578
572
579
573
// Tests that if a block is empty (e.g. header only), no body request should be
580
574
// made, and instead the header should be assembled into a whole block in itself.
581
- func TestEmptyShortCircuit68Full (t * testing.T ) { testEmptyShortCircuit (t , eth .ETH68 , FullSync ) }
582
- func TestEmptyShortCircuit68Snap (t * testing.T ) { testEmptyShortCircuit (t , eth .ETH68 , SnapSync ) }
583
- func TestEmptyShortCircuit68Light (t * testing.T ) { testEmptyShortCircuit (t , eth .ETH68 , LightSync ) }
575
+ func TestEmptyShortCircuit68Full (t * testing.T ) { testEmptyShortCircuit (t , eth .ETH68 , FullSync ) }
576
+ func TestEmptyShortCircuit68Snap (t * testing.T ) { testEmptyShortCircuit (t , eth .ETH68 , SnapSync ) }
584
577
585
578
func testEmptyShortCircuit (t * testing.T , protocol uint , mode SyncMode ) {
586
579
success := make (chan struct {})
@@ -619,7 +612,7 @@ func testEmptyShortCircuit(t *testing.T, protocol uint, mode SyncMode) {
619
612
// Validate the number of block bodies that should have been requested
620
613
bodiesNeeded , receiptsNeeded := 0 , 0
621
614
for _ , block := range chain .blocks [1 :] {
622
- if mode != LightSync && ( len (block .Transactions ()) > 0 || len (block .Uncles ()) > 0 ) {
615
+ if len (block .Transactions ()) > 0 || len (block .Uncles ()) > 0 {
623
616
bodiesNeeded ++
624
617
}
625
618
}
@@ -694,9 +687,8 @@ func testBeaconSync(t *testing.T, protocol uint, mode SyncMode) {
694
687
695
688
// Tests that synchronisation progress (origin block number, current block number
696
689
// and highest block number) is tracked and updated correctly.
697
- func TestSyncProgress68Full (t * testing.T ) { testSyncProgress (t , eth .ETH68 , FullSync ) }
698
- func TestSyncProgress68Snap (t * testing.T ) { testSyncProgress (t , eth .ETH68 , SnapSync ) }
699
- func TestSyncProgress68Light (t * testing.T ) { testSyncProgress (t , eth .ETH68 , LightSync ) }
690
+ func TestSyncProgress68Full (t * testing.T ) { testSyncProgress (t , eth .ETH68 , FullSync ) }
691
+ func TestSyncProgress68Snap (t * testing.T ) { testSyncProgress (t , eth .ETH68 , SnapSync ) }
700
692
701
693
func testSyncProgress (t * testing.T , protocol uint , mode SyncMode ) {
702
694
success := make (chan struct {})
@@ -734,17 +726,7 @@ func testSyncProgress(t *testing.T, protocol uint, mode SyncMode) {
734
726
if err := tester .downloader .BeaconSync (mode , chain .blocks [len (chain .blocks )- 1 ].Header (), nil ); err != nil {
735
727
t .Fatalf ("failed to beacon-sync chain: %v" , err )
736
728
}
737
- var startingBlock uint64
738
- if mode == LightSync {
739
- // in light-sync mode:
740
- // * the starting block is 0 on the second sync cycle because blocks
741
- // are never downloaded.
742
- // * The current/highest blocks reported in the progress reflect the
743
- // current/highest header.
744
- startingBlock = 0
745
- } else {
746
- startingBlock = uint64 (len (chain .blocks )/ 2 - 1 )
747
- }
729
+ startingBlock := uint64 (len (chain .blocks )/ 2 - 1 )
748
730
749
731
select {
750
732
case <- success :
0 commit comments