Changeset View
Changeset View
Standalone View
Standalone View
src/test/test_bitcoin.cpp
Show First 20 Lines • Show All 177 Lines • ▼ Show 20 Lines | CBlock TestChain100Setup::CreateAndProcessBlock( | ||||
std::sort(std::begin(block.vtx) + 1, std::end(block.vtx), | std::sort(std::begin(block.vtx) + 1, std::end(block.vtx), | ||||
[](const std::shared_ptr<const CTransaction> &txa, | [](const std::shared_ptr<const CTransaction> &txa, | ||||
const std::shared_ptr<const CTransaction> &txb) -> bool { | const std::shared_ptr<const CTransaction> &txb) -> bool { | ||||
return txa->GetId() < txb->GetId(); | return txa->GetId() < txb->GetId(); | ||||
}); | }); | ||||
// IncrementExtraNonce creates a valid coinbase and merkleRoot | // IncrementExtraNonce creates a valid coinbase and merkleRoot | ||||
unsigned int extraNonce = 0; | unsigned int extraNonce = 0; | ||||
{ | |||||
LOCK(cs_main); | |||||
IncrementExtraNonce(config, &block, chainActive.Tip(), extraNonce); | IncrementExtraNonce(config, &block, chainActive.Tip(), extraNonce); | ||||
} | |||||
while (!CheckProofOfWork(block.GetHash(), block.nBits, config)) { | while (!CheckProofOfWork(block.GetHash(), block.nBits, config)) { | ||||
++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); | ||||
▲ Show 20 Lines • Show All 92 Lines • Show Last 20 Lines |