20 #include <ripple/app/main/Application.h>
21 #include <ripple/app/misc/FeeVote.h>
22 #include <ripple/basics/BasicConfig.h>
23 #include <ripple/beast/utility/Journal.h>
24 #include <ripple/protocol/STValidation.h>
25 #include <ripple/protocol/st.h>
68 for (
auto const& [key, val] :
mVoteMap)
110 : target_(setup), journal_(journal)
151 assert((lastClosedLedger->info().seq % 256) == 0);
162 for (
auto const& val :
set)
164 if (val->isTrusted())
169 auto const vote = val->getFieldU64(
sfBaseFee);
173 XRPAmount{unsafe_cast<XRPAmount::value_type>(vote)});
210 lastClosedLedger->fees().base);
212 lastClosedLedger->fees().accountReserve(0));
214 lastClosedLedger->fees().increment);
216 auto const seq = lastClosedLedger->info().seq + 1;
219 if ((baseFee != lastClosedLedger->fees().base) ||
220 (baseReserve != lastClosedLedger->fees().accountReserve(0)) ||
221 (incReserve != lastClosedLedger->fees().increment))
223 JLOG(
journal_.
warn()) <<
"We are voting for a fee change: " << baseFee
224 <<
"/" << baseReserve <<
"/" << incReserve;
228 [seq, baseFee, baseReserve, incReserve, feeUnits](
auto& obj) {
237 uint256 txID = feeTx.getTransactionID();
244 auto tItem = std::make_shared<SHAMapItem>(txID, s.
peekData());
246 if (!initialPosition->addGiveItem(tItem,
true,
false))
248 JLOG(
journal_.
warn()) <<
"Ledger already had fee change";
261 if (
set(temp,
"reference_fee", section) &&
267 if (
set(temp,
"account_reserve", section))
269 if (
set(temp,
"owner_reserve", section))
278 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.
void doValidation(std::shared_ptr< ReadView const > const &lastClosedLedger, STValidation::FeeSettings &fees) override
Add local fee preference to validation.
boost::optional< XRPAmount > reserveBase
bool isLegalAmount(XRPAmount const &amount)
Returns true if the amount does not exceed the initial XRP in existence.
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.
const SF_Account sfAccount(access, STI_ACCOUNT, 1, "Account")
Fee schedule to vote for.
VotableValue(value_type current, value_type target)
const SF_U32 sfReserveBase(access, STI_UINT32, 31, "ReserveBase")
void doVoting(std::shared_ptr< ReadView const > const &lastClosedLedger, std::vector< STValidation::pointer > const &parentValidations, std::shared_ptr< SHAMap > const &initialPosition) override
Cast our local vote on the fee.
const value_type mCurrent
const beast::Journal journal_
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,...
const SF_U32 sfLedgerSequence(access, STI_UINT32, 6, "LedgerSequence")
const SF_U32 sfReferenceFeeUnits(access, STI_UINT32, 30, "ReferenceFeeUnits")
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
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
value_type getVotes() const
boost::optional< XRPAmount > baseFee
const SF_U32 sfReserveIncrement(access, STI_UINT32, 32, "ReserveIncrement")
Blob const & peekData() const
boost::optional< XRPAmount > reserveIncrement
const SF_U64 sfBaseFee(access, STI_UINT64, 5, "BaseFee")
boost::optional< Dest > dropsAs() const
Fees to set when issuing a new validation.
void addVote(value_type vote)
base_uint< 160, detail::AccountIDTag > AccountID
A 160-bit unsigned that uniquely identifies an account.