mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 14:38:29 +01:00
Merge #8223: [c++11] Use std::unique_ptr for block creation.
9fce062 [c++11] Use std::unique_ptr for block creation. (Daniel Kraft)
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
#include <boost/thread.hpp>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <queue>
|
||||
#include <utility>
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -122,14 +123,14 @@ void BlockAssembler::resetBlock()
|
||||
blockFinished = false;
|
||||
}
|
||||
|
||||
CBlockTemplate* BlockAssembler::CreateNewBlock(const CScript& scriptPubKeyIn)
|
||||
std::unique_ptr<CBlockTemplate> BlockAssembler::CreateNewBlock(const CScript& scriptPubKeyIn)
|
||||
{
|
||||
resetBlock();
|
||||
|
||||
pblocktemplate.reset(new CBlockTemplate());
|
||||
|
||||
if(!pblocktemplate.get())
|
||||
return NULL;
|
||||
return nullptr;
|
||||
pblock = &pblocktemplate->block; // pointer for convenience
|
||||
|
||||
// Add dummy coinbase tx as first transaction
|
||||
@@ -194,7 +195,7 @@ CBlockTemplate* BlockAssembler::CreateNewBlock(const CScript& scriptPubKeyIn)
|
||||
throw std::runtime_error(strprintf("%s: TestBlockValidity failed: %s", __func__, FormatStateMessage(state)));
|
||||
}
|
||||
|
||||
return pblocktemplate.release();
|
||||
return std::move(pblocktemplate);
|
||||
}
|
||||
|
||||
bool BlockAssembler::isStillDependent(CTxMemPool::txiter iter)
|
||||
|
||||
Reference in New Issue
Block a user