aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_bitcoin.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/test_bitcoin.cpp')
-rw-r--r--src/test/test_bitcoin.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/test/test_bitcoin.cpp b/src/test/test_bitcoin.cpp
index 3ba81ed17b..94ec7c03f5 100644
--- a/src/test/test_bitcoin.cpp
+++ b/src/test/test_bitcoin.cpp
@@ -7,6 +7,7 @@
#include "chainparams.h"
#include "consensus/consensus.h"
#include "consensus/validation.h"
+#include "crypto/sha256.h"
#include "fs.h"
#include "key.h"
#include "validation.h"
@@ -33,6 +34,7 @@ extern void noui_connect();
BasicTestingSetup::BasicTestingSetup(const std::string& chainName)
{
+ SHA256AutoDetect();
RandomInit();
ECC_Start();
SetupEnvironment();
@@ -61,7 +63,7 @@ TestingSetup::TestingSetup(const std::string& chainName) : BasicTestingSetup(cha
ClearDatadirCache();
pathTemp = GetTempPath() / strprintf("test_bitcoin_%lu_%i", (unsigned long)GetTime(), (int)(InsecureRandRange(100000)));
fs::create_directories(pathTemp);
- ForceSetArg("-datadir", pathTemp.string());
+ gArgs.ForceSetArg("-datadir", pathTemp.string());
// Note that because we don't bother running a scheduler thread here,
// callbacks via CValidationInterface are unreliable, but that's OK,
@@ -72,8 +74,8 @@ TestingSetup::TestingSetup(const std::string& chainName) : BasicTestingSetup(cha
pblocktree = new CBlockTreeDB(1 << 20, true);
pcoinsdbview = new CCoinsViewDB(1 << 23, true);
pcoinsTip = new CCoinsViewCache(pcoinsdbview);
- if (!InitBlockIndex(chainparams)) {
- throw std::runtime_error("InitBlockIndex failed.");
+ if (!LoadGenesisBlock(chainparams)) {
+ throw std::runtime_error("LoadGenesisBlock failed.");
}
{
CValidationState state;
@@ -138,7 +140,7 @@ TestChain100Setup::CreateAndProcessBlock(const std::vector<CMutableTransaction>&
while (!CheckProofOfWork(block.GetHash(), block.nBits, chainparams.GetConsensus())) ++block.nNonce;
std::shared_ptr<const CBlock> shared_pblock = std::make_shared<const CBlock>(block);
- ProcessNewBlock(chainparams, shared_pblock, true, NULL);
+ ProcessNewBlock(chainparams, shared_pblock, true, nullptr);
CBlock result = block;
return result;