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>
75 for (
auto const& [key, val] :
voteMap_)
86 return {ourVote, ourVote !=
current_};
116 : target_(setup), journal_(journal)
122 Fees const& lastFees,
131 auto vote = [&v,
this](
135 auto const& sfield) {
139 <<
"Voting for " << name <<
" of " << target;
164 auto vote = [&v,
this](
167 auto const& convertCallback,
169 auto const& sfield) {
173 <<
"Voting for " << name <<
" of " << target;
175 if (
auto const f = convertCallback(target))
203 assert(lastClosedLedger &&
isFlagLedger(lastClosedLedger->seq()));
214 auto const& rules = lastClosedLedger->rules();
220 if (
auto const field = ~val->at(~xrpField);
221 field && field->native())
223 auto const vote = field->xrp();
235 for (
auto const& val :
set)
237 if (!val->isTrusted())
248 auto const& valueField) {
249 if (
auto const field = val->at(~valueField))
252 auto const vote = *field;
256 XRPAmount{unsafe_cast<XRPAmount::value_type>(vote)});
269 for (
auto const& val :
set)
271 if (!val->isTrusted())
283 auto const baseFee = baseFeeVote.
getVotes();
284 auto const baseReserve = baseReserveVote.
getVotes();
285 auto const incReserve = incReserveVote.
getVotes();
287 auto const seq = lastClosedLedger->info().seq + 1;
290 if (baseFee.second || baseReserve.second || incReserve.second)
293 <<
"We are voting for a fee change: " << baseFee.first <<
"/"
294 << baseReserve.first <<
"/" << incReserve.first;
296 STTx feeTx(
ttFEE, [=, &rules](
auto& obj) {
320 uint256 txID = feeTx.getTransactionID();
327 if (!initialPosition->addGiveItem(
331 JLOG(
journal_.
warn()) <<
"Ledger already had fee change";
341 return std::make_unique<FeeVoteImpl>(setup, journal);
XRPAmount reference_fee
The cost of a reference transaction in drops.
std::map< value_type, int > voteMap_
bool isFlagLedger(LedgerIndex seq)
Returns true if the given ledgerIndex is a flag ledgerIndex.
const SF_AMOUNT sfBaseFeeDrops
const SF_UINT32 sfReserveBase
const uint256 featureXRPFees
bool enabled(uint256 const &feature) const
Returns true if a feature is enabled.
A field with a type known at compile time.
FeeVoteImpl(FeeSetup const &setup, beast::Journal journal)
const SF_UINT32 sfLedgerSequence
boost::intrusive_ptr< SHAMapItem > make_shamapitem(uint256 const &tag, Slice data)
Manager to process fee votes.
bool isLegalAmountSigned(XRPAmount const &amount)
Returns true if the absolute value of the amount does not exceed the initial XRP in existence.
@ ttFEE
This system-generated transaction type is used to update the network's fee settings.
VotableValue(value_type current, value_type target)
Reflects the fee settings for a particular ledger.
const beast::Journal journal_
value_type current() const
const SF_UINT32 sfReserveIncrement
const value_type current_
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
@ current
This was a new validation and was added.
A generic endpoint for log messages.
XRPAmount account_reserve
The account reserve requirement in drops.
const SF_AMOUNT sfReserveIncrementDrops
const SF_AMOUNT sfReserveBaseDrops
static constexpr std::uint32_t FEE_UNITS_DEPRECATED
const SF_UINT64 sfBaseFee
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
std::pair< value_type, bool > getVotes() const
XRPAmount accountReserve(std::size_t ownerCount) const
Returns the account reserve given the owner count, in drops.
XRPAmount owner_reserve
The per-owned item reserve requirement in drops.
const SF_UINT32 sfReferenceFeeUnits
Rules controlling protocol behavior.
const SF_ACCOUNT sfAccount
Fee schedule for startup / standalone, and to vote for.
void doValidation(Fees const &lastFees, Rules const &rules, STValidation &val) override
Add local fee preference to validation.
void addVote(value_type vote)
std::unique_ptr< FeeVote > make_FeeVote(FeeSetup const &setup, beast::Journal journal)
Create an instance of the FeeVote logic.
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.