|
|
@ -129,6 +129,8 @@ void BlockAssembler::resetBlock() |
|
|
|
|
|
|
|
|
|
|
|
std::unique_ptr<CBlockTemplate> BlockAssembler::CreateNewBlock(const CScript& scriptPubKeyIn, bool fMineWitnessTx) |
|
|
|
std::unique_ptr<CBlockTemplate> BlockAssembler::CreateNewBlock(const CScript& scriptPubKeyIn, bool fMineWitnessTx) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
int64_t nTimeStart = GetTimeMicros(); |
|
|
|
|
|
|
|
|
|
|
|
resetBlock(); |
|
|
|
resetBlock(); |
|
|
|
|
|
|
|
|
|
|
|
pblocktemplate.reset(new CBlockTemplate()); |
|
|
|
pblocktemplate.reset(new CBlockTemplate()); |
|
|
@ -170,6 +172,8 @@ std::unique_ptr<CBlockTemplate> BlockAssembler::CreateNewBlock(const CScript& sc |
|
|
|
addPriorityTxs(); |
|
|
|
addPriorityTxs(); |
|
|
|
addPackageTxs(); |
|
|
|
addPackageTxs(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int64_t nTime1 = GetTimeMicros(); |
|
|
|
|
|
|
|
|
|
|
|
nLastBlockTx = nBlockTx; |
|
|
|
nLastBlockTx = nBlockTx; |
|
|
|
nLastBlockSize = nBlockSize; |
|
|
|
nLastBlockSize = nBlockSize; |
|
|
|
nLastBlockWeight = nBlockWeight; |
|
|
|
nLastBlockWeight = nBlockWeight; |
|
|
@ -200,6 +204,9 @@ std::unique_ptr<CBlockTemplate> BlockAssembler::CreateNewBlock(const CScript& sc |
|
|
|
if (!TestBlockValidity(state, chainparams, *pblock, pindexPrev, false, false)) { |
|
|
|
if (!TestBlockValidity(state, chainparams, *pblock, pindexPrev, false, false)) { |
|
|
|
throw std::runtime_error(strprintf("%s: TestBlockValidity failed: %s", __func__, FormatStateMessage(state))); |
|
|
|
throw std::runtime_error(strprintf("%s: TestBlockValidity failed: %s", __func__, FormatStateMessage(state))); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
int64_t nTime2 = GetTimeMicros(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LogPrint("bench", "CreateNewBlock() packages: %.2fms, validity: %.2fms (total %.2fms)\n", 0.001 * (nTime1 - nTimeStart), 0.001 * (nTime2 - nTime1), 0.001 * (nTime2 - nTimeStart)); |
|
|
|
|
|
|
|
|
|
|
|
return std::move(pblocktemplate); |
|
|
|
return std::move(pblocktemplate); |
|
|
|
} |
|
|
|
} |
|
|
|