@@ -39,7 +39,7 @@ import (
39
39
func init () {
40
40
fullMaxForkAncestry = 10000
41
41
lightMaxForkAncestry = 10000
42
- blockCacheItems = 1024
42
+ blockCacheMaxItems = 1024
43
43
fsHeaderContCheck = 500 * time .Millisecond
44
44
}
45
45
@@ -544,7 +544,7 @@ func testCanonicalSynchronisation(t *testing.T, protocol int, mode SyncMode) {
544
544
defer tester .terminate ()
545
545
546
546
// Create a small enough block chain to download
547
- chain := testChainBase .shorten (blockCacheItems - 15 )
547
+ chain := testChainBase .shorten (blockCacheMaxItems - 15 )
548
548
tester .newPeer ("peer" , protocol , chain )
549
549
550
550
// Synchronise with the peer and make sure all relevant data was retrieved
@@ -607,8 +607,8 @@ func testThrottling(t *testing.T, protocol int, mode SyncMode) {
607
607
}
608
608
tester .lock .Unlock ()
609
609
610
- if cached == blockCacheItems ||
611
- cached == blockCacheItems - reorgProtHeaderDelay ||
610
+ if cached == blockCacheMaxItems ||
611
+ cached == blockCacheMaxItems - reorgProtHeaderDelay ||
612
612
retrieved + cached + frozen == targetBlocks + 1 ||
613
613
retrieved + cached + frozen == targetBlocks + 1 - reorgProtHeaderDelay {
614
614
break
@@ -619,8 +619,8 @@ func testThrottling(t *testing.T, protocol int, mode SyncMode) {
619
619
tester .lock .RLock ()
620
620
retrieved = len (tester .ownBlocks )
621
621
tester .lock .RUnlock ()
622
- if cached != blockCacheItems && cached != blockCacheItems - reorgProtHeaderDelay && retrieved + cached + frozen != targetBlocks + 1 && retrieved + cached + frozen != targetBlocks + 1 - reorgProtHeaderDelay {
623
- t .Fatalf ("block count mismatch: have %v, want %v (owned %v, blocked %v, target %v)" , cached , blockCacheItems , retrieved , frozen , targetBlocks + 1 )
622
+ if cached != blockCacheMaxItems && cached != blockCacheMaxItems - reorgProtHeaderDelay && retrieved + cached + frozen != targetBlocks + 1 && retrieved + cached + frozen != targetBlocks + 1 - reorgProtHeaderDelay {
623
+ t .Fatalf ("block count mismatch: have %v, want %v (owned %v, blocked %v, target %v)" , cached , blockCacheMaxItems , retrieved , frozen , targetBlocks + 1 )
624
624
}
625
625
626
626
// Permit the blocked blocks to import
@@ -873,7 +873,7 @@ func testMultiProtoSync(t *testing.T, protocol int, mode SyncMode) {
873
873
defer tester .terminate ()
874
874
875
875
// Create a small enough block chain to download
876
- chain := testChainBase .shorten (blockCacheItems - 15 )
876
+ chain := testChainBase .shorten (blockCacheMaxItems - 15 )
877
877
878
878
// Create peers of every type
879
879
tester .newPeer ("peer 63" , 63 , chain )
@@ -965,7 +965,7 @@ func testMissingHeaderAttack(t *testing.T, protocol int, mode SyncMode) {
965
965
tester := newTester ()
966
966
defer tester .terminate ()
967
967
968
- chain := testChainBase .shorten (blockCacheItems - 15 )
968
+ chain := testChainBase .shorten (blockCacheMaxItems - 15 )
969
969
brokenChain := chain .shorten (chain .len ())
970
970
delete (brokenChain .headerm , brokenChain .chain [brokenChain .len ()/ 2 ])
971
971
tester .newPeer ("attack" , protocol , brokenChain )
@@ -997,7 +997,7 @@ func testShiftedHeaderAttack(t *testing.T, protocol int, mode SyncMode) {
997
997
tester := newTester ()
998
998
defer tester .terminate ()
999
999
1000
- chain := testChainBase .shorten (blockCacheItems - 15 )
1000
+ chain := testChainBase .shorten (blockCacheMaxItems - 15 )
1001
1001
1002
1002
// Attempt a full sync with an attacker feeding shifted headers
1003
1003
brokenChain := chain .shorten (chain .len ())
@@ -1202,7 +1202,7 @@ func testSyncProgress(t *testing.T, protocol int, mode SyncMode) {
1202
1202
1203
1203
tester := newTester ()
1204
1204
defer tester .terminate ()
1205
- chain := testChainBase .shorten (blockCacheItems - 15 )
1205
+ chain := testChainBase .shorten (blockCacheMaxItems - 15 )
1206
1206
1207
1207
// Set a sync init hook to catch progress changes
1208
1208
starting := make (chan struct {})
@@ -1362,7 +1362,7 @@ func testFailedSyncProgress(t *testing.T, protocol int, mode SyncMode) {
1362
1362
1363
1363
tester := newTester ()
1364
1364
defer tester .terminate ()
1365
- chain := testChainBase .shorten (blockCacheItems - 15 )
1365
+ chain := testChainBase .shorten (blockCacheMaxItems - 15 )
1366
1366
1367
1367
// Set a sync init hook to catch progress changes
1368
1368
starting := make (chan struct {})
@@ -1435,7 +1435,7 @@ func testFakedSyncProgress(t *testing.T, protocol int, mode SyncMode) {
1435
1435
1436
1436
tester := newTester ()
1437
1437
defer tester .terminate ()
1438
- chain := testChainBase .shorten (blockCacheItems - 15 )
1438
+ chain := testChainBase .shorten (blockCacheMaxItems - 15 )
1439
1439
1440
1440
// Set a sync init hook to catch progress changes
1441
1441
starting := make (chan struct {})
0 commit comments