Changeset View
Changeset View
Standalone View
Standalone View
src/test/test_bitcoin.cpp
Show All 20 Lines | |||||
#include "script/sigcache.h" | #include "script/sigcache.h" | ||||
#include "txdb.h" | #include "txdb.h" | ||||
#include "txmempool.h" | #include "txmempool.h" | ||||
#include "ui_interface.h" | #include "ui_interface.h" | ||||
#include "validation.h" | #include "validation.h" | ||||
#include "test/testutil.h" | #include "test/testutil.h" | ||||
#include <cstdio> | |||||
#include <iostream> | |||||
#include <atomic> | #include <atomic> | ||||
#include <chrono> | #include <chrono> | ||||
#include <condition_variable> | #include <condition_variable> | ||||
#include <cstdio> | |||||
#include <functional> | #include <functional> | ||||
#include <list> | #include <list> | ||||
#include <memory> | #include <memory> | ||||
#include <thread> | #include <thread> | ||||
#include <boost/filesystem.hpp> | #include <boost/filesystem.hpp> | ||||
#include <boost/test/unit_test.hpp> | #include <boost/test/unit_test.hpp> | ||||
#include <boost/thread.hpp> | #include <boost/thread.hpp> | ||||
▲ Show 20 Lines • Show All 101 Lines • ▼ Show 20 Lines | CBlock TestChain100Setup::CreateAndProcessBlock( | ||||
block.vtx.resize(1); | block.vtx.resize(1); | ||||
for (const CMutableTransaction &tx : txns) { | for (const CMutableTransaction &tx : txns) { | ||||
block.vtx.push_back(MakeTransactionRef(tx)); | block.vtx.push_back(MakeTransactionRef(tx)); | ||||
} | } | ||||
// IncrementExtraNonce creates a valid coinbase and merkleRoot | // IncrementExtraNonce creates a valid coinbase and merkleRoot | ||||
unsigned int extraNonce = 0; | unsigned int extraNonce = 0; | ||||
IncrementExtraNonce(config, &block, chainActive.Tip(), extraNonce); | IncrementExtraNonce(config, &block, chainActive.Tip(), extraNonce); | ||||
while (!CheckProofOfWork(block.GetHash(), block.nBits, | while (!CheckProofOfWork(block.GetHash(), block.nBits, config)) { | ||||
chainparams.GetConsensus())) { | |||||
++block.nNonce; | ++block.nNonce; | ||||
} | } | ||||
std::shared_ptr<const CBlock> shared_pblock = | std::shared_ptr<const CBlock> shared_pblock = | ||||
std::make_shared<const CBlock>(block); | std::make_shared<const CBlock>(block); | ||||
ProcessNewBlock(GetConfig(), shared_pblock, true, nullptr); | ProcessNewBlock(GetConfig(), shared_pblock, true, nullptr); | ||||
CBlock result = block; | CBlock result = block; | ||||
▲ Show 20 Lines • Show All 103 Lines • Show Last 20 Lines |