Changeset View
Changeset View
Standalone View
Standalone View
src/test/test_bitcoin.cpp
Show First 20 Lines • Show All 176 Lines • ▼ Show 20 Lines | CBlock TestChain100Setup::CreateAndProcessBlock( | ||||
// Order transactions by canonical order | // Order transactions by canonical order | ||||
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; | |||||
{ | { | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
unsigned int extraNonce = 0; | |||||
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 = | ||||
Show All 24 Lines |