Changeset View
Changeset View
Standalone View
Standalone View
src/miner.cpp
Show First 20 Lines • Show All 188 Lines • ▼ Show 20 Lines | BlockAssembler::CreateNewBlock(const CScript &scriptPubKeyIn) { | ||||
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(consensusParams, pindexPrev); | GetMinerFundWhitelist(consensusParams, pindexPrev); | ||||
if (!whitelisted.empty()) { | if (!whitelisted.empty()) { | ||||
const Amount fund = | const Amount fund = GetMinerFundAmount(coinbaseTx.vout[0].nValue); | ||||
(MINER_FUND_RATIO * coinbaseTx.vout[0].nValue) / 100; | |||||
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. | ||||
uint64_t coinbaseSize = ::GetSerializeSize(coinbaseTx, PROTOCOL_VERSION); | uint64_t coinbaseSize = ::GetSerializeSize(coinbaseTx, PROTOCOL_VERSION); | ||||
if (coinbaseSize < MIN_TX_SIZE) { | if (coinbaseSize < MIN_TX_SIZE) { | ||||
▲ Show 20 Lines • Show All 374 Lines • Show Last 20 Lines |