|
|
|
@ -30,6 +30,7 @@ import ( |
|
|
|
|
"github.com/ethereum/go-ethereum/common" |
|
|
|
|
"github.com/ethereum/go-ethereum/core/rawdb" |
|
|
|
|
"github.com/ethereum/go-ethereum/core/types" |
|
|
|
|
"github.com/ethereum/go-ethereum/eth/protocols/eth" |
|
|
|
|
"github.com/ethereum/go-ethereum/ethdb" |
|
|
|
|
"github.com/ethereum/go-ethereum/event" |
|
|
|
|
"github.com/ethereum/go-ethereum/trie" |
|
|
|
@ -515,16 +516,13 @@ func assertOwnForkedChain(t *testing.T, tester *downloadTester, common int, leng |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func TestCanonicalSynchronisation64Full(t *testing.T) { testCanonSync(t, 64, FullSync) } |
|
|
|
|
func TestCanonicalSynchronisation64Fast(t *testing.T) { testCanonSync(t, 64, FastSync) } |
|
|
|
|
func TestCanonicalSynchronisation65Full(t *testing.T) { testCanonSync(t, eth.ETH65, FullSync) } |
|
|
|
|
func TestCanonicalSynchronisation65Fast(t *testing.T) { testCanonSync(t, eth.ETH65, FastSync) } |
|
|
|
|
func TestCanonicalSynchronisation65Light(t *testing.T) { testCanonSync(t, eth.ETH65, LightSync) } |
|
|
|
|
|
|
|
|
|
func TestCanonicalSynchronisation65Full(t *testing.T) { testCanonSync(t, 65, FullSync) } |
|
|
|
|
func TestCanonicalSynchronisation65Fast(t *testing.T) { testCanonSync(t, 65, FastSync) } |
|
|
|
|
func TestCanonicalSynchronisation65Light(t *testing.T) { testCanonSync(t, 65, LightSync) } |
|
|
|
|
|
|
|
|
|
func TestCanonicalSynchronisation66Full(t *testing.T) { testCanonSync(t, 66, FullSync) } |
|
|
|
|
func TestCanonicalSynchronisation66Fast(t *testing.T) { testCanonSync(t, 66, FastSync) } |
|
|
|
|
func TestCanonicalSynchronisation66Light(t *testing.T) { testCanonSync(t, 66, LightSync) } |
|
|
|
|
func TestCanonicalSynchronisation66Full(t *testing.T) { testCanonSync(t, eth.ETH66, FullSync) } |
|
|
|
|
func TestCanonicalSynchronisation66Fast(t *testing.T) { testCanonSync(t, eth.ETH66, FastSync) } |
|
|
|
|
func TestCanonicalSynchronisation66Light(t *testing.T) { testCanonSync(t, eth.ETH66, LightSync) } |
|
|
|
|
|
|
|
|
|
func testCanonSync(t *testing.T, protocol uint, mode SyncMode) { |
|
|
|
|
t.Parallel() |
|
|
|
@ -545,14 +543,11 @@ func testCanonSync(t *testing.T, protocol uint, mode SyncMode) { |
|
|
|
|
|
|
|
|
|
// Tests that if a large batch of blocks are being downloaded, it is throttled
|
|
|
|
|
// until the cached blocks are retrieved.
|
|
|
|
|
func TestThrottling64Full(t *testing.T) { testThrottling(t, 64, FullSync) } |
|
|
|
|
func TestThrottling64Fast(t *testing.T) { testThrottling(t, 64, FastSync) } |
|
|
|
|
|
|
|
|
|
func TestThrottling65Full(t *testing.T) { testThrottling(t, 65, FullSync) } |
|
|
|
|
func TestThrottling65Fast(t *testing.T) { testThrottling(t, 65, FastSync) } |
|
|
|
|
func TestThrottling65Full(t *testing.T) { testThrottling(t, eth.ETH65, FullSync) } |
|
|
|
|
func TestThrottling65Fast(t *testing.T) { testThrottling(t, eth.ETH65, FastSync) } |
|
|
|
|
|
|
|
|
|
func TestThrottling66Full(t *testing.T) { testThrottling(t, 66, FullSync) } |
|
|
|
|
func TestThrottling66Fast(t *testing.T) { testThrottling(t, 66, FastSync) } |
|
|
|
|
func TestThrottling66Full(t *testing.T) { testThrottling(t, eth.ETH66, FullSync) } |
|
|
|
|
func TestThrottling66Fast(t *testing.T) { testThrottling(t, eth.ETH66, FastSync) } |
|
|
|
|
|
|
|
|
|
func testThrottling(t *testing.T, protocol uint, mode SyncMode) { |
|
|
|
|
t.Parallel() |
|
|
|
@ -633,16 +628,13 @@ func testThrottling(t *testing.T, protocol uint, mode SyncMode) { |
|
|
|
|
// Tests that simple synchronization against a forked chain works correctly. In
|
|
|
|
|
// this test common ancestor lookup should *not* be short circuited, and a full
|
|
|
|
|
// binary search should be executed.
|
|
|
|
|
func TestForkedSync64Full(t *testing.T) { testForkedSync(t, 64, FullSync) } |
|
|
|
|
func TestForkedSync64Fast(t *testing.T) { testForkedSync(t, 64, FastSync) } |
|
|
|
|
|
|
|
|
|
func TestForkedSync65Full(t *testing.T) { testForkedSync(t, 65, FullSync) } |
|
|
|
|
func TestForkedSync65Fast(t *testing.T) { testForkedSync(t, 65, FastSync) } |
|
|
|
|
func TestForkedSync65Light(t *testing.T) { testForkedSync(t, 65, LightSync) } |
|
|
|
|
func TestForkedSync65Full(t *testing.T) { testForkedSync(t, eth.ETH65, FullSync) } |
|
|
|
|
func TestForkedSync65Fast(t *testing.T) { testForkedSync(t, eth.ETH65, FastSync) } |
|
|
|
|
func TestForkedSync65Light(t *testing.T) { testForkedSync(t, eth.ETH65, LightSync) } |
|
|
|
|
|
|
|
|
|
func TestForkedSync66Full(t *testing.T) { testForkedSync(t, 66, FullSync) } |
|
|
|
|
func TestForkedSync66Fast(t *testing.T) { testForkedSync(t, 66, FastSync) } |
|
|
|
|
func TestForkedSync66Light(t *testing.T) { testForkedSync(t, 66, LightSync) } |
|
|
|
|
func TestForkedSync66Full(t *testing.T) { testForkedSync(t, eth.ETH66, FullSync) } |
|
|
|
|
func TestForkedSync66Fast(t *testing.T) { testForkedSync(t, eth.ETH66, FastSync) } |
|
|
|
|
func TestForkedSync66Light(t *testing.T) { testForkedSync(t, eth.ETH66, LightSync) } |
|
|
|
|
|
|
|
|
|
func testForkedSync(t *testing.T, protocol uint, mode SyncMode) { |
|
|
|
|
t.Parallel() |
|
|
|
@ -669,16 +661,13 @@ func testForkedSync(t *testing.T, protocol uint, mode SyncMode) { |
|
|
|
|
|
|
|
|
|
// Tests that synchronising against a much shorter but much heavyer fork works
|
|
|
|
|
// corrently and is not dropped.
|
|
|
|
|
func TestHeavyForkedSync64Full(t *testing.T) { testHeavyForkedSync(t, 64, FullSync) } |
|
|
|
|
func TestHeavyForkedSync64Fast(t *testing.T) { testHeavyForkedSync(t, 64, FastSync) } |
|
|
|
|
func TestHeavyForkedSync65Full(t *testing.T) { testHeavyForkedSync(t, eth.ETH65, FullSync) } |
|
|
|
|
func TestHeavyForkedSync65Fast(t *testing.T) { testHeavyForkedSync(t, eth.ETH65, FastSync) } |
|
|
|
|
func TestHeavyForkedSync65Light(t *testing.T) { testHeavyForkedSync(t, eth.ETH65, LightSync) } |
|
|
|
|
|
|
|
|
|
func TestHeavyForkedSync65Full(t *testing.T) { testHeavyForkedSync(t, 65, FullSync) } |
|
|
|
|
func TestHeavyForkedSync65Fast(t *testing.T) { testHeavyForkedSync(t, 65, FastSync) } |
|
|
|
|
func TestHeavyForkedSync65Light(t *testing.T) { testHeavyForkedSync(t, 65, LightSync) } |
|
|
|
|
|
|
|
|
|
func TestHeavyForkedSync66Full(t *testing.T) { testHeavyForkedSync(t, 66, FullSync) } |
|
|
|
|
func TestHeavyForkedSync66Fast(t *testing.T) { testHeavyForkedSync(t, 66, FastSync) } |
|
|
|
|
func TestHeavyForkedSync66Light(t *testing.T) { testHeavyForkedSync(t, 66, LightSync) } |
|
|
|
|
func TestHeavyForkedSync66Full(t *testing.T) { testHeavyForkedSync(t, eth.ETH66, FullSync) } |
|
|
|
|
func TestHeavyForkedSync66Fast(t *testing.T) { testHeavyForkedSync(t, eth.ETH66, FastSync) } |
|
|
|
|
func TestHeavyForkedSync66Light(t *testing.T) { testHeavyForkedSync(t, eth.ETH66, LightSync) } |
|
|
|
|
|
|
|
|
|
func testHeavyForkedSync(t *testing.T, protocol uint, mode SyncMode) { |
|
|
|
|
t.Parallel() |
|
|
|
@ -707,16 +696,13 @@ func testHeavyForkedSync(t *testing.T, protocol uint, mode SyncMode) { |
|
|
|
|
// Tests that chain forks are contained within a certain interval of the current
|
|
|
|
|
// chain head, ensuring that malicious peers cannot waste resources by feeding
|
|
|
|
|
// long dead chains.
|
|
|
|
|
func TestBoundedForkedSync64Full(t *testing.T) { testBoundedForkedSync(t, 64, FullSync) } |
|
|
|
|
func TestBoundedForkedSync64Fast(t *testing.T) { testBoundedForkedSync(t, 64, FastSync) } |
|
|
|
|
|
|
|
|
|
func TestBoundedForkedSync65Full(t *testing.T) { testBoundedForkedSync(t, 65, FullSync) } |
|
|
|
|
func TestBoundedForkedSync65Fast(t *testing.T) { testBoundedForkedSync(t, 65, FastSync) } |
|
|
|
|
func TestBoundedForkedSync65Light(t *testing.T) { testBoundedForkedSync(t, 65, LightSync) } |
|
|
|
|
func TestBoundedForkedSync65Full(t *testing.T) { testBoundedForkedSync(t, eth.ETH65, FullSync) } |
|
|
|
|
func TestBoundedForkedSync65Fast(t *testing.T) { testBoundedForkedSync(t, eth.ETH65, FastSync) } |
|
|
|
|
func TestBoundedForkedSync65Light(t *testing.T) { testBoundedForkedSync(t, eth.ETH65, LightSync) } |
|
|
|
|
|
|
|
|
|
func TestBoundedForkedSync66Full(t *testing.T) { testBoundedForkedSync(t, 66, FullSync) } |
|
|
|
|
func TestBoundedForkedSync66Fast(t *testing.T) { testBoundedForkedSync(t, 66, FastSync) } |
|
|
|
|
func TestBoundedForkedSync66Light(t *testing.T) { testBoundedForkedSync(t, 66, LightSync) } |
|
|
|
|
func TestBoundedForkedSync66Full(t *testing.T) { testBoundedForkedSync(t, eth.ETH66, FullSync) } |
|
|
|
|
func TestBoundedForkedSync66Fast(t *testing.T) { testBoundedForkedSync(t, eth.ETH66, FastSync) } |
|
|
|
|
func TestBoundedForkedSync66Light(t *testing.T) { testBoundedForkedSync(t, eth.ETH66, LightSync) } |
|
|
|
|
|
|
|
|
|
func testBoundedForkedSync(t *testing.T, protocol uint, mode SyncMode) { |
|
|
|
|
t.Parallel() |
|
|
|
@ -744,16 +730,25 @@ func testBoundedForkedSync(t *testing.T, protocol uint, mode SyncMode) { |
|
|
|
|
// Tests that chain forks are contained within a certain interval of the current
|
|
|
|
|
// chain head for short but heavy forks too. These are a bit special because they
|
|
|
|
|
// take different ancestor lookup paths.
|
|
|
|
|
func TestBoundedHeavyForkedSync64Full(t *testing.T) { testBoundedHeavyForkedSync(t, 64, FullSync) } |
|
|
|
|
func TestBoundedHeavyForkedSync64Fast(t *testing.T) { testBoundedHeavyForkedSync(t, 64, FastSync) } |
|
|
|
|
|
|
|
|
|
func TestBoundedHeavyForkedSync65Full(t *testing.T) { testBoundedHeavyForkedSync(t, 65, FullSync) } |
|
|
|
|
func TestBoundedHeavyForkedSync65Fast(t *testing.T) { testBoundedHeavyForkedSync(t, 65, FastSync) } |
|
|
|
|
func TestBoundedHeavyForkedSync65Light(t *testing.T) { testBoundedHeavyForkedSync(t, 65, LightSync) } |
|
|
|
|
func TestBoundedHeavyForkedSync65Full(t *testing.T) { |
|
|
|
|
testBoundedHeavyForkedSync(t, eth.ETH65, FullSync) |
|
|
|
|
} |
|
|
|
|
func TestBoundedHeavyForkedSync65Fast(t *testing.T) { |
|
|
|
|
testBoundedHeavyForkedSync(t, eth.ETH65, FastSync) |
|
|
|
|
} |
|
|
|
|
func TestBoundedHeavyForkedSync65Light(t *testing.T) { |
|
|
|
|
testBoundedHeavyForkedSync(t, eth.ETH65, LightSync) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func TestBoundedHeavyForkedSync66Full(t *testing.T) { testBoundedHeavyForkedSync(t, 66, FullSync) } |
|
|
|
|
func TestBoundedHeavyForkedSync66Fast(t *testing.T) { testBoundedHeavyForkedSync(t, 66, FastSync) } |
|
|
|
|
func TestBoundedHeavyForkedSync66Light(t *testing.T) { testBoundedHeavyForkedSync(t, 66, LightSync) } |
|
|
|
|
func TestBoundedHeavyForkedSync66Full(t *testing.T) { |
|
|
|
|
testBoundedHeavyForkedSync(t, eth.ETH66, FullSync) |
|
|
|
|
} |
|
|
|
|
func TestBoundedHeavyForkedSync66Fast(t *testing.T) { |
|
|
|
|
testBoundedHeavyForkedSync(t, eth.ETH66, FastSync) |
|
|
|
|
} |
|
|
|
|
func TestBoundedHeavyForkedSync66Light(t *testing.T) { |
|
|
|
|
testBoundedHeavyForkedSync(t, eth.ETH66, LightSync) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func testBoundedHeavyForkedSync(t *testing.T, protocol uint, mode SyncMode) { |
|
|
|
|
t.Parallel() |
|
|
|
@ -799,16 +794,13 @@ func TestInactiveDownloader63(t *testing.T) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Tests that a canceled download wipes all previously accumulated state.
|
|
|
|
|
func TestCancel64Full(t *testing.T) { testCancel(t, 64, FullSync) } |
|
|
|
|
func TestCancel64Fast(t *testing.T) { testCancel(t, 64, FastSync) } |
|
|
|
|
|
|
|
|
|
func TestCancel65Full(t *testing.T) { testCancel(t, 65, FullSync) } |
|
|
|
|
func TestCancel65Fast(t *testing.T) { testCancel(t, 65, FastSync) } |
|
|
|
|
func TestCancel65Light(t *testing.T) { testCancel(t, 65, LightSync) } |
|
|
|
|
func TestCancel65Full(t *testing.T) { testCancel(t, eth.ETH65, FullSync) } |
|
|
|
|
func TestCancel65Fast(t *testing.T) { testCancel(t, eth.ETH65, FastSync) } |
|
|
|
|
func TestCancel65Light(t *testing.T) { testCancel(t, eth.ETH65, LightSync) } |
|
|
|
|
|
|
|
|
|
func TestCancel66Full(t *testing.T) { testCancel(t, 66, FullSync) } |
|
|
|
|
func TestCancel66Fast(t *testing.T) { testCancel(t, 66, FastSync) } |
|
|
|
|
func TestCancel66Light(t *testing.T) { testCancel(t, 66, LightSync) } |
|
|
|
|
func TestCancel66Full(t *testing.T) { testCancel(t, eth.ETH66, FullSync) } |
|
|
|
|
func TestCancel66Fast(t *testing.T) { testCancel(t, eth.ETH66, FastSync) } |
|
|
|
|
func TestCancel66Light(t *testing.T) { testCancel(t, eth.ETH66, LightSync) } |
|
|
|
|
|
|
|
|
|
func testCancel(t *testing.T, protocol uint, mode SyncMode) { |
|
|
|
|
t.Parallel() |
|
|
|
@ -835,16 +827,13 @@ func testCancel(t *testing.T, protocol uint, mode SyncMode) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Tests that synchronisation from multiple peers works as intended (multi thread sanity test).
|
|
|
|
|
func TestMultiSynchronisation64Full(t *testing.T) { testMultiSynchronisation(t, 64, FullSync) } |
|
|
|
|
func TestMultiSynchronisation64Fast(t *testing.T) { testMultiSynchronisation(t, 64, FastSync) } |
|
|
|
|
func TestMultiSynchronisation65Full(t *testing.T) { testMultiSynchronisation(t, eth.ETH65, FullSync) } |
|
|
|
|
func TestMultiSynchronisation65Fast(t *testing.T) { testMultiSynchronisation(t, eth.ETH65, FastSync) } |
|
|
|
|
func TestMultiSynchronisation65Light(t *testing.T) { testMultiSynchronisation(t, eth.ETH65, LightSync) } |
|
|
|
|
|
|
|
|
|
func TestMultiSynchronisation65Full(t *testing.T) { testMultiSynchronisation(t, 65, FullSync) } |
|
|
|
|
func TestMultiSynchronisation65Fast(t *testing.T) { testMultiSynchronisation(t, 65, FastSync) } |
|
|
|
|
func TestMultiSynchronisation65Light(t *testing.T) { testMultiSynchronisation(t, 65, LightSync) } |
|
|
|
|
|
|
|
|
|
func TestMultiSynchronisation66Full(t *testing.T) { testMultiSynchronisation(t, 66, FullSync) } |
|
|
|
|
func TestMultiSynchronisation66Fast(t *testing.T) { testMultiSynchronisation(t, 66, FastSync) } |
|
|
|
|
func TestMultiSynchronisation66Light(t *testing.T) { testMultiSynchronisation(t, 66, LightSync) } |
|
|
|
|
func TestMultiSynchronisation66Full(t *testing.T) { testMultiSynchronisation(t, eth.ETH66, FullSync) } |
|
|
|
|
func TestMultiSynchronisation66Fast(t *testing.T) { testMultiSynchronisation(t, eth.ETH66, FastSync) } |
|
|
|
|
func TestMultiSynchronisation66Light(t *testing.T) { testMultiSynchronisation(t, eth.ETH66, LightSync) } |
|
|
|
|
|
|
|
|
|
func testMultiSynchronisation(t *testing.T, protocol uint, mode SyncMode) { |
|
|
|
|
t.Parallel() |
|
|
|
@ -868,16 +857,13 @@ func testMultiSynchronisation(t *testing.T, protocol uint, mode SyncMode) { |
|
|
|
|
|
|
|
|
|
// Tests that synchronisations behave well in multi-version protocol environments
|
|
|
|
|
// and not wreak havoc on other nodes in the network.
|
|
|
|
|
func TestMultiProtoSynchronisation64Full(t *testing.T) { testMultiProtoSync(t, 64, FullSync) } |
|
|
|
|
func TestMultiProtoSynchronisation64Fast(t *testing.T) { testMultiProtoSync(t, 64, FastSync) } |
|
|
|
|
|
|
|
|
|
func TestMultiProtoSynchronisation65Full(t *testing.T) { testMultiProtoSync(t, 65, FullSync) } |
|
|
|
|
func TestMultiProtoSynchronisation65Fast(t *testing.T) { testMultiProtoSync(t, 65, FastSync) } |
|
|
|
|
func TestMultiProtoSynchronisation65Light(t *testing.T) { testMultiProtoSync(t, 65, LightSync) } |
|
|
|
|
func TestMultiProtoSynchronisation65Full(t *testing.T) { testMultiProtoSync(t, eth.ETH65, FullSync) } |
|
|
|
|
func TestMultiProtoSynchronisation65Fast(t *testing.T) { testMultiProtoSync(t, eth.ETH65, FastSync) } |
|
|
|
|
func TestMultiProtoSynchronisation65Light(t *testing.T) { testMultiProtoSync(t, eth.ETH65, LightSync) } |
|
|
|
|
|
|
|
|
|
func TestMultiProtoSynchronisation66Full(t *testing.T) { testMultiProtoSync(t, 66, FullSync) } |
|
|
|
|
func TestMultiProtoSynchronisation66Fast(t *testing.T) { testMultiProtoSync(t, 66, FastSync) } |
|
|
|
|
func TestMultiProtoSynchronisation66Light(t *testing.T) { testMultiProtoSync(t, 66, LightSync) } |
|
|
|
|
func TestMultiProtoSynchronisation66Full(t *testing.T) { testMultiProtoSync(t, eth.ETH66, FullSync) } |
|
|
|
|
func TestMultiProtoSynchronisation66Fast(t *testing.T) { testMultiProtoSync(t, eth.ETH66, FastSync) } |
|
|
|
|
func TestMultiProtoSynchronisation66Light(t *testing.T) { testMultiProtoSync(t, eth.ETH66, LightSync) } |
|
|
|
|
|
|
|
|
|
func testMultiProtoSync(t *testing.T, protocol uint, mode SyncMode) { |
|
|
|
|
t.Parallel() |
|
|
|
@ -889,9 +875,8 @@ func testMultiProtoSync(t *testing.T, protocol uint, mode SyncMode) { |
|
|
|
|
chain := testChainBase.shorten(blockCacheMaxItems - 15) |
|
|
|
|
|
|
|
|
|
// Create peers of every type
|
|
|
|
|
tester.newPeer("peer 64", 64, chain) |
|
|
|
|
tester.newPeer("peer 65", 65, chain) |
|
|
|
|
tester.newPeer("peer 66", 66, chain) |
|
|
|
|
tester.newPeer("peer 65", eth.ETH65, chain) |
|
|
|
|
tester.newPeer("peer 66", eth.ETH66, chain) |
|
|
|
|
|
|
|
|
|
// Synchronise with the requested peer and make sure all blocks were retrieved
|
|
|
|
|
if err := tester.sync(fmt.Sprintf("peer %d", protocol), nil, mode); err != nil { |
|
|
|
@ -900,7 +885,7 @@ func testMultiProtoSync(t *testing.T, protocol uint, mode SyncMode) { |
|
|
|
|
assertOwnChain(t, tester, chain.len()) |
|
|
|
|
|
|
|
|
|
// Check that no peers have been dropped off
|
|
|
|
|
for _, version := range []int{64, 65, 66} { |
|
|
|
|
for _, version := range []int{65, 66} { |
|
|
|
|
peer := fmt.Sprintf("peer %d", version) |
|
|
|
|
if _, ok := tester.peers[peer]; !ok { |
|
|
|
|
t.Errorf("%s dropped", peer) |
|
|
|
@ -910,16 +895,13 @@ func testMultiProtoSync(t *testing.T, protocol uint, mode SyncMode) { |
|
|
|
|
|
|
|
|
|
// Tests that if a block is empty (e.g. header only), no body request should be
|
|
|
|
|
// made, and instead the header should be assembled into a whole block in itself.
|
|
|
|
|
func TestEmptyShortCircuit64Full(t *testing.T) { testEmptyShortCircuit(t, 64, FullSync) } |
|
|
|
|
func TestEmptyShortCircuit64Fast(t *testing.T) { testEmptyShortCircuit(t, 64, FastSync) } |
|
|
|
|
func TestEmptyShortCircuit65Full(t *testing.T) { testEmptyShortCircuit(t, eth.ETH65, FullSync) } |
|
|
|
|
func TestEmptyShortCircuit65Fast(t *testing.T) { testEmptyShortCircuit(t, eth.ETH65, FastSync) } |
|
|
|
|
func TestEmptyShortCircuit65Light(t *testing.T) { testEmptyShortCircuit(t, eth.ETH65, LightSync) } |
|
|
|
|
|
|
|
|
|
func TestEmptyShortCircuit65Full(t *testing.T) { testEmptyShortCircuit(t, 65, FullSync) } |
|
|
|
|
func TestEmptyShortCircuit65Fast(t *testing.T) { testEmptyShortCircuit(t, 65, FastSync) } |
|
|
|
|
func TestEmptyShortCircuit65Light(t *testing.T) { testEmptyShortCircuit(t, 65, LightSync) } |
|
|
|
|
|
|
|
|
|
func TestEmptyShortCircuit66Full(t *testing.T) { testEmptyShortCircuit(t, 66, FullSync) } |
|
|
|
|
func TestEmptyShortCircuit66Fast(t *testing.T) { testEmptyShortCircuit(t, 66, FastSync) } |
|
|
|
|
func TestEmptyShortCircuit66Light(t *testing.T) { testEmptyShortCircuit(t, 66, LightSync) } |
|
|
|
|
func TestEmptyShortCircuit66Full(t *testing.T) { testEmptyShortCircuit(t, eth.ETH66, FullSync) } |
|
|
|
|
func TestEmptyShortCircuit66Fast(t *testing.T) { testEmptyShortCircuit(t, eth.ETH66, FastSync) } |
|
|
|
|
func TestEmptyShortCircuit66Light(t *testing.T) { testEmptyShortCircuit(t, eth.ETH66, LightSync) } |
|
|
|
|
|
|
|
|
|
func testEmptyShortCircuit(t *testing.T, protocol uint, mode SyncMode) { |
|
|
|
|
t.Parallel() |
|
|
|
@ -967,16 +949,13 @@ func testEmptyShortCircuit(t *testing.T, protocol uint, mode SyncMode) { |
|
|
|
|
|
|
|
|
|
// Tests that headers are enqueued continuously, preventing malicious nodes from
|
|
|
|
|
// stalling the downloader by feeding gapped header chains.
|
|
|
|
|
func TestMissingHeaderAttack64Full(t *testing.T) { testMissingHeaderAttack(t, 64, FullSync) } |
|
|
|
|
func TestMissingHeaderAttack64Fast(t *testing.T) { testMissingHeaderAttack(t, 64, FastSync) } |
|
|
|
|
|
|
|
|
|
func TestMissingHeaderAttack65Full(t *testing.T) { testMissingHeaderAttack(t, 65, FullSync) } |
|
|
|
|
func TestMissingHeaderAttack65Fast(t *testing.T) { testMissingHeaderAttack(t, 65, FastSync) } |
|
|
|
|
func TestMissingHeaderAttack65Light(t *testing.T) { testMissingHeaderAttack(t, 65, LightSync) } |
|
|
|
|
func TestMissingHeaderAttack65Full(t *testing.T) { testMissingHeaderAttack(t, eth.ETH65, FullSync) } |
|
|
|
|
func TestMissingHeaderAttack65Fast(t *testing.T) { testMissingHeaderAttack(t, eth.ETH65, FastSync) } |
|
|
|
|
func TestMissingHeaderAttack65Light(t *testing.T) { testMissingHeaderAttack(t, eth.ETH65, LightSync) } |
|
|
|
|
|
|
|
|
|
func TestMissingHeaderAttack66Full(t *testing.T) { testMissingHeaderAttack(t, 66, FullSync) } |
|
|
|
|
func TestMissingHeaderAttack66Fast(t *testing.T) { testMissingHeaderAttack(t, 66, FastSync) } |
|
|
|
|
func TestMissingHeaderAttack66Light(t *testing.T) { testMissingHeaderAttack(t, 66, LightSync) } |
|
|
|
|
func TestMissingHeaderAttack66Full(t *testing.T) { testMissingHeaderAttack(t, eth.ETH66, FullSync) } |
|
|
|
|
func TestMissingHeaderAttack66Fast(t *testing.T) { testMissingHeaderAttack(t, eth.ETH66, FastSync) } |
|
|
|
|
func TestMissingHeaderAttack66Light(t *testing.T) { testMissingHeaderAttack(t, eth.ETH66, LightSync) } |
|
|
|
|
|
|
|
|
|
func testMissingHeaderAttack(t *testing.T, protocol uint, mode SyncMode) { |
|
|
|
|
t.Parallel() |
|
|
|
@ -1002,16 +981,13 @@ func testMissingHeaderAttack(t *testing.T, protocol uint, mode SyncMode) { |
|
|
|
|
|
|
|
|
|
// Tests that if requested headers are shifted (i.e. first is missing), the queue
|
|
|
|
|
// detects the invalid numbering.
|
|
|
|
|
func TestShiftedHeaderAttack64Full(t *testing.T) { testShiftedHeaderAttack(t, 64, FullSync) } |
|
|
|
|
func TestShiftedHeaderAttack64Fast(t *testing.T) { testShiftedHeaderAttack(t, 64, FastSync) } |
|
|
|
|
func TestShiftedHeaderAttack65Full(t *testing.T) { testShiftedHeaderAttack(t, eth.ETH65, FullSync) } |
|
|
|
|
func TestShiftedHeaderAttack65Fast(t *testing.T) { testShiftedHeaderAttack(t, eth.ETH65, FastSync) } |
|
|
|
|
func TestShiftedHeaderAttack65Light(t *testing.T) { testShiftedHeaderAttack(t, eth.ETH65, LightSync) } |
|
|
|
|
|
|
|
|
|
func TestShiftedHeaderAttack65Full(t *testing.T) { testShiftedHeaderAttack(t, 65, FullSync) } |
|
|
|
|
func TestShiftedHeaderAttack65Fast(t *testing.T) { testShiftedHeaderAttack(t, 65, FastSync) } |
|
|
|
|
func TestShiftedHeaderAttack65Light(t *testing.T) { testShiftedHeaderAttack(t, 65, LightSync) } |
|
|
|
|
|
|
|
|
|
func TestShiftedHeaderAttack66Full(t *testing.T) { testShiftedHeaderAttack(t, 66, FullSync) } |
|
|
|
|
func TestShiftedHeaderAttack66Fast(t *testing.T) { testShiftedHeaderAttack(t, 66, FastSync) } |
|
|
|
|
func TestShiftedHeaderAttack66Light(t *testing.T) { testShiftedHeaderAttack(t, 66, LightSync) } |
|
|
|
|
func TestShiftedHeaderAttack66Full(t *testing.T) { testShiftedHeaderAttack(t, eth.ETH66, FullSync) } |
|
|
|
|
func TestShiftedHeaderAttack66Fast(t *testing.T) { testShiftedHeaderAttack(t, eth.ETH66, FastSync) } |
|
|
|
|
func TestShiftedHeaderAttack66Light(t *testing.T) { testShiftedHeaderAttack(t, eth.ETH66, LightSync) } |
|
|
|
|
|
|
|
|
|
func testShiftedHeaderAttack(t *testing.T, protocol uint, mode SyncMode) { |
|
|
|
|
t.Parallel() |
|
|
|
@ -1042,9 +1018,8 @@ func testShiftedHeaderAttack(t *testing.T, protocol uint, mode SyncMode) { |
|
|
|
|
// Tests that upon detecting an invalid header, the recent ones are rolled back
|
|
|
|
|
// for various failure scenarios. Afterwards a full sync is attempted to make
|
|
|
|
|
// sure no state was corrupted.
|
|
|
|
|
func TestInvalidHeaderRollback64Fast(t *testing.T) { testInvalidHeaderRollback(t, 64, FastSync) } |
|
|
|
|
func TestInvalidHeaderRollback65Fast(t *testing.T) { testInvalidHeaderRollback(t, 65, FastSync) } |
|
|
|
|
func TestInvalidHeaderRollback66Fast(t *testing.T) { testInvalidHeaderRollback(t, 66, FastSync) } |
|
|
|
|
func TestInvalidHeaderRollback65Fast(t *testing.T) { testInvalidHeaderRollback(t, eth.ETH65, FastSync) } |
|
|
|
|
func TestInvalidHeaderRollback66Fast(t *testing.T) { testInvalidHeaderRollback(t, eth.ETH66, FastSync) } |
|
|
|
|
|
|
|
|
|
func testInvalidHeaderRollback(t *testing.T, protocol uint, mode SyncMode) { |
|
|
|
|
t.Parallel() |
|
|
|
@ -1134,16 +1109,25 @@ func testInvalidHeaderRollback(t *testing.T, protocol uint, mode SyncMode) { |
|
|
|
|
|
|
|
|
|
// Tests that a peer advertising a high TD doesn't get to stall the downloader
|
|
|
|
|
// afterwards by not sending any useful hashes.
|
|
|
|
|
func TestHighTDStarvationAttack64Full(t *testing.T) { testHighTDStarvationAttack(t, 64, FullSync) } |
|
|
|
|
func TestHighTDStarvationAttack64Fast(t *testing.T) { testHighTDStarvationAttack(t, 64, FastSync) } |
|
|
|
|
|
|
|
|
|
func TestHighTDStarvationAttack65Full(t *testing.T) { testHighTDStarvationAttack(t, 65, FullSync) } |
|
|
|
|
func TestHighTDStarvationAttack65Fast(t *testing.T) { testHighTDStarvationAttack(t, 65, FastSync) } |
|
|
|
|
func TestHighTDStarvationAttack65Light(t *testing.T) { testHighTDStarvationAttack(t, 65, LightSync) } |
|
|
|
|
func TestHighTDStarvationAttack65Full(t *testing.T) { |
|
|
|
|
testHighTDStarvationAttack(t, eth.ETH65, FullSync) |
|
|
|
|
} |
|
|
|
|
func TestHighTDStarvationAttack65Fast(t *testing.T) { |
|
|
|
|
testHighTDStarvationAttack(t, eth.ETH65, FastSync) |
|
|
|
|
} |
|
|
|
|
func TestHighTDStarvationAttack65Light(t *testing.T) { |
|
|
|
|
testHighTDStarvationAttack(t, eth.ETH65, LightSync) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func TestHighTDStarvationAttack66Full(t *testing.T) { testHighTDStarvationAttack(t, 66, FullSync) } |
|
|
|
|
func TestHighTDStarvationAttack66Fast(t *testing.T) { testHighTDStarvationAttack(t, 66, FastSync) } |
|
|
|
|
func TestHighTDStarvationAttack66Light(t *testing.T) { testHighTDStarvationAttack(t, 66, LightSync) } |
|
|
|
|
func TestHighTDStarvationAttack66Full(t *testing.T) { |
|
|
|
|
testHighTDStarvationAttack(t, eth.ETH66, FullSync) |
|
|
|
|
} |
|
|
|
|
func TestHighTDStarvationAttack66Fast(t *testing.T) { |
|
|
|
|
testHighTDStarvationAttack(t, eth.ETH66, FastSync) |
|
|
|
|
} |
|
|
|
|
func TestHighTDStarvationAttack66Light(t *testing.T) { |
|
|
|
|
testHighTDStarvationAttack(t, eth.ETH66, LightSync) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func testHighTDStarvationAttack(t *testing.T, protocol uint, mode SyncMode) { |
|
|
|
|
t.Parallel() |
|
|
|
@ -1159,9 +1143,8 @@ func testHighTDStarvationAttack(t *testing.T, protocol uint, mode SyncMode) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Tests that misbehaving peers are disconnected, whilst behaving ones are not.
|
|
|
|
|
func TestBlockHeaderAttackerDropping64(t *testing.T) { testBlockHeaderAttackerDropping(t, 64) } |
|
|
|
|
func TestBlockHeaderAttackerDropping65(t *testing.T) { testBlockHeaderAttackerDropping(t, 65) } |
|
|
|
|
func TestBlockHeaderAttackerDropping66(t *testing.T) { testBlockHeaderAttackerDropping(t, 66) } |
|
|
|
|
func TestBlockHeaderAttackerDropping65(t *testing.T) { testBlockHeaderAttackerDropping(t, eth.ETH65) } |
|
|
|
|
func TestBlockHeaderAttackerDropping66(t *testing.T) { testBlockHeaderAttackerDropping(t, eth.ETH66) } |
|
|
|
|
|
|
|
|
|
func testBlockHeaderAttackerDropping(t *testing.T, protocol uint) { |
|
|
|
|
t.Parallel() |
|
|
|
@ -1213,16 +1196,13 @@ func testBlockHeaderAttackerDropping(t *testing.T, protocol uint) { |
|
|
|
|
|
|
|
|
|
// Tests that synchronisation progress (origin block number, current block number
|
|
|
|
|
// and highest block number) is tracked and updated correctly.
|
|
|
|
|
func TestSyncProgress64Full(t *testing.T) { testSyncProgress(t, 64, FullSync) } |
|
|
|
|
func TestSyncProgress64Fast(t *testing.T) { testSyncProgress(t, 64, FastSync) } |
|
|
|
|
func TestSyncProgress65Full(t *testing.T) { testSyncProgress(t, eth.ETH65, FullSync) } |
|
|
|
|
func TestSyncProgress65Fast(t *testing.T) { testSyncProgress(t, eth.ETH65, FastSync) } |
|
|
|
|
func TestSyncProgress65Light(t *testing.T) { testSyncProgress(t, eth.ETH65, LightSync) } |
|
|
|
|
|
|
|
|
|
func TestSyncProgress65Full(t *testing.T) { testSyncProgress(t, 65, FullSync) } |
|
|
|
|
func TestSyncProgress65Fast(t *testing.T) { testSyncProgress(t, 65, FastSync) } |
|
|
|
|
func TestSyncProgress65Light(t *testing.T) { testSyncProgress(t, 65, LightSync) } |
|
|
|
|
|
|
|
|
|
func TestSyncProgress66Full(t *testing.T) { testSyncProgress(t, 66, FullSync) } |
|
|
|
|
func TestSyncProgress66Fast(t *testing.T) { testSyncProgress(t, 66, FastSync) } |
|
|
|
|
func TestSyncProgress66Light(t *testing.T) { testSyncProgress(t, 66, LightSync) } |
|
|
|
|
func TestSyncProgress66Full(t *testing.T) { testSyncProgress(t, eth.ETH66, FullSync) } |
|
|
|
|
func TestSyncProgress66Fast(t *testing.T) { testSyncProgress(t, eth.ETH66, FastSync) } |
|
|
|
|
func TestSyncProgress66Light(t *testing.T) { testSyncProgress(t, eth.ETH66, LightSync) } |
|
|
|
|
|
|
|
|
|
func testSyncProgress(t *testing.T, protocol uint, mode SyncMode) { |
|
|
|
|
t.Parallel() |
|
|
|
@ -1300,16 +1280,13 @@ func checkProgress(t *testing.T, d *Downloader, stage string, want ethereum.Sync |
|
|
|
|
// Tests that synchronisation progress (origin block number and highest block
|
|
|
|
|
// number) is tracked and updated correctly in case of a fork (or manual head
|
|
|
|
|
// revertal).
|
|
|
|
|
func TestForkedSyncProgress64Full(t *testing.T) { testForkedSyncProgress(t, 64, FullSync) } |
|
|
|
|
func TestForkedSyncProgress64Fast(t *testing.T) { testForkedSyncProgress(t, 64, FastSync) } |
|
|
|
|
|
|
|
|
|
func TestForkedSyncProgress65Full(t *testing.T) { testForkedSyncProgress(t, 65, FullSync) } |
|
|
|
|
func TestForkedSyncProgress65Fast(t *testing.T) { testForkedSyncProgress(t, 65, FastSync) } |
|
|
|
|
func TestForkedSyncProgress65Light(t *testing.T) { testForkedSyncProgress(t, 65, LightSync) } |
|
|
|
|
func TestForkedSyncProgress65Full(t *testing.T) { testForkedSyncProgress(t, eth.ETH65, FullSync) } |
|
|
|
|
func TestForkedSyncProgress65Fast(t *testing.T) { testForkedSyncProgress(t, eth.ETH65, FastSync) } |
|
|
|
|
func TestForkedSyncProgress65Light(t *testing.T) { testForkedSyncProgress(t, eth.ETH65, LightSync) } |
|
|
|
|
|
|
|
|
|
func TestForkedSyncProgress66Full(t *testing.T) { testForkedSyncProgress(t, 66, FullSync) } |
|
|
|
|
func TestForkedSyncProgress66Fast(t *testing.T) { testForkedSyncProgress(t, 66, FastSync) } |
|
|
|
|
func TestForkedSyncProgress66Light(t *testing.T) { testForkedSyncProgress(t, 66, LightSync) } |
|
|
|
|
func TestForkedSyncProgress66Full(t *testing.T) { testForkedSyncProgress(t, eth.ETH66, FullSync) } |
|
|
|
|
func TestForkedSyncProgress66Fast(t *testing.T) { testForkedSyncProgress(t, eth.ETH66, FastSync) } |
|
|
|
|
func TestForkedSyncProgress66Light(t *testing.T) { testForkedSyncProgress(t, eth.ETH66, LightSync) } |
|
|
|
|
|
|
|
|
|
func testForkedSyncProgress(t *testing.T, protocol uint, mode SyncMode) { |
|
|
|
|
t.Parallel() |
|
|
|
@ -1379,16 +1356,13 @@ func testForkedSyncProgress(t *testing.T, protocol uint, mode SyncMode) { |
|
|
|
|
// Tests that if synchronisation is aborted due to some failure, then the progress
|
|
|
|
|
// origin is not updated in the next sync cycle, as it should be considered the
|
|
|
|
|
// continuation of the previous sync and not a new instance.
|
|
|
|
|
func TestFailedSyncProgress64Full(t *testing.T) { testFailedSyncProgress(t, 64, FullSync) } |
|
|
|
|
func TestFailedSyncProgress64Fast(t *testing.T) { testFailedSyncProgress(t, 64, FastSync) } |
|
|
|
|
func TestFailedSyncProgress65Full(t *testing.T) { testFailedSyncProgress(t, eth.ETH65, FullSync) } |
|
|
|
|
func TestFailedSyncProgress65Fast(t *testing.T) { testFailedSyncProgress(t, eth.ETH65, FastSync) } |
|
|
|
|
func TestFailedSyncProgress65Light(t *testing.T) { testFailedSyncProgress(t, eth.ETH65, LightSync) } |
|
|
|
|
|
|
|
|
|
func TestFailedSyncProgress65Full(t *testing.T) { testFailedSyncProgress(t, 65, FullSync) } |
|
|
|
|
func TestFailedSyncProgress65Fast(t *testing.T) { testFailedSyncProgress(t, 65, FastSync) } |
|
|
|
|
func TestFailedSyncProgress65Light(t *testing.T) { testFailedSyncProgress(t, 65, LightSync) } |
|
|
|
|
|
|
|
|
|
func TestFailedSyncProgress66Full(t *testing.T) { testFailedSyncProgress(t, 66, FullSync) } |
|
|
|
|
func TestFailedSyncProgress66Fast(t *testing.T) { testFailedSyncProgress(t, 66, FastSync) } |
|
|
|
|
func TestFailedSyncProgress66Light(t *testing.T) { testFailedSyncProgress(t, 66, LightSync) } |
|
|
|
|
func TestFailedSyncProgress66Full(t *testing.T) { testFailedSyncProgress(t, eth.ETH66, FullSync) } |
|
|
|
|
func TestFailedSyncProgress66Fast(t *testing.T) { testFailedSyncProgress(t, eth.ETH66, FastSync) } |
|
|
|
|
func TestFailedSyncProgress66Light(t *testing.T) { testFailedSyncProgress(t, eth.ETH66, LightSync) } |
|
|
|
|
|
|
|
|
|
func testFailedSyncProgress(t *testing.T, protocol uint, mode SyncMode) { |
|
|
|
|
t.Parallel() |
|
|
|
@ -1455,16 +1429,13 @@ func testFailedSyncProgress(t *testing.T, protocol uint, mode SyncMode) { |
|
|
|
|
|
|
|
|
|
// Tests that if an attacker fakes a chain height, after the attack is detected,
|
|
|
|
|
// the progress height is successfully reduced at the next sync invocation.
|
|
|
|
|
func TestFakedSyncProgress64Full(t *testing.T) { testFakedSyncProgress(t, 64, FullSync) } |
|
|
|
|
func TestFakedSyncProgress64Fast(t *testing.T) { testFakedSyncProgress(t, 64, FastSync) } |
|
|
|
|
|
|
|
|
|
func TestFakedSyncProgress65Full(t *testing.T) { testFakedSyncProgress(t, 65, FullSync) } |
|
|
|
|
func TestFakedSyncProgress65Fast(t *testing.T) { testFakedSyncProgress(t, 65, FastSync) } |
|
|
|
|
func TestFakedSyncProgress65Light(t *testing.T) { testFakedSyncProgress(t, 65, LightSync) } |
|
|
|
|
func TestFakedSyncProgress65Full(t *testing.T) { testFakedSyncProgress(t, eth.ETH65, FullSync) } |
|
|
|
|
func TestFakedSyncProgress65Fast(t *testing.T) { testFakedSyncProgress(t, eth.ETH65, FastSync) } |
|
|
|
|
func TestFakedSyncProgress65Light(t *testing.T) { testFakedSyncProgress(t, eth.ETH65, LightSync) } |
|
|
|
|
|
|
|
|
|
func TestFakedSyncProgress66Full(t *testing.T) { testFakedSyncProgress(t, 66, FullSync) } |
|
|
|
|
func TestFakedSyncProgress66Fast(t *testing.T) { testFakedSyncProgress(t, 66, FastSync) } |
|
|
|
|
func TestFakedSyncProgress66Light(t *testing.T) { testFakedSyncProgress(t, 66, LightSync) } |
|
|
|
|
func TestFakedSyncProgress66Full(t *testing.T) { testFakedSyncProgress(t, eth.ETH66, FullSync) } |
|
|
|
|
func TestFakedSyncProgress66Fast(t *testing.T) { testFakedSyncProgress(t, eth.ETH66, FastSync) } |
|
|
|
|
func TestFakedSyncProgress66Light(t *testing.T) { testFakedSyncProgress(t, eth.ETH66, LightSync) } |
|
|
|
|
|
|
|
|
|
func testFakedSyncProgress(t *testing.T, protocol uint, mode SyncMode) { |
|
|
|
|
t.Parallel() |
|
|
|
@ -1535,16 +1506,13 @@ func testFakedSyncProgress(t *testing.T, protocol uint, mode SyncMode) { |
|
|
|
|
|
|
|
|
|
// This test reproduces an issue where unexpected deliveries would
|
|
|
|
|
// block indefinitely if they arrived at the right time.
|
|
|
|
|
func TestDeliverHeadersHang64Full(t *testing.T) { testDeliverHeadersHang(t, 64, FullSync) } |
|
|
|
|
func TestDeliverHeadersHang64Fast(t *testing.T) { testDeliverHeadersHang(t, 64, FastSync) } |
|
|
|
|
func TestDeliverHeadersHang65Full(t *testing.T) { testDeliverHeadersHang(t, eth.ETH65, FullSync) } |
|
|
|
|
func TestDeliverHeadersHang65Fast(t *testing.T) { testDeliverHeadersHang(t, eth.ETH65, FastSync) } |
|
|
|
|
func TestDeliverHeadersHang65Light(t *testing.T) { testDeliverHeadersHang(t, eth.ETH65, LightSync) } |
|
|
|
|
|
|
|
|
|
func TestDeliverHeadersHang65Full(t *testing.T) { testDeliverHeadersHang(t, 65, FullSync) } |
|
|
|
|
func TestDeliverHeadersHang65Fast(t *testing.T) { testDeliverHeadersHang(t, 65, FastSync) } |
|
|
|
|
func TestDeliverHeadersHang65Light(t *testing.T) { testDeliverHeadersHang(t, 65, LightSync) } |
|
|
|
|
|
|
|
|
|
func TestDeliverHeadersHang66Full(t *testing.T) { testDeliverHeadersHang(t, 66, FullSync) } |
|
|
|
|
func TestDeliverHeadersHang66Fast(t *testing.T) { testDeliverHeadersHang(t, 66, FastSync) } |
|
|
|
|
func TestDeliverHeadersHang66Light(t *testing.T) { testDeliverHeadersHang(t, 66, LightSync) } |
|
|
|
|
func TestDeliverHeadersHang66Full(t *testing.T) { testDeliverHeadersHang(t, eth.ETH66, FullSync) } |
|
|
|
|
func TestDeliverHeadersHang66Fast(t *testing.T) { testDeliverHeadersHang(t, eth.ETH66, FastSync) } |
|
|
|
|
func TestDeliverHeadersHang66Light(t *testing.T) { testDeliverHeadersHang(t, eth.ETH66, LightSync) } |
|
|
|
|
|
|
|
|
|
func testDeliverHeadersHang(t *testing.T, protocol uint, mode SyncMode) { |
|
|
|
|
t.Parallel() |
|
|
|
@ -1699,16 +1667,17 @@ func TestRemoteHeaderRequestSpan(t *testing.T) { |
|
|
|
|
|
|
|
|
|
// Tests that peers below a pre-configured checkpoint block are prevented from
|
|
|
|
|
// being fast-synced from, avoiding potential cheap eclipse attacks.
|
|
|
|
|
func TestCheckpointEnforcement64Full(t *testing.T) { testCheckpointEnforcement(t, 64, FullSync) } |
|
|
|
|
func TestCheckpointEnforcement64Fast(t *testing.T) { testCheckpointEnforcement(t, 64, FastSync) } |
|
|
|
|
|
|
|
|
|
func TestCheckpointEnforcement65Full(t *testing.T) { testCheckpointEnforcement(t, 65, FullSync) } |
|
|
|
|
func TestCheckpointEnforcement65Fast(t *testing.T) { testCheckpointEnforcement(t, 65, FastSync) } |
|
|
|
|
func TestCheckpointEnforcement65Light(t *testing.T) { testCheckpointEnforcement(t, 65, LightSync) } |
|
|
|
|
func TestCheckpointEnforcement65Full(t *testing.T) { testCheckpointEnforcement(t, eth.ETH65, FullSync) } |
|
|
|
|
func TestCheckpointEnforcement65Fast(t *testing.T) { testCheckpointEnforcement(t, eth.ETH65, FastSync) } |
|
|
|
|
func TestCheckpointEnforcement65Light(t *testing.T) { |
|
|
|
|
testCheckpointEnforcement(t, eth.ETH65, LightSync) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func TestCheckpointEnforcement66Full(t *testing.T) { testCheckpointEnforcement(t, 66, FullSync) } |
|
|
|
|
func TestCheckpointEnforcement66Fast(t *testing.T) { testCheckpointEnforcement(t, 66, FastSync) } |
|
|
|
|
func TestCheckpointEnforcement66Light(t *testing.T) { testCheckpointEnforcement(t, 66, LightSync) } |
|
|
|
|
func TestCheckpointEnforcement66Full(t *testing.T) { testCheckpointEnforcement(t, eth.ETH66, FullSync) } |
|
|
|
|
func TestCheckpointEnforcement66Fast(t *testing.T) { testCheckpointEnforcement(t, eth.ETH66, FastSync) } |
|
|
|
|
func TestCheckpointEnforcement66Light(t *testing.T) { |
|
|
|
|
testCheckpointEnforcement(t, eth.ETH66, LightSync) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func testCheckpointEnforcement(t *testing.T, protocol uint, mode SyncMode) { |
|
|
|
|
t.Parallel() |
|
|
|
|