Switch pblock in ProcessNewBlock to a shared_ptr

This (finally) fixes a performance regression in
b3b3c2a562
This commit is contained in:
Matt Corallo
2016-12-04 00:17:30 -08:00
parent 2736c44c8e
commit 2d6e5619af
6 changed files with 20 additions and 21 deletions

View File

@@ -223,7 +223,8 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
txFirst.push_back(pblock->vtx[0]);
pblock->hashMerkleRoot = BlockMerkleRoot(*pblock);
pblock->nNonce = blockinfo[i].nonce;
BOOST_CHECK(ProcessNewBlock(chainparams, pblock, true, NULL, NULL));
std::shared_ptr<const CBlock> shared_pblock = std::make_shared<const CBlock>(*pblock);
BOOST_CHECK(ProcessNewBlock(chainparams, shared_pblock, true, NULL, NULL));
pblock->hashPrevBlock = pblock->GetHash();
}