https://travis-ci.org/github/bitcoin/bitcoin/jobs/680452476#L6107
pindexPrev = nullptr;
        
        nTransactionsUpdatedLast = mempool.GetTransactionsUpdated();
        CBlockIndex* pindexPrevNew = ::ChainActive().Tip();
        nStart = GetTime();
        
        CScript scriptDummy = CScript() << OP_TRUE;
        pblocktemplate = BlockAssembler(mempool, Params()).CreateNewBlock(scriptDummy);
        if (!pblocktemplate)
            throw JSONRPCError(RPC_OUT_OF_MEMORY, "Out of memory");
        
        pindexPrev = pindexPrevNew;
    }
    CHECK_NONFATAL(pindexPrev);
    CBlock* pblock = &pblocktemplate->block; 
    const Consensus::Params& consensusParams = Params().GetConsensus();
    
    UpdateTime(pblock, consensusParams, pindexPrev);
    pblock->nNonce = 0;
    
    const bool fPreSegWit = (pindexPrev->nHeight + 1 < consensusParams.SegwitHeight);
    UniValue aCaps(UniValue::VARR); aCaps.push_back("proposal");
    UniValue transactions(UniValue::VARR);
    std::map<uint256, int64_t> setTxIndex;
    int i = 0;
    for (const auto& it : pblock->vtx) {
        const CTransaction& tx = *it;
        uint256 txHash = tx.GetHash();
        setTxIndex[txHash] = i++;