@@ -201,7 +201,6 @@ BOOST_AUTO_TEST_CASE(PartitionAlert)
201201{
202202 // Test PartitionCheck
203203 CCriticalSection csDummy;
204- CChain chainDummy;
205204 CBlockIndex indexDummy[100 ];
206205 CChainParams& params = Params (CBaseChainParams::MAIN);
207206 int64_t nPowTargetSpacing = params.GetConsensus ().nPowTargetSpacing ;
@@ -220,17 +219,16 @@ BOOST_AUTO_TEST_CASE(PartitionAlert)
220219 // Other members don't matter, the partition check code doesn't
221220 // use them
222221 }
223- chainDummy.SetTip (&indexDummy[99 ]);
224222
225223 // Test 1: chain with blocks every nPowTargetSpacing seconds,
226224 // as normal, no worries:
227- PartitionCheck (falseFunc, csDummy, chainDummy , nPowTargetSpacing);
225+ PartitionCheck (falseFunc, csDummy, &indexDummy[ 99 ] , nPowTargetSpacing);
228226 BOOST_CHECK (strMiscWarning.empty ());
229227
230228 // Test 2: go 3.5 hours without a block, expect a warning:
231229 now += 3 *60 *60 +30 *60 ;
232230 SetMockTime (now);
233- PartitionCheck (falseFunc, csDummy, chainDummy , nPowTargetSpacing);
231+ PartitionCheck (falseFunc, csDummy, &indexDummy[ 99 ] , nPowTargetSpacing);
234232 BOOST_CHECK (!strMiscWarning.empty ());
235233 BOOST_TEST_MESSAGE (std::string (" Got alert text: " )+strMiscWarning);
236234 strMiscWarning = " " ;
@@ -239,7 +237,7 @@ BOOST_AUTO_TEST_CASE(PartitionAlert)
239237 // code:
240238 now += 60 *10 ;
241239 SetMockTime (now);
242- PartitionCheck (falseFunc, csDummy, chainDummy , nPowTargetSpacing);
240+ PartitionCheck (falseFunc, csDummy, &indexDummy[ 99 ] , nPowTargetSpacing);
243241 BOOST_CHECK (strMiscWarning.empty ());
244242
245243 // Test 4: get 2.5 times as many blocks as expected:
@@ -248,7 +246,7 @@ BOOST_AUTO_TEST_CASE(PartitionAlert)
248246 int64_t quickSpacing = nPowTargetSpacing*2 /5 ;
249247 for (int i = 0 ; i < 100 ; i++) // Tweak chain timestamps:
250248 indexDummy[i].nTime = now - (100 -i)*quickSpacing;
251- PartitionCheck (falseFunc, csDummy, chainDummy , nPowTargetSpacing);
249+ PartitionCheck (falseFunc, csDummy, &indexDummy[ 99 ] , nPowTargetSpacing);
252250 BOOST_CHECK (!strMiscWarning.empty ());
253251 BOOST_TEST_MESSAGE (std::string (" Got alert text: " )+strMiscWarning);
254252 strMiscWarning = " " ;
0 commit comments