mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 02:42:27 +00:00
fix
This commit is contained in:
parent
6986095f81
commit
1a4887bd43
2 changed files with 2 additions and 9 deletions
|
|
@ -1332,14 +1332,13 @@ func testBeaconForkedSyncProgress(t *testing.T, protocol uint, mode SyncMode) {
|
||||||
defer tester.terminate()
|
defer tester.terminate()
|
||||||
|
|
||||||
chainA := testChainForkLightA.shorten(len(testChainBase.blocks) + MaxHeaderFetch)
|
chainA := testChainForkLightA.shorten(len(testChainBase.blocks) + MaxHeaderFetch)
|
||||||
chainB := testChainForkHigher.shorten(len(testChainBase.blocks) + MaxHeaderFetch)
|
chainB := testChainForkLightB.shorten(len(testChainBase.blocks) + MaxHeaderFetch)
|
||||||
|
|
||||||
// Set a sync init hook to catch progress changes
|
// Set a sync init hook to catch progress changes
|
||||||
starting := make(chan struct{})
|
starting := make(chan struct{})
|
||||||
progress := make(chan struct{})
|
progress := make(chan struct{})
|
||||||
|
|
||||||
tester.downloader.syncInitHook = func(origin, latest uint64) {
|
tester.downloader.syncInitHook = func(origin, latest uint64) {
|
||||||
fmt.Println("sync init")
|
|
||||||
starting <- struct{}{}
|
starting <- struct{}{}
|
||||||
<-progress
|
<-progress
|
||||||
}
|
}
|
||||||
|
|
@ -1368,7 +1367,6 @@ func testBeaconForkedSyncProgress(t *testing.T, protocol uint, mode SyncMode) {
|
||||||
t.Fatalf("Failed to sync chain in three seconds")
|
t.Fatalf("Failed to sync chain in three seconds")
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println("jump in")
|
|
||||||
log.SetDefault(log.NewLogger(log.NewTerminalHandlerWithLevel(os.Stdout, log.LevelInfo, false)))
|
log.SetDefault(log.NewLogger(log.NewTerminalHandlerWithLevel(os.Stdout, log.LevelInfo, false)))
|
||||||
// Set the head to a second fork (which forks after the origin of the last sync cycle
|
// Set the head to a second fork (which forks after the origin of the last sync cycle
|
||||||
tester.newPeer("fork B", protocol, chainB.blocks[1:])
|
tester.newPeer("fork B", protocol, chainB.blocks[1:])
|
||||||
|
|
|
||||||
|
|
@ -53,9 +53,6 @@ var testChainBase *testChain
|
||||||
// Different forks on top of the base chain:
|
// Different forks on top of the base chain:
|
||||||
var testChainForkLightA, testChainForkLightB, testChainForkHeavy *testChain
|
var testChainForkLightA, testChainForkLightB, testChainForkHeavy *testChain
|
||||||
|
|
||||||
// Fork from base chain, fork occurs 10 blocks later than other forks
|
|
||||||
var testChainForkHigher *testChain
|
|
||||||
|
|
||||||
var pregenerated bool
|
var pregenerated bool
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|
@ -72,11 +69,10 @@ func init() {
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
|
|
||||||
// Generate the test chains to seed the peers with
|
// Generate the test chains to seed the peers with
|
||||||
wg.Add(4)
|
wg.Add(3)
|
||||||
go func() { testChainForkLightA = testChainBase.makeFork(forkLen, false, 1); wg.Done() }()
|
go func() { testChainForkLightA = testChainBase.makeFork(forkLen, false, 1); wg.Done() }()
|
||||||
go func() { testChainForkLightB = testChainBase.makeFork(forkLen, false, 2); wg.Done() }()
|
go func() { testChainForkLightB = testChainBase.makeFork(forkLen, false, 2); wg.Done() }()
|
||||||
go func() { testChainForkHeavy = testChainBase.makeFork(forkLen, true, 3); wg.Done() }()
|
go func() { testChainForkHeavy = testChainBase.makeFork(forkLen, true, 3); wg.Done() }()
|
||||||
go func() { testChainForkHigher = testChainBase.makeFork(forkLen-10, false, 3); wg.Done() }()
|
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
|
|
||||||
// Generate the test peers used by the tests to avoid overloading during testing.
|
// Generate the test peers used by the tests to avoid overloading during testing.
|
||||||
|
|
@ -107,7 +103,6 @@ func init() {
|
||||||
testChainForkLightA.shorten(len(testChainBase.blocks) + MaxHeaderFetch),
|
testChainForkLightA.shorten(len(testChainBase.blocks) + MaxHeaderFetch),
|
||||||
testChainForkLightB.shorten(len(testChainBase.blocks) + MaxHeaderFetch),
|
testChainForkLightB.shorten(len(testChainBase.blocks) + MaxHeaderFetch),
|
||||||
testChainForkHeavy.shorten(len(testChainBase.blocks) + 79),
|
testChainForkHeavy.shorten(len(testChainBase.blocks) + 79),
|
||||||
testChainForkHigher.shorten(len(testChainBase.blocks) + MaxHeaderFetch),
|
|
||||||
}
|
}
|
||||||
wg.Add(len(chains))
|
wg.Add(len(chains))
|
||||||
for _, chain := range chains {
|
for _, chain := range chains {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue