diff --git a/src/miner.cpp b/src/miner.cpp index 2272e1a94d483..41df3fca61cd7 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -172,9 +172,9 @@ std::unique_ptr BlockAssembler::CreateNewBlock(const CScript& sc // Update coinbase transaction with additional info about masternode and governance payments, // get some info back to pass to getblocktemplate - FillBlockPayments(coinbaseTx, nHeight, blockReward, pblock->txoutMasternode, pblock->voutSuperblock); + FillBlockPayments(coinbaseTx, nHeight, blockReward, pblocktemplate->txoutMasternode, pblocktemplate->voutSuperblock); // LogPrintf("CreateNewBlock -- nBlockHeight %d blockReward %lld txoutMasternode %s coinbaseTx %s", - // nHeight, blockReward, pblock->txoutMasternode.ToString(), coinbaseTx.ToString()); + // nHeight, blockReward, pblocktemplate->txoutMasternode.ToString(), coinbaseTx.ToString()); pblock->vtx[0] = MakeTransactionRef(std::move(coinbaseTx)); pblocktemplate->vTxFees[0] = -nFees; diff --git a/src/miner.h b/src/miner.h index de46fe2c7c9b3..7a46f18f1303a 100644 --- a/src/miner.h +++ b/src/miner.h @@ -30,6 +30,8 @@ struct CBlockTemplate CBlock block; std::vector vTxFees; std::vector vTxSigOps; + CTxOut txoutMasternode; // masternode payment + std::vector voutSuperblock; // superblock payment }; // Container for tracking updates to ancestor feerate as we include (parent) diff --git a/src/primitives/block.h b/src/primitives/block.h index adfccf10ebf12..772cbab5c1ea8 100644 --- a/src/primitives/block.h +++ b/src/primitives/block.h @@ -79,8 +79,6 @@ class CBlock : public CBlockHeader std::vector vtx; // memory only - mutable CTxOut txoutMasternode; // masternode payment - mutable std::vector voutSuperblock; // superblock payment mutable bool fChecked; CBlock() @@ -106,8 +104,6 @@ class CBlock : public CBlockHeader { CBlockHeader::SetNull(); vtx.clear(); - txoutMasternode = CTxOut(); - voutSuperblock.clear(); fChecked = false; } diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp index 340fe95cc8bd9..e7acf9960bc25 100644 --- a/src/rpc/mining.cpp +++ b/src/rpc/mining.cpp @@ -702,21 +702,21 @@ UniValue getblocktemplate(const JSONRPCRequest& request) result.push_back(Pair("height", (int64_t)(pindexPrev->nHeight+1))); UniValue masternodeObj(UniValue::VOBJ); - if(pblock->txoutMasternode != CTxOut()) { + if(pblocktemplate->txoutMasternode != CTxOut()) { CTxDestination address1; - ExtractDestination(pblock->txoutMasternode.scriptPubKey, address1); + ExtractDestination(pblocktemplate->txoutMasternode.scriptPubKey, address1); CBitcoinAddress address2(address1); masternodeObj.push_back(Pair("payee", address2.ToString().c_str())); - masternodeObj.push_back(Pair("script", HexStr(pblock->txoutMasternode.scriptPubKey))); - masternodeObj.push_back(Pair("amount", pblock->txoutMasternode.nValue)); + masternodeObj.push_back(Pair("script", HexStr(pblocktemplate->txoutMasternode.scriptPubKey))); + masternodeObj.push_back(Pair("amount", pblocktemplate->txoutMasternode.nValue)); } result.push_back(Pair("masternode", masternodeObj)); result.push_back(Pair("masternode_payments_started", pindexPrev->nHeight + 1 > consensusParams.nMasternodePaymentsStartBlock)); result.push_back(Pair("masternode_payments_enforced", sporkManager.IsSporkActive(SPORK_8_MASTERNODE_PAYMENT_ENFORCEMENT))); UniValue superblockObjArray(UniValue::VARR); - if(pblock->voutSuperblock.size()) { - for (const auto& txout : pblock->voutSuperblock) { + if(pblocktemplate->voutSuperblock.size()) { + for (const auto& txout : pblocktemplate->voutSuperblock) { UniValue entry(UniValue::VOBJ); CTxDestination address1; ExtractDestination(txout.scriptPubKey, address1);