Skip to content

Commit ede386c

Browse files
author
MarcoFalke
committed
Merge #11160: Improve versionbits_computeblockversion test code consistency
946638d Improve versionbits_computeblockversion test code consistency (danra) Pull request description: In this test, `nTime` is used for all the calls to `Mine()`, each time being set to the correct time beforehand, except for in the last few calls to `Mine()` where `nStartTime` is used directly, even though `nTime` is still set to `nStartTime` beforehand. `nTime` just remains unused for these last few calls to `Mine()`. Changed the last few calls to `Mine()` to use `nTime` instead, improving consistency. This also fixes an unused value static analyzer warning about `nTime` being set to a value which is never used. Tree-SHA512: f17cf1d29fd7097d53c0135d6357ee50943bd81b5ce0be785a37b85d34b5127cd6cc17ef844b519e19c33f2d96f7ababee643b9fba7afb031f444b2cfaeedbfd
2 parents a084767 + 946638d commit ede386c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/test/versionbits_tests.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -314,20 +314,20 @@ BOOST_AUTO_TEST_CASE(versionbits_computeblockversion)
314314

315315
// Mine one period worth of blocks, and check that the bit will be on for the
316316
// next period.
317-
lastBlock = secondChain.Mine(2016, nStartTime, VERSIONBITS_LAST_OLD_BLOCK_VERSION).Tip();
317+
lastBlock = secondChain.Mine(2016, nTime, VERSIONBITS_LAST_OLD_BLOCK_VERSION).Tip();
318318
BOOST_CHECK((ComputeBlockVersion(lastBlock, mainnetParams) & (1<<bit)) != 0);
319319

320320
// Mine another period worth of blocks, signaling the new bit.
321-
lastBlock = secondChain.Mine(4032, nStartTime, VERSIONBITS_TOP_BITS | (1<<bit)).Tip();
321+
lastBlock = secondChain.Mine(4032, nTime, VERSIONBITS_TOP_BITS | (1<<bit)).Tip();
322322
// After one period of setting the bit on each block, it should have locked in.
323323
// We keep setting the bit for one more period though, until activation.
324324
BOOST_CHECK((ComputeBlockVersion(lastBlock, mainnetParams) & (1<<bit)) != 0);
325325

326326
// Now check that we keep mining the block until the end of this period, and
327327
// then stop at the beginning of the next period.
328-
lastBlock = secondChain.Mine(6047, nStartTime, VERSIONBITS_LAST_OLD_BLOCK_VERSION).Tip();
328+
lastBlock = secondChain.Mine(6047, nTime, VERSIONBITS_LAST_OLD_BLOCK_VERSION).Tip();
329329
BOOST_CHECK((ComputeBlockVersion(lastBlock, mainnetParams) & (1<<bit)) != 0);
330-
lastBlock = secondChain.Mine(6048, nStartTime, VERSIONBITS_LAST_OLD_BLOCK_VERSION).Tip();
330+
lastBlock = secondChain.Mine(6048, nTime, VERSIONBITS_LAST_OLD_BLOCK_VERSION).Tip();
331331
BOOST_CHECK_EQUAL(ComputeBlockVersion(lastBlock, mainnetParams) & (1<<bit), 0);
332332

333333
// Finally, verify that after a soft fork has activated, CBV no longer uses

0 commit comments

Comments
 (0)