MCPcopy Create free account
hub / github.com/LUX-Core/lux / BlockAssembler

Method BlockAssembler

src/miner.cpp:130–165  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

128}
129
130BlockAssembler::BlockAssembler(const CChainParams& _chainparams)
131 : chainParams(_chainparams)
132{
133 // Block resource limits
134 // If neither -blockmaxsize or -blockmaxweight is given, limit to DEFAULT_BLOCK_MAX_*
135 // If only one is given, only restrict the specified resource.
136 // If both are given, restrict both.
137 nBlockMaxWeight = DEFAULT_BLOCK_MAX_WEIGHT;
138 nBlockMaxSize = DEFAULT_BLOCK_MAX_SIZE;
139 bool fWeightSet = false;
140 if (IsArgSet("-blockmaxweight")) {
141 nBlockMaxWeight = GetArg("-blockmaxweight", DEFAULT_BLOCK_MAX_WEIGHT);
142 nBlockMaxSize = dgpMaxBlockSerSize;
143 fWeightSet = true;
144 }
145 if (IsArgSet("-blockmaxsize")) {
146 nBlockMaxSize = GetArg("-blockmaxsize", DEFAULT_BLOCK_MAX_SIZE);
147 if (!fWeightSet) {
148 nBlockMaxWeight = nBlockMaxSize * WITNESS_SCALE_FACTOR;
149 }
150 }
151 if (IsArgSet("-blockmintxfee")) {
152 CAmount n = 0;
153 ParseMoney(GetArg("-blockmintxfee", ""), n);
154 blockMinFeeRate = CFeeRate(n);
155 } else {
156 blockMinFeeRate = CFeeRate(DEFAULT_BLOCK_MIN_TX_FEE);
157 }
158
159 // Limit weight to between 4K and dgpMaxBlockWeight-4K for sanity:
160 nBlockMaxWeight = std::max((unsigned int)4000, std::min((unsigned int)(dgpMaxBlockWeight-4000), nBlockMaxWeight));
161 // Limit size to between 1K and dgpMaxBlockSerSize-1K for sanity:
162 nBlockMaxSize = std::max((unsigned int)1000, std::min((unsigned int)(dgpMaxBlockSerSize-1000), nBlockMaxSize));
163 // Whether we need to account for byte usage (in addition to weight usage)
164 fNeedSizeAccounting = (nBlockMaxSize < dgpMaxBlockSerSize-1000);
165}
166
167void BlockAssembler::resetBlock()
168{

Callers

nothing calls this directly

Calls 5

IsArgSetFunction · 0.85
GetArgFunction · 0.85
ParseMoneyFunction · 0.85
maxFunction · 0.85
CFeeRateClass · 0.70

Tested by

no test coverage detected