@@ -39,7 +39,7 @@ import (
3939func init () {
4040 fullMaxForkAncestry = 10000
4141 lightMaxForkAncestry = 10000
42- blockCacheItems = 1024
42+ blockCacheMaxItems = 1024
4343 fsHeaderContCheck = 500 * time .Millisecond
4444}
4545
@@ -544,7 +544,7 @@ func testCanonicalSynchronisation(t *testing.T, protocol int, mode SyncMode) {
544544 defer tester .terminate ()
545545
546546 // Create a small enough block chain to download
547- chain := testChainBase .shorten (blockCacheItems - 15 )
547+ chain := testChainBase .shorten (blockCacheMaxItems - 15 )
548548 tester .newPeer ("peer" , protocol , chain )
549549
550550 // 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) {
607607 }
608608 tester .lock .Unlock ()
609609
610- if cached == blockCacheItems ||
611- cached == blockCacheItems - reorgProtHeaderDelay ||
610+ if cached == blockCacheMaxItems ||
611+ cached == blockCacheMaxItems - reorgProtHeaderDelay ||
612612 retrieved + cached + frozen == targetBlocks + 1 ||
613613 retrieved + cached + frozen == targetBlocks + 1 - reorgProtHeaderDelay {
614614 break
@@ -619,8 +619,8 @@ func testThrottling(t *testing.T, protocol int, mode SyncMode) {
619619 tester .lock .RLock ()
620620 retrieved = len (tester .ownBlocks )
621621 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 )
624624 }
625625
626626 // Permit the blocked blocks to import
@@ -873,7 +873,7 @@ func testMultiProtoSync(t *testing.T, protocol int, mode SyncMode) {
873873 defer tester .terminate ()
874874
875875 // Create a small enough block chain to download
876- chain := testChainBase .shorten (blockCacheItems - 15 )
876+ chain := testChainBase .shorten (blockCacheMaxItems - 15 )
877877
878878 // Create peers of every type
879879 tester .newPeer ("peer 63" , 63 , chain )
@@ -965,7 +965,7 @@ func testMissingHeaderAttack(t *testing.T, protocol int, mode SyncMode) {
965965 tester := newTester ()
966966 defer tester .terminate ()
967967
968- chain := testChainBase .shorten (blockCacheItems - 15 )
968+ chain := testChainBase .shorten (blockCacheMaxItems - 15 )
969969 brokenChain := chain .shorten (chain .len ())
970970 delete (brokenChain .headerm , brokenChain .chain [brokenChain .len ()/ 2 ])
971971 tester .newPeer ("attack" , protocol , brokenChain )
@@ -997,7 +997,7 @@ func testShiftedHeaderAttack(t *testing.T, protocol int, mode SyncMode) {
997997 tester := newTester ()
998998 defer tester .terminate ()
999999
1000- chain := testChainBase .shorten (blockCacheItems - 15 )
1000+ chain := testChainBase .shorten (blockCacheMaxItems - 15 )
10011001
10021002 // Attempt a full sync with an attacker feeding shifted headers
10031003 brokenChain := chain .shorten (chain .len ())
@@ -1202,7 +1202,7 @@ func testSyncProgress(t *testing.T, protocol int, mode SyncMode) {
12021202
12031203 tester := newTester ()
12041204 defer tester .terminate ()
1205- chain := testChainBase .shorten (blockCacheItems - 15 )
1205+ chain := testChainBase .shorten (blockCacheMaxItems - 15 )
12061206
12071207 // Set a sync init hook to catch progress changes
12081208 starting := make (chan struct {})
@@ -1362,7 +1362,7 @@ func testFailedSyncProgress(t *testing.T, protocol int, mode SyncMode) {
13621362
13631363 tester := newTester ()
13641364 defer tester .terminate ()
1365- chain := testChainBase .shorten (blockCacheItems - 15 )
1365+ chain := testChainBase .shorten (blockCacheMaxItems - 15 )
13661366
13671367 // Set a sync init hook to catch progress changes
13681368 starting := make (chan struct {})
@@ -1435,7 +1435,7 @@ func testFakedSyncProgress(t *testing.T, protocol int, mode SyncMode) {
14351435
14361436 tester := newTester ()
14371437 defer tester .terminate ()
1438- chain := testChainBase .shorten (blockCacheItems - 15 )
1438+ chain := testChainBase .shorten (blockCacheMaxItems - 15 )
14391439
14401440 // Set a sync init hook to catch progress changes
14411441 starting := make (chan struct {})
0 commit comments