add xdpos protocol test cases

This commit is contained in:
wanwiset25 2024-05-26 19:55:39 +04:00
parent 41fa412893
commit 1b781530c6
5 changed files with 87 additions and 7 deletions

View file

@ -897,6 +897,9 @@ func TestBoundedHeavyForkedSync63Fast(t *testing.T) { testBoundedHeavyForkedSyn
func TestBoundedHeavyForkedSync64Full(t *testing.T) { testBoundedHeavyForkedSync(t, 64, FullSync) } func TestBoundedHeavyForkedSync64Full(t *testing.T) { testBoundedHeavyForkedSync(t, 64, FullSync) }
func TestBoundedHeavyForkedSync64Fast(t *testing.T) { testBoundedHeavyForkedSync(t, 64, FastSync) } func TestBoundedHeavyForkedSync64Fast(t *testing.T) { testBoundedHeavyForkedSync(t, 64, FastSync) }
func TestBoundedHeavyForkedSync64Light(t *testing.T) { testBoundedHeavyForkedSync(t, 64, LightSync) } func TestBoundedHeavyForkedSync64Light(t *testing.T) { testBoundedHeavyForkedSync(t, 64, LightSync) }
func TestBoundedHeavyForkedSync100Full(t *testing.T) { testBoundedHeavyForkedSync(t, 100, FullSync) }
func TestBoundedHeavyForkedSync100Fast(t *testing.T) { testBoundedHeavyForkedSync(t, 100, FastSync) }
func TestBoundedHeavyForkedSync100Light(t *testing.T) { testBoundedHeavyForkedSync(t, 100, LightSync) }
func testBoundedHeavyForkedSync(t *testing.T, protocol int, mode SyncMode) { func testBoundedHeavyForkedSync(t *testing.T, protocol int, mode SyncMode) {
t.Parallel() t.Parallel()
@ -967,6 +970,9 @@ func TestCancel63Fast(t *testing.T) { testCancel(t, 63, FastSync) }
func TestCancel64Full(t *testing.T) { testCancel(t, 64, FullSync) } func TestCancel64Full(t *testing.T) { testCancel(t, 64, FullSync) }
func TestCancel64Fast(t *testing.T) { testCancel(t, 64, FastSync) } func TestCancel64Fast(t *testing.T) { testCancel(t, 64, FastSync) }
func TestCancel64Light(t *testing.T) { testCancel(t, 64, LightSync) } func TestCancel64Light(t *testing.T) { testCancel(t, 64, LightSync) }
func TestCancel100Full(t *testing.T) { testCancel(t, 100, FullSync) }
func TestCancel100Fast(t *testing.T) { testCancel(t, 100, FastSync) }
func TestCancel100Light(t *testing.T) { testCancel(t, 100, LightSync) }
func testCancel(t *testing.T, protocol int, mode SyncMode) { func testCancel(t *testing.T, protocol int, mode SyncMode) {
t.Parallel() t.Parallel()
@ -1008,6 +1014,9 @@ func TestMultiSynchronisation63Fast(t *testing.T) { testMultiSynchronisation(t,
func TestMultiSynchronisation64Full(t *testing.T) { testMultiSynchronisation(t, 64, FullSync) } func TestMultiSynchronisation64Full(t *testing.T) { testMultiSynchronisation(t, 64, FullSync) }
func TestMultiSynchronisation64Fast(t *testing.T) { testMultiSynchronisation(t, 64, FastSync) } func TestMultiSynchronisation64Fast(t *testing.T) { testMultiSynchronisation(t, 64, FastSync) }
func TestMultiSynchronisation64Light(t *testing.T) { testMultiSynchronisation(t, 64, LightSync) } func TestMultiSynchronisation64Light(t *testing.T) { testMultiSynchronisation(t, 64, LightSync) }
func TestMultiSynchronisation100Full(t *testing.T) { testMultiSynchronisation(t, 100, FullSync) }
func TestMultiSynchronisation100Fast(t *testing.T) { testMultiSynchronisation(t, 100, FastSync) }
func TestMultiSynchronisation100Light(t *testing.T) { testMultiSynchronisation(t, 100, LightSync) }
func testMultiSynchronisation(t *testing.T, protocol int, mode SyncMode) { func testMultiSynchronisation(t *testing.T, protocol int, mode SyncMode) {
t.Parallel() t.Parallel()
@ -1038,6 +1047,9 @@ func TestMultiProtoSynchronisation63Fast(t *testing.T) { testMultiProtoSync(t,
func TestMultiProtoSynchronisation64Full(t *testing.T) { testMultiProtoSync(t, 64, FullSync) } func TestMultiProtoSynchronisation64Full(t *testing.T) { testMultiProtoSync(t, 64, FullSync) }
func TestMultiProtoSynchronisation64Fast(t *testing.T) { testMultiProtoSync(t, 64, FastSync) } func TestMultiProtoSynchronisation64Fast(t *testing.T) { testMultiProtoSync(t, 64, FastSync) }
func TestMultiProtoSynchronisation64Light(t *testing.T) { testMultiProtoSync(t, 64, LightSync) } func TestMultiProtoSynchronisation64Light(t *testing.T) { testMultiProtoSync(t, 64, LightSync) }
func TestMultiProtoSynchronisation100Full(t *testing.T) { testMultiProtoSync(t, 100, FullSync) }
func TestMultiProtoSynchronisation100Fast(t *testing.T) { testMultiProtoSync(t, 100, FastSync) }
func TestMultiProtoSynchronisation100Light(t *testing.T) { testMultiProtoSync(t, 100, LightSync) }
func testMultiProtoSync(t *testing.T, protocol int, mode SyncMode) { func testMultiProtoSync(t *testing.T, protocol int, mode SyncMode) {
t.Parallel() t.Parallel()
@ -1053,6 +1065,7 @@ func testMultiProtoSync(t *testing.T, protocol int, mode SyncMode) {
tester.newPeer("peer 62", 62, hashes, headers, blocks, nil) tester.newPeer("peer 62", 62, hashes, headers, blocks, nil)
tester.newPeer("peer 63", 63, hashes, headers, blocks, receipts) tester.newPeer("peer 63", 63, hashes, headers, blocks, receipts)
tester.newPeer("peer 64", 64, hashes, headers, blocks, receipts) tester.newPeer("peer 64", 64, hashes, headers, blocks, receipts)
tester.newPeer("peer 100", 100, hashes, headers, blocks, receipts)
// Synchronise with the requested peer and make sure all blocks were retrieved // 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 { if err := tester.sync(fmt.Sprintf("peer %d", protocol), nil, mode); err != nil {
@ -1061,7 +1074,7 @@ func testMultiProtoSync(t *testing.T, protocol int, mode SyncMode) {
assertOwnChain(t, tester, targetBlocks+1) assertOwnChain(t, tester, targetBlocks+1)
// Check that no peers have been dropped off // Check that no peers have been dropped off
for _, version := range []int{62, 63, 64} { for _, version := range []int{62, 63, 64, 100} {
peer := fmt.Sprintf("peer %d", version) peer := fmt.Sprintf("peer %d", version)
if _, ok := tester.peerHashes[peer]; !ok { if _, ok := tester.peerHashes[peer]; !ok {
t.Errorf("%s dropped", peer) t.Errorf("%s dropped", peer)
@ -1077,6 +1090,9 @@ func TestEmptyShortCircuit63Fast(t *testing.T) { testEmptyShortCircuit(t, 63, F
func TestEmptyShortCircuit64Full(t *testing.T) { testEmptyShortCircuit(t, 64, FullSync) } func TestEmptyShortCircuit64Full(t *testing.T) { testEmptyShortCircuit(t, 64, FullSync) }
func TestEmptyShortCircuit64Fast(t *testing.T) { testEmptyShortCircuit(t, 64, FastSync) } func TestEmptyShortCircuit64Fast(t *testing.T) { testEmptyShortCircuit(t, 64, FastSync) }
func TestEmptyShortCircuit64Light(t *testing.T) { testEmptyShortCircuit(t, 64, LightSync) } func TestEmptyShortCircuit64Light(t *testing.T) { testEmptyShortCircuit(t, 64, LightSync) }
func TestEmptyShortCircuit100Full(t *testing.T) { testEmptyShortCircuit(t, 100, FullSync) }
func TestEmptyShortCircuit100Fast(t *testing.T) { testEmptyShortCircuit(t, 100, FastSync) }
func TestEmptyShortCircuit100Light(t *testing.T) { testEmptyShortCircuit(t, 100, LightSync) }
func testEmptyShortCircuit(t *testing.T, protocol int, mode SyncMode) { func testEmptyShortCircuit(t *testing.T, protocol int, mode SyncMode) {
t.Parallel() t.Parallel()
@ -1132,6 +1148,9 @@ func TestMissingHeaderAttack63Fast(t *testing.T) { testMissingHeaderAttack(t, 6
func TestMissingHeaderAttack64Full(t *testing.T) { testMissingHeaderAttack(t, 64, FullSync) } func TestMissingHeaderAttack64Full(t *testing.T) { testMissingHeaderAttack(t, 64, FullSync) }
func TestMissingHeaderAttack64Fast(t *testing.T) { testMissingHeaderAttack(t, 64, FastSync) } func TestMissingHeaderAttack64Fast(t *testing.T) { testMissingHeaderAttack(t, 64, FastSync) }
func TestMissingHeaderAttack64Light(t *testing.T) { testMissingHeaderAttack(t, 64, LightSync) } func TestMissingHeaderAttack64Light(t *testing.T) { testMissingHeaderAttack(t, 64, LightSync) }
func TestMissingHeaderAttack100Full(t *testing.T) { testMissingHeaderAttack(t, 100, FullSync) }
func TestMissingHeaderAttack100Fast(t *testing.T) { testMissingHeaderAttack(t, 100, FastSync) }
func TestMissingHeaderAttack100Light(t *testing.T) { testMissingHeaderAttack(t, 100, LightSync) }
func testMissingHeaderAttack(t *testing.T, protocol int, mode SyncMode) { func testMissingHeaderAttack(t *testing.T, protocol int, mode SyncMode) {
t.Parallel() t.Parallel()
@ -1167,6 +1186,9 @@ func TestShiftedHeaderAttack63Fast(t *testing.T) { testShiftedHeaderAttack(t, 6
func TestShiftedHeaderAttack64Full(t *testing.T) { testShiftedHeaderAttack(t, 64, FullSync) } func TestShiftedHeaderAttack64Full(t *testing.T) { testShiftedHeaderAttack(t, 64, FullSync) }
func TestShiftedHeaderAttack64Fast(t *testing.T) { testShiftedHeaderAttack(t, 64, FastSync) } func TestShiftedHeaderAttack64Fast(t *testing.T) { testShiftedHeaderAttack(t, 64, FastSync) }
func TestShiftedHeaderAttack64Light(t *testing.T) { testShiftedHeaderAttack(t, 64, LightSync) } func TestShiftedHeaderAttack64Light(t *testing.T) { testShiftedHeaderAttack(t, 64, LightSync) }
func TestShiftedHeaderAttack100Full(t *testing.T) { testShiftedHeaderAttack(t, 100, FullSync) }
func TestShiftedHeaderAttack100Fast(t *testing.T) { testShiftedHeaderAttack(t, 100, FastSync) }
func TestShiftedHeaderAttack100Light(t *testing.T) { testShiftedHeaderAttack(t, 100, LightSync) }
func testShiftedHeaderAttack(t *testing.T, protocol int, mode SyncMode) { func testShiftedHeaderAttack(t *testing.T, protocol int, mode SyncMode) {
t.Parallel() t.Parallel()
@ -1201,6 +1223,8 @@ func testShiftedHeaderAttack(t *testing.T, protocol int, mode SyncMode) {
func TestInvalidHeaderRollback63Fast(t *testing.T) { testInvalidHeaderRollback(t, 63, FastSync) } func TestInvalidHeaderRollback63Fast(t *testing.T) { testInvalidHeaderRollback(t, 63, FastSync) }
func TestInvalidHeaderRollback64Fast(t *testing.T) { testInvalidHeaderRollback(t, 64, FastSync) } func TestInvalidHeaderRollback64Fast(t *testing.T) { testInvalidHeaderRollback(t, 64, FastSync) }
func TestInvalidHeaderRollback64Light(t *testing.T) { testInvalidHeaderRollback(t, 64, LightSync) } func TestInvalidHeaderRollback64Light(t *testing.T) { testInvalidHeaderRollback(t, 64, LightSync) }
func TestInvalidHeaderRollback100Fast(t *testing.T) { testInvalidHeaderRollback(t, 100, FastSync) }
func TestInvalidHeaderRollback100Light(t *testing.T) { testInvalidHeaderRollback(t, 100, LightSync) }
func testInvalidHeaderRollback(t *testing.T, protocol int, mode SyncMode) { func testInvalidHeaderRollback(t *testing.T, protocol int, mode SyncMode) {
t.Parallel() t.Parallel()
@ -1293,6 +1317,9 @@ func TestHighTDStarvationAttack63Fast(t *testing.T) { testHighTDStarvationAttac
func TestHighTDStarvationAttack64Full(t *testing.T) { testHighTDStarvationAttack(t, 64, FullSync) } func TestHighTDStarvationAttack64Full(t *testing.T) { testHighTDStarvationAttack(t, 64, FullSync) }
func TestHighTDStarvationAttack64Fast(t *testing.T) { testHighTDStarvationAttack(t, 64, FastSync) } func TestHighTDStarvationAttack64Fast(t *testing.T) { testHighTDStarvationAttack(t, 64, FastSync) }
func TestHighTDStarvationAttack64Light(t *testing.T) { testHighTDStarvationAttack(t, 64, LightSync) } func TestHighTDStarvationAttack64Light(t *testing.T) { testHighTDStarvationAttack(t, 64, LightSync) }
func TestHighTDStarvationAttack100Full(t *testing.T) { testHighTDStarvationAttack(t, 100, FullSync) }
func TestHighTDStarvationAttack100Fast(t *testing.T) { testHighTDStarvationAttack(t, 100, FastSync) }
func TestHighTDStarvationAttack100Light(t *testing.T) { testHighTDStarvationAttack(t, 100, LightSync) }
func testHighTDStarvationAttack(t *testing.T, protocol int, mode SyncMode) { func testHighTDStarvationAttack(t *testing.T, protocol int, mode SyncMode) {
t.Parallel() t.Parallel()
@ -1312,6 +1339,7 @@ func testHighTDStarvationAttack(t *testing.T, protocol int, mode SyncMode) {
func TestBlockHeaderAttackerDropping62(t *testing.T) { testBlockHeaderAttackerDropping(t, 62) } func TestBlockHeaderAttackerDropping62(t *testing.T) { testBlockHeaderAttackerDropping(t, 62) }
func TestBlockHeaderAttackerDropping63(t *testing.T) { testBlockHeaderAttackerDropping(t, 63) } func TestBlockHeaderAttackerDropping63(t *testing.T) { testBlockHeaderAttackerDropping(t, 63) }
func TestBlockHeaderAttackerDropping64(t *testing.T) { testBlockHeaderAttackerDropping(t, 64) } func TestBlockHeaderAttackerDropping64(t *testing.T) { testBlockHeaderAttackerDropping(t, 64) }
func TestBlockHeaderAttackerDropping100(t *testing.T) { testBlockHeaderAttackerDropping(t, 100) }
func testBlockHeaderAttackerDropping(t *testing.T, protocol int) { func testBlockHeaderAttackerDropping(t *testing.T, protocol int) {
t.Parallel() t.Parallel()
@ -1373,6 +1401,9 @@ func TestSyncProgress63Fast(t *testing.T) { testSyncProgress(t, 63, FastSync) }
func TestSyncProgress64Full(t *testing.T) { testSyncProgress(t, 64, FullSync) } func TestSyncProgress64Full(t *testing.T) { testSyncProgress(t, 64, FullSync) }
func TestSyncProgress64Fast(t *testing.T) { testSyncProgress(t, 64, FastSync) } func TestSyncProgress64Fast(t *testing.T) { testSyncProgress(t, 64, FastSync) }
func TestSyncProgress64Light(t *testing.T) { testSyncProgress(t, 64, LightSync) } func TestSyncProgress64Light(t *testing.T) { testSyncProgress(t, 64, LightSync) }
func TestSyncProgress100Full(t *testing.T) { testSyncProgress(t, 100, FullSync) }
func TestSyncProgress100Fast(t *testing.T) { testSyncProgress(t, 100, FastSync) }
func TestSyncProgress100Light(t *testing.T) { testSyncProgress(t, 100, LightSync) }
func testSyncProgress(t *testing.T, protocol int, mode SyncMode) { func testSyncProgress(t *testing.T, protocol int, mode SyncMode) {
t.Parallel() t.Parallel()
@ -1446,6 +1477,9 @@ func TestForkedSyncProgress63Fast(t *testing.T) { testForkedSyncProgress(t, 63,
func TestForkedSyncProgress64Full(t *testing.T) { testForkedSyncProgress(t, 64, FullSync) } func TestForkedSyncProgress64Full(t *testing.T) { testForkedSyncProgress(t, 64, FullSync) }
func TestForkedSyncProgress64Fast(t *testing.T) { testForkedSyncProgress(t, 64, FastSync) } func TestForkedSyncProgress64Fast(t *testing.T) { testForkedSyncProgress(t, 64, FastSync) }
func TestForkedSyncProgress64Light(t *testing.T) { testForkedSyncProgress(t, 64, LightSync) } func TestForkedSyncProgress64Light(t *testing.T) { testForkedSyncProgress(t, 64, LightSync) }
func TestForkedSyncProgress100Full(t *testing.T) { testForkedSyncProgress(t, 100, FullSync) }
func TestForkedSyncProgress100Fast(t *testing.T) { testForkedSyncProgress(t, 100, FastSync) }
func TestForkedSyncProgress100Light(t *testing.T) { testForkedSyncProgress(t, 100, LightSync) }
func testForkedSyncProgress(t *testing.T, protocol int, mode SyncMode) { func testForkedSyncProgress(t *testing.T, protocol int, mode SyncMode) {
t.Parallel() t.Parallel()
@ -1522,6 +1556,9 @@ func TestFailedSyncProgress63Fast(t *testing.T) { testFailedSyncProgress(t, 63,
func TestFailedSyncProgress64Full(t *testing.T) { testFailedSyncProgress(t, 64, FullSync) } func TestFailedSyncProgress64Full(t *testing.T) { testFailedSyncProgress(t, 64, FullSync) }
func TestFailedSyncProgress64Fast(t *testing.T) { testFailedSyncProgress(t, 64, FastSync) } func TestFailedSyncProgress64Fast(t *testing.T) { testFailedSyncProgress(t, 64, FastSync) }
func TestFailedSyncProgress64Light(t *testing.T) { testFailedSyncProgress(t, 64, LightSync) } func TestFailedSyncProgress64Light(t *testing.T) { testFailedSyncProgress(t, 64, LightSync) }
func TestFailedSyncProgress100Full(t *testing.T) { testFailedSyncProgress(t, 100, FullSync) }
func TestFailedSyncProgress100Fast(t *testing.T) { testFailedSyncProgress(t, 100, FastSync) }
func TestFailedSyncProgress100Light(t *testing.T) { testFailedSyncProgress(t, 100, LightSync) }
func testFailedSyncProgress(t *testing.T, protocol int, mode SyncMode) { func testFailedSyncProgress(t *testing.T, protocol int, mode SyncMode) {
t.Parallel() t.Parallel()
@ -1599,6 +1636,9 @@ func TestFakedSyncProgress63Fast(t *testing.T) { testFakedSyncProgress(t, 63, F
func TestFakedSyncProgress64Full(t *testing.T) { testFakedSyncProgress(t, 64, FullSync) } func TestFakedSyncProgress64Full(t *testing.T) { testFakedSyncProgress(t, 64, FullSync) }
func TestFakedSyncProgress64Fast(t *testing.T) { testFakedSyncProgress(t, 64, FastSync) } func TestFakedSyncProgress64Fast(t *testing.T) { testFakedSyncProgress(t, 64, FastSync) }
func TestFakedSyncProgress64Light(t *testing.T) { testFakedSyncProgress(t, 64, LightSync) } func TestFakedSyncProgress64Light(t *testing.T) { testFakedSyncProgress(t, 64, LightSync) }
func TestFakedSyncProgress100Full(t *testing.T) { testFakedSyncProgress(t, 100, FullSync) }
func TestFakedSyncProgress100Fast(t *testing.T) { testFakedSyncProgress(t, 100, FastSync) }
func TestFakedSyncProgress100Light(t *testing.T) { testFakedSyncProgress(t, 100, LightSync) }
func testFakedSyncProgress(t *testing.T, protocol int, mode SyncMode) { func testFakedSyncProgress(t *testing.T, protocol int, mode SyncMode) {
t.Parallel() t.Parallel()
@ -1686,6 +1726,9 @@ func TestDeliverHeadersHang(t *testing.T) {
{64, FullSync}, {64, FullSync},
{64, FastSync}, {64, FastSync},
{64, LightSync}, {64, LightSync},
{100, FullSync},
{100, FastSync},
{100, LightSync},
} }
for _, tc := range testCases { for _, tc := range testCases {
t.Run(fmt.Sprintf("protocol %d mode %v", tc.protocol, tc.syncMode), func(t *testing.T) { t.Run(fmt.Sprintf("protocol %d mode %v", tc.protocol, tc.syncMode), func(t *testing.T) {

View file

@ -314,6 +314,7 @@ func verifyProposeBlockHandlerCalled(t *testing.T, proposedBlockChan chan *types
func TestSequentialAnnouncements62(t *testing.T) { testSequentialAnnouncements(t, 62) } func TestSequentialAnnouncements62(t *testing.T) { testSequentialAnnouncements(t, 62) }
func TestSequentialAnnouncements63(t *testing.T) { testSequentialAnnouncements(t, 63) } func TestSequentialAnnouncements63(t *testing.T) { testSequentialAnnouncements(t, 63) }
func TestSequentialAnnouncements64(t *testing.T) { testSequentialAnnouncements(t, 64) } func TestSequentialAnnouncements64(t *testing.T) { testSequentialAnnouncements(t, 64) }
func TestSequentialAnnouncements100(t *testing.T) { testSequentialAnnouncements(t, 100) }
func testSequentialAnnouncements(t *testing.T, protocol int) { func testSequentialAnnouncements(t *testing.T, protocol int) {
// Create a chain of blocks to import // Create a chain of blocks to import
@ -349,6 +350,7 @@ func testSequentialAnnouncements(t *testing.T, protocol int) {
func TestConcurrentAnnouncements62(t *testing.T) { testConcurrentAnnouncements(t, 62) } func TestConcurrentAnnouncements62(t *testing.T) { testConcurrentAnnouncements(t, 62) }
func TestConcurrentAnnouncements63(t *testing.T) { testConcurrentAnnouncements(t, 63) } func TestConcurrentAnnouncements63(t *testing.T) { testConcurrentAnnouncements(t, 63) }
func TestConcurrentAnnouncements64(t *testing.T) { testConcurrentAnnouncements(t, 64) } func TestConcurrentAnnouncements64(t *testing.T) { testConcurrentAnnouncements(t, 64) }
func TestConcurrentAnnouncements100(t *testing.T) { testConcurrentAnnouncements(t, 100) }
func testConcurrentAnnouncements(t *testing.T, protocol int) { func testConcurrentAnnouncements(t *testing.T, protocol int) {
// Create a chain of blocks to import // Create a chain of blocks to import
@ -397,6 +399,7 @@ func testConcurrentAnnouncements(t *testing.T, protocol int) {
func TestOverlappingAnnouncements62(t *testing.T) { testOverlappingAnnouncements(t, 62) } func TestOverlappingAnnouncements62(t *testing.T) { testOverlappingAnnouncements(t, 62) }
func TestOverlappingAnnouncements63(t *testing.T) { testOverlappingAnnouncements(t, 63) } func TestOverlappingAnnouncements63(t *testing.T) { testOverlappingAnnouncements(t, 63) }
func TestOverlappingAnnouncements64(t *testing.T) { testOverlappingAnnouncements(t, 64) } func TestOverlappingAnnouncements64(t *testing.T) { testOverlappingAnnouncements(t, 64) }
func TestOverlappingAnnouncements100(t *testing.T) { testOverlappingAnnouncements(t, 100) }
func testOverlappingAnnouncements(t *testing.T, protocol int) { func testOverlappingAnnouncements(t *testing.T, protocol int) {
// Create a chain of blocks to import // Create a chain of blocks to import
@ -434,6 +437,7 @@ func testOverlappingAnnouncements(t *testing.T, protocol int) {
func TestPendingDeduplication62(t *testing.T) { testPendingDeduplication(t, 62) } func TestPendingDeduplication62(t *testing.T) { testPendingDeduplication(t, 62) }
func TestPendingDeduplication63(t *testing.T) { testPendingDeduplication(t, 63) } func TestPendingDeduplication63(t *testing.T) { testPendingDeduplication(t, 63) }
func TestPendingDeduplication64(t *testing.T) { testPendingDeduplication(t, 64) } func TestPendingDeduplication64(t *testing.T) { testPendingDeduplication(t, 64) }
func TestPendingDeduplication100(t *testing.T) { testPendingDeduplication(t, 100) }
func testPendingDeduplication(t *testing.T, protocol int) { func testPendingDeduplication(t *testing.T, protocol int) {
// Create a hash and corresponding block // Create a hash and corresponding block
@ -477,6 +481,7 @@ func testPendingDeduplication(t *testing.T, protocol int) {
func TestRandomArrivalImport62(t *testing.T) { testRandomArrivalImport(t, 62) } func TestRandomArrivalImport62(t *testing.T) { testRandomArrivalImport(t, 62) }
func TestRandomArrivalImport63(t *testing.T) { testRandomArrivalImport(t, 63) } func TestRandomArrivalImport63(t *testing.T) { testRandomArrivalImport(t, 63) }
func TestRandomArrivalImport64(t *testing.T) { testRandomArrivalImport(t, 64) } func TestRandomArrivalImport64(t *testing.T) { testRandomArrivalImport(t, 64) }
func TestRandomArrivalImport100(t *testing.T) { testRandomArrivalImport(t, 100) }
func testRandomArrivalImport(t *testing.T, protocol int) { func testRandomArrivalImport(t *testing.T, protocol int) {
// Create a chain of blocks to import, and choose one to delay // Create a chain of blocks to import, and choose one to delay
@ -511,6 +516,7 @@ func testRandomArrivalImport(t *testing.T, protocol int) {
func TestQueueGapFill62(t *testing.T) { testQueueGapFill(t, 62) } func TestQueueGapFill62(t *testing.T) { testQueueGapFill(t, 62) }
func TestQueueGapFill63(t *testing.T) { testQueueGapFill(t, 63) } func TestQueueGapFill63(t *testing.T) { testQueueGapFill(t, 63) }
func TestQueueGapFill64(t *testing.T) { testQueueGapFill(t, 64) } func TestQueueGapFill64(t *testing.T) { testQueueGapFill(t, 64) }
func TestQueueGapFill100(t *testing.T) { testQueueGapFill(t, 100) }
func testQueueGapFill(t *testing.T, protocol int) { func testQueueGapFill(t *testing.T, protocol int) {
// Create a chain of blocks to import, and choose one to not announce at all // Create a chain of blocks to import, and choose one to not announce at all
@ -545,6 +551,7 @@ func testQueueGapFill(t *testing.T, protocol int) {
func TestImportDeduplication62(t *testing.T) { testImportDeduplication(t, 62) } func TestImportDeduplication62(t *testing.T) { testImportDeduplication(t, 62) }
func TestImportDeduplication63(t *testing.T) { testImportDeduplication(t, 63) } func TestImportDeduplication63(t *testing.T) { testImportDeduplication(t, 63) }
func TestImportDeduplication64(t *testing.T) { testImportDeduplication(t, 64) } func TestImportDeduplication64(t *testing.T) { testImportDeduplication(t, 64) }
func TestImportDeduplication100(t *testing.T) { testImportDeduplication(t, 100) }
func testImportDeduplication(t *testing.T, protocol int) { func testImportDeduplication(t *testing.T, protocol int) {
// Create two blocks to import (one for duplication, the other for stalling) // Create two blocks to import (one for duplication, the other for stalling)
@ -623,6 +630,7 @@ func TestDistantPropagationDiscarding(t *testing.T) {
func TestDistantAnnouncementDiscarding62(t *testing.T) { testDistantAnnouncementDiscarding(t, 62) } func TestDistantAnnouncementDiscarding62(t *testing.T) { testDistantAnnouncementDiscarding(t, 62) }
func TestDistantAnnouncementDiscarding63(t *testing.T) { testDistantAnnouncementDiscarding(t, 63) } func TestDistantAnnouncementDiscarding63(t *testing.T) { testDistantAnnouncementDiscarding(t, 63) }
func TestDistantAnnouncementDiscarding64(t *testing.T) { testDistantAnnouncementDiscarding(t, 64) } func TestDistantAnnouncementDiscarding64(t *testing.T) { testDistantAnnouncementDiscarding(t, 64) }
func TestDistantAnnouncementDiscarding100(t *testing.T) { testDistantAnnouncementDiscarding(t, 100) }
func testDistantAnnouncementDiscarding(t *testing.T, protocol int) { func testDistantAnnouncementDiscarding(t *testing.T, protocol int) {
// Create a long chain to import and define the discard boundaries // Create a long chain to import and define the discard boundaries
@ -666,6 +674,7 @@ func testDistantAnnouncementDiscarding(t *testing.T, protocol int) {
func TestInvalidNumberAnnouncement62(t *testing.T) { testInvalidNumberAnnouncement(t, 62) } func TestInvalidNumberAnnouncement62(t *testing.T) { testInvalidNumberAnnouncement(t, 62) }
func TestInvalidNumberAnnouncement63(t *testing.T) { testInvalidNumberAnnouncement(t, 63) } func TestInvalidNumberAnnouncement63(t *testing.T) { testInvalidNumberAnnouncement(t, 63) }
func TestInvalidNumberAnnouncement64(t *testing.T) { testInvalidNumberAnnouncement(t, 64) } func TestInvalidNumberAnnouncement64(t *testing.T) { testInvalidNumberAnnouncement(t, 64) }
func TestInvalidNumberAnnouncement100(t *testing.T) { testInvalidNumberAnnouncement(t, 100) }
func testInvalidNumberAnnouncement(t *testing.T, protocol int) { func testInvalidNumberAnnouncement(t *testing.T, protocol int) {
// Create a single block to import and check numbers against // Create a single block to import and check numbers against
@ -714,6 +723,7 @@ func testInvalidNumberAnnouncement(t *testing.T, protocol int) {
func TestEmptyBlockShortCircuit62(t *testing.T) { testEmptyBlockShortCircuit(t, 62) } func TestEmptyBlockShortCircuit62(t *testing.T) { testEmptyBlockShortCircuit(t, 62) }
func TestEmptyBlockShortCircuit63(t *testing.T) { testEmptyBlockShortCircuit(t, 63) } func TestEmptyBlockShortCircuit63(t *testing.T) { testEmptyBlockShortCircuit(t, 63) }
func TestEmptyBlockShortCircuit64(t *testing.T) { testEmptyBlockShortCircuit(t, 64) } func TestEmptyBlockShortCircuit64(t *testing.T) { testEmptyBlockShortCircuit(t, 64) }
func TestEmptyBlockShortCircuit100(t *testing.T) { testEmptyBlockShortCircuit(t, 64) }
func testEmptyBlockShortCircuit(t *testing.T, protocol int) { func testEmptyBlockShortCircuit(t *testing.T, protocol int) {
// Create a chain of blocks to import // Create a chain of blocks to import
@ -758,6 +768,7 @@ func testEmptyBlockShortCircuit(t *testing.T, protocol int) {
func TestHashMemoryExhaustionAttack62(t *testing.T) { testHashMemoryExhaustionAttack(t, 62) } func TestHashMemoryExhaustionAttack62(t *testing.T) { testHashMemoryExhaustionAttack(t, 62) }
func TestHashMemoryExhaustionAttack63(t *testing.T) { testHashMemoryExhaustionAttack(t, 63) } func TestHashMemoryExhaustionAttack63(t *testing.T) { testHashMemoryExhaustionAttack(t, 63) }
func TestHashMemoryExhaustionAttack64(t *testing.T) { testHashMemoryExhaustionAttack(t, 64) } func TestHashMemoryExhaustionAttack64(t *testing.T) { testHashMemoryExhaustionAttack(t, 64) }
func TestHashMemoryExhaustionAttack100(t *testing.T) { testHashMemoryExhaustionAttack(t, 100) }
func testHashMemoryExhaustionAttack(t *testing.T, protocol int) { func testHashMemoryExhaustionAttack(t *testing.T, protocol int) {
// Create a tester with instrumented import hooks // Create a tester with instrumented import hooks

View file

@ -42,6 +42,7 @@ import (
// Tests that block headers can be retrieved from a remote chain based on user queries. // Tests that block headers can be retrieved from a remote chain based on user queries.
func TestGetBlockHeaders63(t *testing.T) { testGetBlockHeaders(t, 63) } func TestGetBlockHeaders63(t *testing.T) { testGetBlockHeaders(t, 63) }
func TestGetBlockHeaders64(t *testing.T) { testGetBlockHeaders(t, 64) } func TestGetBlockHeaders64(t *testing.T) { testGetBlockHeaders(t, 64) }
func TestGetBlockHeaders100(t *testing.T) { testGetBlockHeaders(t, 100) }
func testGetBlockHeaders(t *testing.T, protocol int) { func testGetBlockHeaders(t *testing.T, protocol int) {
pm, _ := newTestProtocolManagerMust(t, downloader.FullSync, downloader.MaxHashFetch+15, nil, nil) pm, _ := newTestProtocolManagerMust(t, downloader.FullSync, downloader.MaxHashFetch+15, nil, nil)
@ -201,6 +202,7 @@ func testGetBlockHeaders(t *testing.T, protocol int) {
// Tests that block contents can be retrieved from a remote chain based on their hashes. // Tests that block contents can be retrieved from a remote chain based on their hashes.
func TestGetBlockBodies63(t *testing.T) { testGetBlockBodies(t, 63) } func TestGetBlockBodies63(t *testing.T) { testGetBlockBodies(t, 63) }
func TestGetBlockBodies64(t *testing.T) { testGetBlockBodies(t, 64) } func TestGetBlockBodies64(t *testing.T) { testGetBlockBodies(t, 64) }
func TestGetBlockBodies100(t *testing.T) { testGetBlockBodies(t, 100)}
func testGetBlockBodies(t *testing.T, protocol int) { func testGetBlockBodies(t *testing.T, protocol int) {
pm, _ := newTestProtocolManagerMust(t, downloader.FullSync, downloader.MaxBlockFetch+15, nil, nil) pm, _ := newTestProtocolManagerMust(t, downloader.FullSync, downloader.MaxBlockFetch+15, nil, nil)
@ -273,6 +275,7 @@ func testGetBlockBodies(t *testing.T, protocol int) {
// Tests that the node state database can be retrieved based on hashes. // Tests that the node state database can be retrieved based on hashes.
func TestGetNodeData63(t *testing.T) { testGetNodeData(t, 63) } func TestGetNodeData63(t *testing.T) { testGetNodeData(t, 63) }
func TestGetNodeData64(t *testing.T) { testGetNodeData(t, 64) } func TestGetNodeData64(t *testing.T) { testGetNodeData(t, 64) }
func TestGetNodeData100(t *testing.T) { testGetNodeData(t, 100) }
func testGetNodeData(t *testing.T, protocol int) { func testGetNodeData(t *testing.T, protocol int) {
// Define three accounts to simulate transactions with // Define three accounts to simulate transactions with
@ -368,6 +371,7 @@ func testGetNodeData(t *testing.T, protocol int) {
// Tests that the transaction receipts can be retrieved based on hashes. // Tests that the transaction receipts can be retrieved based on hashes.
func TestGetReceipt63(t *testing.T) { testGetReceipt(t, 63) } func TestGetReceipt63(t *testing.T) { testGetReceipt(t, 63) }
func TestGetReceipt64(t *testing.T) { testGetReceipt(t, 64) } func TestGetReceipt64(t *testing.T) { testGetReceipt(t, 64) }
func TestGetReceipt100(t *testing.T) { testGetReceipt(t, 100) }
func testGetReceipt(t *testing.T, protocol int) { func testGetReceipt(t *testing.T, protocol int) {
// Define three accounts to simulate transactions with // Define three accounts to simulate transactions with

View file

@ -248,6 +248,7 @@ func TestForkIDSplit(t *testing.T) {
func TestRecvTransactions63(t *testing.T) { testRecvTransactions(t, 63) } func TestRecvTransactions63(t *testing.T) { testRecvTransactions(t, 63) }
func TestRecvTransactions64(t *testing.T) { testRecvTransactions(t, 64) } func TestRecvTransactions64(t *testing.T) { testRecvTransactions(t, 64) }
func TestRecvTransactions65(t *testing.T) { testRecvTransactions(t, 65) } func TestRecvTransactions65(t *testing.T) { testRecvTransactions(t, 65) }
func TestRecvTransactions100(t *testing.T) { testRecvTransactions(t, 100) }
func testRecvTransactions(t *testing.T, protocol int) { func testRecvTransactions(t *testing.T, protocol int) {
txAdded := make(chan []*types.Transaction) txAdded := make(chan []*types.Transaction)
@ -277,6 +278,7 @@ func testRecvTransactions(t *testing.T, protocol int) {
func TestSendTransactions63(t *testing.T) { testSendTransactions(t, 63) } func TestSendTransactions63(t *testing.T) { testSendTransactions(t, 63) }
func TestSendTransactions64(t *testing.T) { testSendTransactions(t, 64) } func TestSendTransactions64(t *testing.T) { testSendTransactions(t, 64) }
func TestSendTransactions65(t *testing.T) { testSendTransactions(t, 65) } func TestSendTransactions65(t *testing.T) { testSendTransactions(t, 65) }
func TestSendTransactions100(t *testing.T) { testSendTransactions(t, 100) } //TODO: fix
func testSendTransactions(t *testing.T, protocol int) { func testSendTransactions(t *testing.T, protocol int) {
pm, _ := newTestProtocolManagerMust(t, downloader.FullSync, 0, nil, nil) pm, _ := newTestProtocolManagerMust(t, downloader.FullSync, 0, nil, nil)
@ -345,6 +347,25 @@ func testSendTransactions(t *testing.T, protocol int) {
callback(h) callback(h)
} }
} }
case 100:
msg, err := p.app.ReadMsg()
if err != nil {
t.Errorf("%v: read error: %v", p.Peer, err)
continue
} else if msg.Code != NewPooledTransactionHashesMsg {
t.Errorf("%v: got code %d, want NewPooledTransactionHashesMsg", p.Peer, msg.Code)
continue
}
var hashes []common.Hash
if err := msg.Decode(&hashes); err != nil {
t.Errorf("%v: %v", p.Peer, err)
continue
}
forAllHashes = func(callback func(hash common.Hash)) {
for _, h := range hashes {
callback(h)
}
}
} }
forAllHashes(func(hash common.Hash) { forAllHashes(func(hash common.Hash) {
seentx, want := seen[hash] seentx, want := seen[hash]

View file

@ -29,6 +29,7 @@ import (
func TestFastSyncDisabling63(t *testing.T) { testFastSyncDisabling(t, 63) } func TestFastSyncDisabling63(t *testing.T) { testFastSyncDisabling(t, 63) }
func TestFastSyncDisabling64(t *testing.T) { testFastSyncDisabling(t, 64) } func TestFastSyncDisabling64(t *testing.T) { testFastSyncDisabling(t, 64) }
func TestFastSyncDisabling65(t *testing.T) { testFastSyncDisabling(t, 65) } func TestFastSyncDisabling65(t *testing.T) { testFastSyncDisabling(t, 65) }
func TestFastSyncDisabling100(t *testing.T) { testFastSyncDisabling(t, 100) }
// Tests that fast sync gets disabled as soon as a real block is successfully // Tests that fast sync gets disabled as soon as a real block is successfully
// imported into the blockchain. // imported into the blockchain.