20 #include <ripple/app/ledger/Ledger.h>
21 #include <ripple/app/main/Application.h>
22 #include <ripple/app/misc/FeeVote.h>
23 #include <ripple/basics/BasicConfig.h>
24 #include <ripple/beast/utility/Journal.h>
25 #include <ripple/protocol/STValidation.h>
26 #include <ripple/protocol/st.h>
69 for (
auto const& [key, val] :
mVoteMap)
109 : target_(setup), journal_(journal)
165 for (
auto const& val :
set)
167 if (val->isTrusted())
172 auto const vote = val->getFieldU64(
sfBaseFee);
176 XRPAmount{unsafe_cast<XRPAmount::value_type>(vote)});
213 lastClosedLedger->fees().base);
215 lastClosedLedger->fees().accountReserve(0));
217 lastClosedLedger->fees().increment);
219 auto const seq = lastClosedLedger->info().seq + 1;
222 if ((baseFee != lastClosedLedger->fees().base) ||
223 (baseReserve != lastClosedLedger->fees().accountReserve(0)) ||
224 (incReserve != lastClosedLedger->fees().increment))
226 JLOG(
journal_.
warn()) <<
"We are voting for a fee change: " << baseFee
227 <<
"/" << baseReserve <<
"/" << incReserve;
231 [seq, baseFee, baseReserve, incReserve, feeUnits](
auto& obj) {
240 uint256 txID = feeTx.getTransactionID();
247 if (!initialPosition->addGiveItem(
249 std::make_shared<SHAMapItem>(txID, s.
slice())))
251 JLOG(
journal_.
warn()) <<
"Ledger already had fee change";
264 if (
set(temp,
"reference_fee", section) &&
270 if (
set(temp,
"account_reserve", section))
272 if (
set(temp,
"owner_reserve", section))
281 return std::make_unique<FeeVoteImpl>(setup, journal);
FeeVote::Setup setup_FeeVote(Section const §ion)
Build FeeVote::Setup from a config section.
Holds a collection of configuration values.
XRPAmount owner_reserve
The per-owned item reserve requirement in drops.
bool isFlagLedger(LedgerIndex seq)
Returns true if the given ledgerIndex is a flag ledgerIndex.
const SF_UINT32 sfReserveBase
bool isLegalAmount(XRPAmount const &amount)
Returns true if the amount does not exceed the initial XRP in existence.
const SF_UINT32 sfLedgerSequence
std::unique_ptr< FeeVote > make_FeeVote(FeeVote::Setup const &setup, beast::Journal journal)
Create an instance of the FeeVote logic.
Manager to process fee votes.
XRPAmount reference_fee
The cost of a reference transaction in drops.
@ ttFEE
This system-generated transaction type is used to update the network's fee settings.
void doValidation(Fees const &lastFees, STValidation &val) override
Add local fee preference to validation.
Fee schedule to vote for.
VotableValue(value_type current, value_type target)
const value_type mCurrent
Reflects the fee settings for a particular ledger.
const beast::Journal journal_
const SF_UINT32 sfReserveIncrement
XRPAmount account_reserve
The account reserve requirement in drops.
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,...
Slice slice() const noexcept
std::optional< Dest > dropsAs() const
FeeVoteImpl(Setup const &setup, beast::Journal journal)
@ current
This was a new validation and was added.
A generic endpoint for log messages.
static constexpr FeeUnit32 reference_fee_units
The cost of a reference transaction in fee units.
std::map< value_type, int > mVoteMap
const SF_UINT64 sfBaseFee
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
value_type getVotes() const
XRPAmount accountReserve(std::size_t ownerCount) const
Returns the account reserve given the owner count, in drops.
const SF_UINT32 sfReferenceFeeUnits
const SF_ACCOUNT sfAccount
void setFieldU64(SField const &field, std::uint64_t)
void addVote(value_type vote)
void setFieldU32(SField const &field, std::uint32_t)
base_uint< 160, detail::AccountIDTag > AccountID
A 160-bit unsigned that uniquely identifies an account.
void doVoting(std::shared_ptr< ReadView const > const &lastClosedLedger, std::vector< std::shared_ptr< STValidation >> const &parentValidations, std::shared_ptr< SHAMap > const &initialPosition) override
Cast our local vote on the fee.