171 lastClosedLedger &&
isFlagLedger(lastClosedLedger->seq()),
172 "xrpl::FeeVoteImpl::doVoting : has a flag ledger");
180 auto const validOrCurrent =
182 return (target >= min && target <= max) ? target : current;
186 lastClosedLedger->fees().gasLimit,
190 lastClosedLedger->fees().bytecodeSizeLimit,
195 lastClosedLedger->fees().bytecodeSizeLimit));
198 lastClosedLedger->fees().gasPrice,
203 lastClosedLedger->fees().gasPrice));
208 if (
auto const field = ~val->at(~xrpField); field && field->native())
210 auto const vote = field->xrp();
226 for (
auto const& val :
set)
228 if (!val->isTrusted())
230 doVote(val, baseFeeVote, sfBaseFeeDrops);
231 doVote(val, baseReserveVote, sfReserveBaseDrops);
232 doVote(val, incReserveVote, sfReserveIncrementDrops);
235 auto const& rules = lastClosedLedger->rules();
236 if (rules.enabled(featureSmartEscrow))
243 if (
auto const field = ~val->at(~sfield);
244 field && *field >= minValue && *field <= maxValue)
246 value.addVote(*field);
254 for (
auto const& val :
set)
256 if (!val->isTrusted())
258 doExtensionVote(val, gasLimitVote, sfGasLimit, 0,
kMaxGasLimit);
271 auto const [baseFee, baseFeeChanged] = baseFeeVote.
getVotes();
272 auto const [baseReserve, baseReserveChanged] = baseReserveVote.
getVotes();
273 auto const [incReserve, incReserveChanged] = incReserveVote.
getVotes();
274 auto const [gasLimit, gasLimitChanged] = gasLimitVote.
getVotes();
275 auto const [bytecodeSizeLimit, bytecodeSizeLimitChanged] = bytecodeSizeLimitVote.
getVotes();
276 auto const [gasPrice, gasPriceChanged] = gasPriceVote.
getVotes();
278 auto const seq = lastClosedLedger->header().seq + 1;
284 bool const smartEscrowFeeChanged = rules.enabled(featureSmartEscrow) &&
285 (gasLimitChanged || bytecodeSizeLimitChanged || gasPriceChanged);
288 if (baseFeeChanged || baseReserveChanged || incReserveChanged || smartEscrowFeeChanged)
290 JLOG(
journal_.warn()) <<
"We are voting for a fee change: " << baseFee <<
"/" << baseReserve
291 <<
"/" << incReserve;
293 STTx const feeTx(ttFEE, [=, &rules](
auto& obj) {
295 obj[sfLedgerSequence] = seq;
296 obj[sfBaseFeeDrops] = baseFee;
297 obj[sfReserveBaseDrops] = baseReserve;
298 obj[sfReserveIncrementDrops] = incReserve;
299 if (rules.enabled(featureSmartEscrow))
301 obj[sfGasLimit] = gasLimit;
302 obj[sfBytecodeSizeLimit] = bytecodeSizeLimit;
303 obj[sfGasPrice] = gasPrice;
307 UInt256 const txID = feeTx.getTransactionID();
309 JLOG(
journal_.warn()) <<
"Vote: " << txID;
314 if (!initialPosition->addGiveItem(
317 JLOG(
journal_.warn()) <<
"Ledger already had fee change";
bool set(T &target, std::string const &name, Section const §ion)
Set a value from a configuration Section If the named value is not found or doesn't parse as a T,...