mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
eth/downloader: try to fix tests
This commit is contained in:
parent
525f499c96
commit
c290f11e57
1 changed files with 2 additions and 3 deletions
|
|
@ -624,7 +624,6 @@ func testForkedSync(t *testing.T, protocol int, mode SyncMode) {
|
||||||
chainB := testChainForkLightB.shorten(testChainBase.len() + 80)
|
chainB := testChainForkLightB.shorten(testChainBase.len() + 80)
|
||||||
tester.newPeer("fork A", protocol, chainA)
|
tester.newPeer("fork A", protocol, chainA)
|
||||||
tester.newPeer("fork B", protocol, chainB)
|
tester.newPeer("fork B", protocol, chainB)
|
||||||
|
|
||||||
// Synchronise with the peer and make sure all blocks were retrieved
|
// Synchronise with the peer and make sure all blocks were retrieved
|
||||||
if err := tester.sync("fork A", nil, mode); err != nil {
|
if err := tester.sync("fork A", nil, mode); err != nil {
|
||||||
t.Fatalf("failed to synchronise blocks: %v", err)
|
t.Fatalf("failed to synchronise blocks: %v", err)
|
||||||
|
|
@ -1002,7 +1001,6 @@ func testInvalidHeaderRollback(t *testing.T, protocol int, mode SyncMode) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
tester := newTester()
|
tester := newTester()
|
||||||
defer tester.terminate()
|
|
||||||
|
|
||||||
// Create a small enough block chain to download
|
// Create a small enough block chain to download
|
||||||
targetBlocks := 3*fsHeaderSafetyNet + 256 + fsMinFullBlocks
|
targetBlocks := 3*fsHeaderSafetyNet + 256 + fsMinFullBlocks
|
||||||
|
|
@ -1082,6 +1080,7 @@ func testInvalidHeaderRollback(t *testing.T, protocol int, mode SyncMode) {
|
||||||
t.Fatalf("synchronised blocks mismatch: have %v, want %v", bs, chain.len())
|
t.Fatalf("synchronised blocks mismatch: have %v, want %v", bs, chain.len())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
tester.terminate()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tests that a peer advertising an high TD doesn't get to stall the downloader
|
// Tests that a peer advertising an high TD doesn't get to stall the downloader
|
||||||
|
|
@ -1097,13 +1096,13 @@ func testHighTDStarvationAttack(t *testing.T, protocol int, mode SyncMode) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
tester := newTester()
|
tester := newTester()
|
||||||
defer tester.terminate()
|
|
||||||
|
|
||||||
chain := testChainBase.shorten(1)
|
chain := testChainBase.shorten(1)
|
||||||
tester.newPeer("attack", protocol, chain)
|
tester.newPeer("attack", protocol, chain)
|
||||||
if err := tester.sync("attack", big.NewInt(1000000), mode); err != errStallingPeer {
|
if err := tester.sync("attack", big.NewInt(1000000), mode); err != errStallingPeer {
|
||||||
t.Fatalf("synchronisation error mismatch: have %v, want %v", err, errStallingPeer)
|
t.Fatalf("synchronisation error mismatch: have %v, want %v", err, errStallingPeer)
|
||||||
}
|
}
|
||||||
|
tester.terminate()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tests that misbehaving peers are disconnected, whilst behaving ones are not.
|
// Tests that misbehaving peers are disconnected, whilst behaving ones are not.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue