CreateNewBlock
returns a pointer for which the caller takes ownership. Use std::unique_ptr
to make this explicit and simplify handling of these objects in getblocktemplate
.
CreateNewBlock
returns a pointer for which the caller takes ownership. Use std::unique_ptr
to make this explicit and simplify handling of these objects in getblocktemplate
.
CreateNewBlock returns a pointer for which the caller takes ownership.
Use std::unique_ptr to make this explicit and simplify handling of these
objects in getblocktemplate.
164@@ -164,7 +165,7 @@ CBlockTemplate* BlockAssembler::CreateNewBlock(const CScript& scriptPubKeyIn)
165 throw std::runtime_error(strprintf("%s: TestBlockValidity failed: %s", __func__, FormatStateMessage(state)));
166 }
167
168- return pblocktemplate.release();
169+ return std::move(pblocktemplate);
pblocktemplate
is a member variable and not a local one, I think the code does not compile without std::move
.
159@@ -160,7 +160,7 @@ class BlockAssembler
160 public:
161 BlockAssembler(const CChainParams& chainparams);
162 /** Construct a new block template with coinbase to scriptPubKeyIn */
163- CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn);
164+ std::unique_ptr<CBlockTemplate> CreateNewBlock(const CScript& scriptPubKeyIn);
unique_ptr
?
This is probably the kind of c++11 refactoring that we want to leave for later.