mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 23:18:14 +01:00
Refactor CreateNewBlock to be a method of the BlockAssembler class
This commit is contained in:
@@ -111,7 +111,7 @@ UniValue generateBlocks(boost::shared_ptr<CReserveScript> coinbaseScript, int nG
|
||||
UniValue blockHashes(UniValue::VARR);
|
||||
while (nHeight < nHeightEnd)
|
||||
{
|
||||
std::unique_ptr<CBlockTemplate> pblocktemplate(CreateNewBlock(Params(), coinbaseScript->reserveScript));
|
||||
std::unique_ptr<CBlockTemplate> pblocktemplate(BlockAssembler(Params()).CreateNewBlock(coinbaseScript->reserveScript));
|
||||
if (!pblocktemplate.get())
|
||||
throw JSONRPCError(RPC_INTERNAL_ERROR, "Couldn't create new block");
|
||||
CBlock *pblock = &pblocktemplate->block;
|
||||
@@ -493,7 +493,7 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp)
|
||||
pblocktemplate = NULL;
|
||||
}
|
||||
CScript scriptDummy = CScript() << OP_TRUE;
|
||||
pblocktemplate = CreateNewBlock(Params(), scriptDummy);
|
||||
pblocktemplate = BlockAssembler(Params()).CreateNewBlock(scriptDummy);
|
||||
if (!pblocktemplate)
|
||||
throw JSONRPCError(RPC_OUT_OF_MEMORY, "Out of memory");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user