Test does not compile: src/test/miner_tests.cpp #119

Closed
opened 2024-11-20 09:13:14 +00:00 by MagicalTux · 0 comments
MagicalTux commented 2024-11-20 09:13:14 +00:00 (Migrated from github.com)

The rest of the code is adjusted to use ::ChainActive() but two calls to chainActive are remaining.

Following fix fixes the issue:

diff '--color=auto' -bBrU3 monacoin-0.20.4.orig/src/test/miner_tests.cpp monacoin-0.20.4/src/test/miner_tests.cpp
--- monacoin-0.20.4.orig/src/test/miner_tests.cpp	2024-11-20 12:23:57.383901691 +0900
+++ monacoin-0.20.4/src/test/miner_tests.cpp	2024-11-20 18:09:28.117646995 +0900
@@ -386,8 +386,8 @@
     }
     BOOST_CHECK(pblocktemplate = AssemblerForTest(chainparams).CreateNewBlock(scriptPubKey));
     // Extend to a 210000-long block chain.
-    while (chainActive.Tip()->nHeight < 105120000) {
-        CBlockIndex* prev = chainActive.Tip();
+    while (::ChainActive().Tip()->nHeight < 105120000) {
+        CBlockIndex* prev = ::ChainActive().Tip();
         CBlockIndex* next = new CBlockIndex();
         next->phashBlock = new uint256(InsecureRand256());
         ::ChainstateActive().CoinsTip().SetBestBlock(next->GetBlockHash());
The rest of the code is adjusted to use `::ChainActive()` but two calls to `chainActive` are remaining. Following fix fixes the issue: ```patch diff '--color=auto' -bBrU3 monacoin-0.20.4.orig/src/test/miner_tests.cpp monacoin-0.20.4/src/test/miner_tests.cpp --- monacoin-0.20.4.orig/src/test/miner_tests.cpp 2024-11-20 12:23:57.383901691 +0900 +++ monacoin-0.20.4/src/test/miner_tests.cpp 2024-11-20 18:09:28.117646995 +0900 @@ -386,8 +386,8 @@ } BOOST_CHECK(pblocktemplate = AssemblerForTest(chainparams).CreateNewBlock(scriptPubKey)); // Extend to a 210000-long block chain. - while (chainActive.Tip()->nHeight < 105120000) { - CBlockIndex* prev = chainActive.Tip(); + while (::ChainActive().Tip()->nHeight < 105120000) { + CBlockIndex* prev = ::ChainActive().Tip(); CBlockIndex* next = new CBlockIndex(); next->phashBlock = new uint256(InsecureRand256()); ::ChainstateActive().CoinsTip().SetBestBlock(next->GetBlockHash()); ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Core-Wallets/monacoin#119
No description provided.