Changeset View
Changeset View
Standalone View
Standalone View
src/node/miner.cpp
Show First 20 Lines • Show All 187 Lines • ▼ Show 20 Lines | BlockAssembler::CreateNewBlock(const CScript &scriptPubKeyIn) { | ||||
coinbaseTx.vin.resize(1); | coinbaseTx.vin.resize(1); | ||||
coinbaseTx.vin[0].prevout = COutPoint(); | coinbaseTx.vin[0].prevout = COutPoint(); | ||||
coinbaseTx.vout.resize(1); | coinbaseTx.vout.resize(1); | ||||
coinbaseTx.vout[0].scriptPubKey = scriptPubKeyIn; | coinbaseTx.vout[0].scriptPubKey = scriptPubKeyIn; | ||||
coinbaseTx.vout[0].nValue = | coinbaseTx.vout[0].nValue = | ||||
nFees + GetBlockSubsidy(nHeight, consensusParams); | nFees + GetBlockSubsidy(nHeight, consensusParams); | ||||
coinbaseTx.vin[0].scriptSig = CScript() << nHeight << OP_0; | coinbaseTx.vin[0].scriptSig = CScript() << nHeight << OP_0; | ||||
const std::vector<CTxDestination> whitelisted = | const std::vector<CTxDestination> whitelisted = GetMinerFundWhitelist( | ||||
GetMinerFundWhitelist(consensusParams, pindexPrev); | consensusParams, pindexPrev, | ||||
MinerFundFlags::CONSENSUS | MinerFundFlags::POLICY); | |||||
if (!whitelisted.empty()) { | if (!whitelisted.empty()) { | ||||
const Amount fund = GetMinerFundAmount(coinbaseTx.vout[0].nValue); | const Amount fund = GetMinerFundAmount(coinbaseTx.vout[0].nValue); | ||||
coinbaseTx.vout[0].nValue -= fund; | coinbaseTx.vout[0].nValue -= fund; | ||||
coinbaseTx.vout.emplace_back(fund, | coinbaseTx.vout.emplace_back(fund, | ||||
GetScriptForDestination(whitelisted[0])); | GetScriptForDestination(whitelisted[0])); | ||||
} | } | ||||
// Make sure the coinbase is big enough. | // Make sure the coinbase is big enough. | ||||
▲ Show 20 Lines • Show All 369 Lines • Show Last 20 Lines |