rippled
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ripple::AmendmentTableImpl Class Referencefinal

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

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

Public Member Functions

 AmendmentTableImpl (Application &app, 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 More...
 
std::optional< NetClock::time_pointfirstUnsupportedExpected () const override
 
Json::Value getJson () const override
 
Json::Value getJson (uint256 const &) const override
 Returns a Json::objectValue. More...
 
bool needValidatedLedger (LedgerIndex seq) const override
 Called to determine whether the amendment logic needs to process a new validated ledger. More...
 
void doValidatedLedger (LedgerIndex seq, std::set< uint256 > const &enabled, majorityAmendments_t const &majority) 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. More...
 
void doVoting (std::shared_ptr< ReadView const > const &lastClosedLedger, std::vector< std::shared_ptr< STValidation >> const &parentValidations, std::shared_ptr< SHAMap > const &initialPosition)
 

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, 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_
 
const std::chrono::seconds majorityTime_
 
std::unique_ptr< AmendmentSetlastVote_
 
bool unsupportedEnabled_
 
std::optional< NetClock::time_pointfirstUnsupportedExpected_
 
const beast::Journal 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 198 of file AmendmentTable.cpp.

Constructor & Destructor Documentation

◆ AmendmentTableImpl()

ripple::AmendmentTableImpl::AmendmentTableImpl ( Application app,
std::chrono::seconds  majorityTime,
std::vector< FeatureInfo > const &  supported,
Section const &  enabled,
Section const &  vetoed,
beast::Journal  journal 
)

Definition at line 314 of file AmendmentTable.cpp.

Member Function Documentation

◆ add()

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

Definition at line 456 of file AmendmentTable.cpp.

◆ get() [1/2]

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

Definition at line 465 of file AmendmentTable.cpp.

◆ get() [2/2]

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

Definition at line 475 of file AmendmentTable.cpp.

◆ injectJson()

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

Definition at line 744 of file AmendmentTable.cpp.

◆ persistVote()

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

Definition at line 503 of file AmendmentTable.cpp.

◆ find()

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

Implements ripple::AmendmentTable.

Definition at line 489 of file AmendmentTable.cpp.

◆ veto()

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

Implements ripple::AmendmentTable.

Definition at line 514 of file AmendmentTable.cpp.

◆ unVeto()

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

Implements ripple::AmendmentTable.

Definition at line 527 of file AmendmentTable.cpp.

◆ enable()

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

Implements ripple::AmendmentTable.

Definition at line 540 of file AmendmentTable.cpp.

◆ isEnabled()

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

Implements ripple::AmendmentTable.

Definition at line 561 of file AmendmentTable.cpp.

◆ isSupported()

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

Implements ripple::AmendmentTable.

Definition at line 569 of file AmendmentTable.cpp.

◆ hasUnsupportedEnabled()

bool ripple::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 ripple::AmendmentTable.

Definition at line 577 of file AmendmentTable.cpp.

◆ firstUnsupportedExpected()

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

Implements ripple::AmendmentTable.

Definition at line 584 of file AmendmentTable.cpp.

◆ getJson() [1/2]

Json::Value ripple::AmendmentTableImpl::getJson ( ) const
overridevirtual

Implements ripple::AmendmentTable.

Definition at line 778 of file AmendmentTable.cpp.

◆ getJson() [2/2]

Json::Value ripple::AmendmentTableImpl::getJson ( uint256 const &  amendment) const
overridevirtual

Returns a Json::objectValue.

Implements ripple::AmendmentTable.

Definition at line 796 of file AmendmentTable.cpp.

◆ needValidatedLedger()

bool ripple::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 ripple::AmendmentTable.

Definition at line 696 of file AmendmentTable.cpp.

◆ doValidatedLedger() [1/2]

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

Implements ripple::AmendmentTable.

Definition at line 707 of file AmendmentTable.cpp.

◆ doValidation()

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

Implements ripple::AmendmentTable.

Definition at line 591 of file AmendmentTable.cpp.

◆ getDesired()

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

Implements ripple::AmendmentTable.

Definition at line 618 of file AmendmentTable.cpp.

◆ doVoting() [1/2]

std::map< uint256, std::uint32_t > ripple::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 ripple::AmendmentTable.

Definition at line 625 of file AmendmentTable.cpp.

◆ doValidatedLedger() [2/2]

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

Called when a new fully-validated ledger is accepted.

Definition at line 92 of file AmendmentTable.h.

◆ doVoting() [2/2]

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

Definition at line 143 of file AmendmentTable.h.

Member Data Documentation

◆ mutex_

std::mutex ripple::AmendmentTableImpl::mutex_
mutableprivate

Definition at line 201 of file AmendmentTable.cpp.

◆ amendmentMap_

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

Definition at line 203 of file AmendmentTable.cpp.

◆ lastUpdateSeq_

std::uint32_t ripple::AmendmentTableImpl::lastUpdateSeq_
private

Definition at line 204 of file AmendmentTable.cpp.

◆ majorityTime_

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

Definition at line 207 of file AmendmentTable.cpp.

◆ lastVote_

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

Definition at line 211 of file AmendmentTable.cpp.

◆ unsupportedEnabled_

bool ripple::AmendmentTableImpl::unsupportedEnabled_
private

Definition at line 214 of file AmendmentTable.cpp.

◆ firstUnsupportedExpected_

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

Definition at line 219 of file AmendmentTable.cpp.

◆ j_

const beast::Journal ripple::AmendmentTableImpl::j_
private

Definition at line 221 of file AmendmentTable.cpp.

◆ db_

DatabaseCon& ripple::AmendmentTableImpl::db_
private

Definition at line 224 of file AmendmentTable.cpp.