aboutsummaryrefslogtreecommitdiff
path: root/src/miner.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2016-10-18 21:11:22 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2016-10-18 21:16:08 +0200
commit744d2652dda0251bad7c1d8e3bbb468c2fe27510 (patch)
treee5ec5ff5dd0238954af403425b94a4e084369244 /src/miner.cpp
parente10af96cf450494fdb893b71540e709ed311b871 (diff)
parent9fce0629b437441cb09c14055ee810b8ee6b7978 (diff)
Merge #8223: [c++11] Use std::unique_ptr for block creation.
9fce062 [c++11] Use std::unique_ptr for block creation. (Daniel Kraft)
Diffstat (limited to 'src/miner.cpp')
-rw-r--r--src/miner.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/miner.cpp b/src/miner.cpp
index 9575858840..ebf2f21ffd 100644
--- a/src/miner.cpp
+++ b/src/miner.cpp
@@ -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)