rippled
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
xrpl::AmendmentTableImpl Class Referencefinal

Track the list of "amendments". More...

Inheritance diagram for xrpl::AmendmentTableImpl:
Inheritance graph
[legend]
Collaboration diagram for xrpl::AmendmentTableImpl:
Collaboration graph
[legend]

Public Member Functions

 AmendmentTableImpl (ServiceRegistry &registry, std::chrono::seconds majorityTime, std::vector< FeatureInfo > const &supported, Section const &enabled, Section const &vetoed, beast::Journal journal)
 
uint256 find (std::string const &name) const override
 
bool veto (uint256 const &amendment) override
 
bool unVeto (uint256 const &amendment) override
 
bool enable (uint256 const &amendment) override
 
bool isEnabled (uint256 const &amendment) const override
 
bool isSupported (uint256 const &amendment) const override
 
bool hasUnsupportedEnabled () const override
 returns true if one or more amendments on the network have been enabled that this server does not support
 
std::optional< NetClock::time_pointfirstUnsupportedExpected () const override
 
Json::Value getJson (bool isAdmin) const override
 
Json::Value getJson (uint256 const &, bool isAdmin) const override
 Returns a Json::objectValue.
 
bool needValidatedLedger (LedgerIndex seq) const override
 Called to determine whether the amendment logic needs to process a new validated ledger.
 
void doValidatedLedger (LedgerIndex seq, std::set< uint256 > const &enabled, majorityAmendments_t const &majority) override
 
void trustChanged (hash_set< PublicKey > const &allTrusted) override
 
std::vector< uint256doValidation (std::set< uint256 > const &enabledAmendments) const override
 
std::vector< uint256getDesired () const override
 
std::map< uint256, std::uint32_tdoVoting (Rules const &rules, NetClock::time_point closeTime, std::set< uint256 > const &enabledAmendments, majorityAmendments_t const &majorityAmendments, std::vector< std::shared_ptr< STValidation > > const &validations) override
 
void doValidatedLedger (std::shared_ptr< ReadView const > const &lastValidatedLedger)
 Called when a new fully-validated ledger is accepted.
 
void doVoting (std::shared_ptr< ReadView const > const &lastClosedLedger, std::vector< std::shared_ptr< STValidation > > const &parentValidations, std::shared_ptr< SHAMap > const &initialPosition, beast::Journal j)
 

Private Member Functions

AmendmentStateadd (uint256 const &amendment, std::lock_guard< std::mutex > const &lock)
 
AmendmentStateget (uint256 const &amendment, std::lock_guard< std::mutex > const &lock)
 
AmendmentState const * get (uint256 const &amendment, std::lock_guard< std::mutex > const &lock) const
 
void injectJson (Json::Value &v, uint256 const &amendment, AmendmentState const &state, bool isAdmin, std::lock_guard< std::mutex > const &lock) const
 
void persistVote (uint256 const &amendment, std::string const &name, AmendmentVote vote) const
 

Private Attributes

std::mutex mutex_
 
hash_map< uint256, AmendmentStateamendmentMap_
 
std::uint32_t lastUpdateSeq_ {0}
 
TrustedVotes previousTrustedVotes_
 
std::chrono::seconds const majorityTime_
 
std::unique_ptr< AmendmentSetlastVote_
 
bool unsupportedEnabled_ {false}
 
std::optional< NetClock::time_pointfirstUnsupportedExpected_
 
beast::Journal const j_
 
DatabaseCondb_
 

Detailed Description

Track the list of "amendments".

An "amendment" is an option that can affect transaction processing rules. Amendments are proposed and then adopted or rejected by the network. An Amendment is uniquely identified by its AmendmentID, a 256-bit key.

Definition at line 356 of file AmendmentTable.cpp.

Constructor & Destructor Documentation

◆ AmendmentTableImpl()

xrpl::AmendmentTableImpl::AmendmentTableImpl ( ServiceRegistry registry,
std::chrono::seconds  majorityTime,
std::vector< FeatureInfo > const &  supported,
Section const &  enabled,
Section const &  vetoed,
beast::Journal  journal 
)

Definition at line 475 of file AmendmentTable.cpp.

Member Function Documentation

◆ add()

AmendmentState & xrpl::AmendmentTableImpl::add ( uint256 const &  amendment,
std::lock_guard< std::mutex > const &  lock 
)
private

Definition at line 607 of file AmendmentTable.cpp.

◆ get() [1/2]

AmendmentState * xrpl::AmendmentTableImpl::get ( uint256 const &  amendment,
std::lock_guard< std::mutex > const &  lock 
)
private

Definition at line 614 of file AmendmentTable.cpp.

◆ get() [2/2]

AmendmentState const * xrpl::AmendmentTableImpl::get ( uint256 const &  amendment,
std::lock_guard< std::mutex > const &  lock 
) const
private

Definition at line 621 of file AmendmentTable.cpp.

◆ injectJson()

void xrpl::AmendmentTableImpl::injectJson ( Json::Value v,
uint256 const &  amendment,
AmendmentState const &  state,
bool  isAdmin,
std::lock_guard< std::mutex > const &  lock 
) const
private

Definition at line 916 of file AmendmentTable.cpp.

◆ persistVote()

void xrpl::AmendmentTableImpl::persistVote ( uint256 const &  amendment,
std::string const &  name,
AmendmentVote  vote 
) const
private

Definition at line 647 of file AmendmentTable.cpp.

◆ find()

uint256 xrpl::AmendmentTableImpl::find ( std::string const &  name) const
overridevirtual

Implements xrpl::AmendmentTable.

Definition at line 633 of file AmendmentTable.cpp.

◆ veto()

bool xrpl::AmendmentTableImpl::veto ( uint256 const &  amendment)
overridevirtual

Implements xrpl::AmendmentTable.

Definition at line 660 of file AmendmentTable.cpp.

◆ unVeto()

bool xrpl::AmendmentTableImpl::unVeto ( uint256 const &  amendment)
overridevirtual

Implements xrpl::AmendmentTable.

Definition at line 673 of file AmendmentTable.cpp.

◆ enable()

bool xrpl::AmendmentTableImpl::enable ( uint256 const &  amendment)
overridevirtual

Implements xrpl::AmendmentTable.

Definition at line 686 of file AmendmentTable.cpp.

◆ isEnabled()

bool xrpl::AmendmentTableImpl::isEnabled ( uint256 const &  amendment) const
overridevirtual

Implements xrpl::AmendmentTable.

Definition at line 706 of file AmendmentTable.cpp.

◆ isSupported()

bool xrpl::AmendmentTableImpl::isSupported ( uint256 const &  amendment) const
overridevirtual

Implements xrpl::AmendmentTable.

Definition at line 714 of file AmendmentTable.cpp.

◆ hasUnsupportedEnabled()

bool xrpl::AmendmentTableImpl::hasUnsupportedEnabled ( ) const
overridevirtual

returns true if one or more amendments on the network have been enabled that this server does not support

Returns
true if an unsupported feature is enabled on the network

Implements xrpl::AmendmentTable.

Definition at line 722 of file AmendmentTable.cpp.

◆ firstUnsupportedExpected()

std::optional< NetClock::time_point > xrpl::AmendmentTableImpl::firstUnsupportedExpected ( ) const
overridevirtual

Implements xrpl::AmendmentTable.

Definition at line 729 of file AmendmentTable.cpp.

◆ getJson() [1/2]

Json::Value xrpl::AmendmentTableImpl::getJson ( bool  isAdmin) const
overridevirtual

Implements xrpl::AmendmentTable.

Definition at line 955 of file AmendmentTable.cpp.

◆ getJson() [2/2]

Json::Value xrpl::AmendmentTableImpl::getJson ( uint256 const &  amendment,
bool  isAdmin 
) const
overridevirtual

Returns a Json::objectValue.

Implements xrpl::AmendmentTable.

Definition at line 970 of file AmendmentTable.cpp.

◆ needValidatedLedger()

bool xrpl::AmendmentTableImpl::needValidatedLedger ( LedgerIndex  seq) const
overridevirtual

Called to determine whether the amendment logic needs to process a new validated ledger.

(If it could have changed things.)

Implements xrpl::AmendmentTable.

Definition at line 861 of file AmendmentTable.cpp.

◆ doValidatedLedger() [1/2]

void xrpl::AmendmentTableImpl::doValidatedLedger ( LedgerIndex  seq,
std::set< uint256 > const &  enabled,
majorityAmendments_t const &  majority 
)
overridevirtual

Implements xrpl::AmendmentTable.

Definition at line 872 of file AmendmentTable.cpp.

◆ trustChanged()

void xrpl::AmendmentTableImpl::trustChanged ( hash_set< PublicKey > const &  allTrusted)
overridevirtual

Implements xrpl::AmendmentTable.

Definition at line 909 of file AmendmentTable.cpp.

◆ doValidation()

std::vector< uint256 > xrpl::AmendmentTableImpl::doValidation ( std::set< uint256 > const &  enabledAmendments) const
overridevirtual

Implements xrpl::AmendmentTable.

Definition at line 736 of file AmendmentTable.cpp.

◆ getDesired()

std::vector< uint256 > xrpl::AmendmentTableImpl::getDesired ( ) const
overridevirtual

Implements xrpl::AmendmentTable.

Definition at line 763 of file AmendmentTable.cpp.

◆ doVoting() [1/2]

std::map< uint256, std::uint32_t > xrpl::AmendmentTableImpl::doVoting ( Rules const &  rules,
NetClock::time_point  closeTime,
std::set< uint256 > const &  enabledAmendments,
majorityAmendments_t const &  majorityAmendments,
std::vector< std::shared_ptr< STValidation > > const &  validations 
)
overridevirtual

Implements xrpl::AmendmentTable.

Definition at line 770 of file AmendmentTable.cpp.

◆ doValidatedLedger() [2/2]

void xrpl::AmendmentTable::doValidatedLedger ( std::shared_ptr< ReadView const > const &  lastValidatedLedger)
inherited

Called when a new fully-validated ledger is accepted.

Definition at line 75 of file AmendmentTable.h.

◆ doVoting() [2/2]

void xrpl::AmendmentTable::doVoting ( std::shared_ptr< ReadView const > const &  lastClosedLedger,
std::vector< std::shared_ptr< STValidation > > const &  parentValidations,
std::shared_ptr< SHAMap > const &  initialPosition,
beast::Journal  j 
)
inherited

Definition at line 129 of file AmendmentTable.h.

Member Data Documentation

◆ mutex_

std::mutex xrpl::AmendmentTableImpl::mutex_
mutableprivate

Definition at line 359 of file AmendmentTable.cpp.

◆ amendmentMap_

hash_map<uint256, AmendmentState> xrpl::AmendmentTableImpl::amendmentMap_
private

Definition at line 361 of file AmendmentTable.cpp.

◆ lastUpdateSeq_

std::uint32_t xrpl::AmendmentTableImpl::lastUpdateSeq_ {0}
private

Definition at line 362 of file AmendmentTable.cpp.

◆ previousTrustedVotes_

TrustedVotes xrpl::AmendmentTableImpl::previousTrustedVotes_
private

Definition at line 365 of file AmendmentTable.cpp.

◆ majorityTime_

std::chrono::seconds const xrpl::AmendmentTableImpl::majorityTime_
private

Definition at line 368 of file AmendmentTable.cpp.

◆ lastVote_

std::unique_ptr<AmendmentSet> xrpl::AmendmentTableImpl::lastVote_
private

Definition at line 372 of file AmendmentTable.cpp.

◆ unsupportedEnabled_

bool xrpl::AmendmentTableImpl::unsupportedEnabled_ {false}
private

Definition at line 375 of file AmendmentTable.cpp.

◆ firstUnsupportedExpected_

std::optional<NetClock::time_point> xrpl::AmendmentTableImpl::firstUnsupportedExpected_
private

Definition at line 380 of file AmendmentTable.cpp.

◆ j_

beast::Journal const xrpl::AmendmentTableImpl::j_
private

Definition at line 382 of file AmendmentTable.cpp.

◆ db_

DatabaseCon& xrpl::AmendmentTableImpl::db_
private

Definition at line 385 of file AmendmentTable.cpp.