Changeset View
Changeset View
Standalone View
Standalone View
src/miner.cpp
Show First 20 Lines • Show All 74 Lines • ▼ Show 20 Lines | int64_t UpdateTime(CBlockHeader *pblock, const Config &config, | ||||
// Updating time can change work required on testnet: | // Updating time can change work required on testnet: | ||||
if (consensusParams.fPowAllowMinDifficultyBlocks) { | if (consensusParams.fPowAllowMinDifficultyBlocks) { | ||||
pblock->nBits = GetNextWorkRequired(pindexPrev, pblock, config); | pblock->nBits = GetNextWorkRequired(pindexPrev, pblock, config); | ||||
} | } | ||||
return nNewTime - nOldTime; | return nNewTime - nOldTime; | ||||
} | } | ||||
void BlockAssembler::SetBlockMinTxFee(const Amount blockmintxfee) { | |||||
blockMinFeeRate = CFeeRate(blockmintxfee); | |||||
} | |||||
static uint64_t ComputeMaxGeneratedBlockSize(const Config &config, | static uint64_t ComputeMaxGeneratedBlockSize(const Config &config, | ||||
const CBlockIndex *pindexPrev) { | const CBlockIndex *pindexPrev) { | ||||
// Block resource limits | // Block resource limits | ||||
// If -blockmaxsize is not given, limit to DEFAULT_MAX_GENERATED_BLOCK_SIZE | // If -blockmaxsize is not given, limit to DEFAULT_MAX_GENERATED_BLOCK_SIZE | ||||
// If only one is given, only restrict the specified resource. | // If only one is given, only restrict the specified resource. | ||||
// If both are given, restrict both. | // If both are given, restrict both. | ||||
uint64_t nMaxGeneratedBlockSize = DEFAULT_MAX_GENERATED_BLOCK_SIZE; | uint64_t nMaxGeneratedBlockSize = DEFAULT_MAX_GENERATED_BLOCK_SIZE; | ||||
if (IsArgSet("-blockmaxsize")) { | if (IsArgSet("-blockmaxsize")) { | ||||
Show All 10 Lines | |||||
} | } | ||||
BlockAssembler::BlockAssembler(const Config &_config, | BlockAssembler::BlockAssembler(const Config &_config, | ||||
const CChainParams &_chainparams) | const CChainParams &_chainparams) | ||||
: chainparams(_chainparams), config(&_config) { | : chainparams(_chainparams), config(&_config) { | ||||
if (IsArgSet("-blockmintxfee")) { | if (IsArgSet("-blockmintxfee")) { | ||||
Amount n(0); | Amount n(0); | ||||
ParseMoney(GetArg("-blockmintxfee", ""), n); | ParseMoney(GetArg("-blockmintxfee", ""), n); | ||||
blockMinFeeRate = CFeeRate(n); | SetBlockMinTxFee(n); | ||||
} else { | |||||
blockMinFeeRate = CFeeRate(DEFAULT_BLOCK_MIN_TX_FEE); | |||||
} | } | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
nMaxGeneratedBlockSize = | nMaxGeneratedBlockSize = | ||||
ComputeMaxGeneratedBlockSize(*config, chainActive.Tip()); | ComputeMaxGeneratedBlockSize(*config, chainActive.Tip()); | ||||
} | } | ||||
void BlockAssembler::resetBlock() { | void BlockAssembler::resetBlock() { | ||||
▲ Show 20 Lines • Show All 541 Lines • Show Last 20 Lines |