Bugfix: make CreateNewBlock return pindexPrev

This commit is contained in:
Pieter Wuille
2015-03-31 20:35:04 -07:00
parent 6b04508e37
commit e2edf95cd3
4 changed files with 26 additions and 25 deletions

View File

@@ -475,7 +475,7 @@ Value getblocktemplate(const Array& params, bool fHelp)
// Store the pindexBest used before CreateNewBlock, to avoid races
nTransactionsUpdatedLast = mempool.GetTransactionsUpdated();
CBlockIndex* pindexPrevNew = chainActive.Tip();
CBlockIndex* pindexPrevNew;
nStart = GetTime();
// Create new block
@@ -485,7 +485,7 @@ Value getblocktemplate(const Array& params, bool fHelp)
pblocktemplate = NULL;
}
CScript scriptDummy = CScript() << OP_TRUE;
pblocktemplate = CreateNewBlock(scriptDummy);
pblocktemplate = CreateNewBlock(scriptDummy, pindexPrevNew);
if (!pblocktemplate)
throw JSONRPCError(RPC_OUT_OF_MEMORY, "Out of memory");