rippled
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
xrpl::NetworkOPsImp Class Referencefinal
Inheritance diagram for xrpl::NetworkOPsImp:
Inheritance graph
[legend]
Collaboration diagram for xrpl::NetworkOPsImp:
Collaboration graph
[legend]

Classes

struct  ServerFeeSummary
 Server fees published on server subscription. More...
 
class  StateAccounting
 State accounting records two attributes for each possible server state: 1) Amount of time spent in each state (in microseconds). More...
 
struct  Stats
 
struct  SubAccountHistoryIndex
 
struct  SubAccountHistoryInfo
 
struct  SubAccountHistoryInfoWeak
 
class  TransactionStatus
 Transaction with input flags and results to be applied in batches. More...
 

Public Types

enum class  FailHard : unsigned char { no , yes }
 
using clock_type = beast::abstract_clock< std::chrono::steady_clock >
 

Public Member Functions

 NetworkOPsImp (ServiceRegistry &registry, NetworkOPs::clock_type &clock, bool standalone, std::size_t minPeerCount, bool start_valid, JobQueue &job_queue, LedgerMaster &ledgerMaster, ValidatorKeys const &validatorKeys, boost::asio::io_context &io_svc, beast::Journal journal, beast::insight::Collector::ptr const &collector)
 
 ~NetworkOPsImp () override
 
OperatingMode getOperatingMode () const override
 
std::string strOperatingMode (OperatingMode const mode, bool const admin) const override
 
std::string strOperatingMode (bool const admin=false) const override
 
void submitTransaction (std::shared_ptr< STTx const > const &) override
 
void processTransaction (std::shared_ptr< Transaction > &transaction, bool bUnlimited, bool bLocal, FailHard failType) override
 Process transactions as they arrive from the network or which are submitted by clients.
 
void processTransactionSet (CanonicalTXSet const &set) override
 Process a set of transactions synchronously, and ensuring that they are processed in one batch.
 
void doTransactionSync (std::shared_ptr< Transaction > transaction, bool bUnlimited, FailHard failType)
 For transactions submitted directly by a client, apply batch of transactions and wait for this transaction to complete.
 
void doTransactionAsync (std::shared_ptr< Transaction > transaction, bool bUnlimited, FailHard failtype)
 For transactions not submitted by a locally connected client, fire and forget.
 
void transactionBatch ()
 Apply transactions in batches.
 
void apply (std::unique_lock< std::mutex > &batchLock)
 Attempt to apply transactions and post-process based on the results.
 
Json::Value getOwnerInfo (std::shared_ptr< ReadView const > lpLedger, AccountID const &account) override
 
void getBookPage (std::shared_ptr< ReadView const > &lpLedger, Book const &, AccountID const &uTakerID, bool const bProof, unsigned int iLimit, Json::Value const &jvMarker, Json::Value &jvResult) override
 
bool processTrustedProposal (RCLCxPeerPos proposal) override
 
bool recvValidation (std::shared_ptr< STValidation > const &val, std::string const &source) override
 
void mapComplete (std::shared_ptr< SHAMap > const &map, bool fromAcquire) override
 
bool beginConsensus (uint256 const &networkClosed, std::unique_ptr< std::stringstream > const &clog) override
 
void endConsensus (std::unique_ptr< std::stringstream > const &clog) override
 
void setStandAlone () override
 
void setStateTimer () override
 Called to initially start our timers.
 
void setNeedNetworkLedger () override
 
void clearNeedNetworkLedger () override
 
bool isNeedNetworkLedger () override
 
bool isFull () override
 
void setMode (OperatingMode om) override
 
bool isBlocked () override
 
bool isAmendmentBlocked () override
 
void setAmendmentBlocked () override
 
bool isAmendmentWarned () override
 
void setAmendmentWarned () override
 
void clearAmendmentWarned () override
 
bool isUNLBlocked () override
 
void setUNLBlocked () override
 
void clearUNLBlocked () override
 
void consensusViewChange () override
 
Json::Value getConsensusInfo () override
 
Json::Value getServerInfo (bool human, bool admin, bool counters) override
 
void clearLedgerFetch () override
 
Json::Value getLedgerFetchInfo () override
 
std::uint32_t acceptLedger (std::optional< std::chrono::milliseconds > consensusDelay) override
 Accepts the current transaction tree, return the new ledger's sequence.
 
void reportFeeChange () override
 
void reportConsensusStateChange (ConsensusPhase phase)
 
void updateLocalTx (ReadView const &view) override
 
std::size_t getLocalTxCount () override
 
void pubLedger (std::shared_ptr< ReadView const > const &lpAccepted) override
 
void pubProposedTransaction (std::shared_ptr< ReadView const > const &ledger, std::shared_ptr< STTx const > const &transaction, TER result) override
 
void pubValidation (std::shared_ptr< STValidation > const &val) override
 
void subAccount (InfoSub::ref ispListener, hash_set< AccountID > const &vnaAccountIDs, bool rt) override
 
void unsubAccount (InfoSub::ref ispListener, hash_set< AccountID > const &vnaAccountIDs, bool rt) override
 
void unsubAccountInternal (std::uint64_t seq, hash_set< AccountID > const &vnaAccountIDs, bool rt) override
 
error_code_i subAccountHistory (InfoSub::ref ispListener, AccountID const &account) override
 subscribe an account's new transactions and retrieve the account's historical transactions
 
void unsubAccountHistory (InfoSub::ref ispListener, AccountID const &account, bool historyOnly) override
 unsubscribe an account's transactions
 
void unsubAccountHistoryInternal (std::uint64_t seq, AccountID const &account, bool historyOnly) override
 
bool subLedger (InfoSub::ref ispListener, Json::Value &jvResult) override
 
bool unsubLedger (std::uint64_t uListener) override
 
bool subBookChanges (InfoSub::ref ispListener) override
 
bool unsubBookChanges (std::uint64_t uListener) override
 
bool subServer (InfoSub::ref ispListener, Json::Value &jvResult, bool admin) override
 
bool unsubServer (std::uint64_t uListener) override
 
bool subBook (InfoSub::ref ispListener, Book const &) override
 
bool unsubBook (std::uint64_t uListener, Book const &) override
 
bool subManifests (InfoSub::ref ispListener) override
 
bool unsubManifests (std::uint64_t uListener) override
 
void pubManifest (Manifest const &) override
 
bool subTransactions (InfoSub::ref ispListener) override
 
bool unsubTransactions (std::uint64_t uListener) override
 
bool subRTTransactions (InfoSub::ref ispListener) override
 
bool unsubRTTransactions (std::uint64_t uListener) override
 
bool subValidations (InfoSub::ref ispListener) override
 
bool unsubValidations (std::uint64_t uListener) override
 
bool subPeerStatus (InfoSub::ref ispListener) override
 
bool unsubPeerStatus (std::uint64_t uListener) override
 
void pubPeerStatus (std::function< Json::Value(void)> const &) override
 
bool subConsensus (InfoSub::ref ispListener) override
 
bool unsubConsensus (std::uint64_t uListener) override
 
InfoSub::pointer findRpcSub (std::string const &strUrl) override
 
InfoSub::pointer addRpcSub (std::string const &strUrl, InfoSub::ref) override
 
bool tryRemoveRpcSub (std::string const &strUrl) override
 
void stop () override
 
void stateAccounting (Json::Value &obj) override
 

Static Public Member Functions

static FailHard doFailHard (bool noMeansDont)
 

Private Types

enum class  DispatchState : unsigned char { none , scheduled , running }
 Synchronization states for transaction batches. More...
 
enum  SubTypes {
  sLedger , sManifests , sServer , sTransactions ,
  sRTTransactions , sValidations , sPeerStatus , sConsensusPhase ,
  sBookChanges , sLastEntry
}
 
using SubMapType = hash_map< std::uint64_t, InfoSub::wptr >
 
using SubInfoMapType = hash_map< AccountID, SubMapType >
 
using subRpcMapType = hash_map< std::string, InfoSub::pointer >
 
using SubAccountHistoryMapType = hash_map< AccountID, hash_map< std::uint64_t, SubAccountHistoryInfoWeak > >
 

Private Member Functions

bool preProcessTransaction (std::shared_ptr< Transaction > &transaction)
 
void doTransactionSyncBatch (std::unique_lock< std::mutex > &lock, std::function< bool(std::unique_lock< std::mutex > const &)> retryCallback)
 
void switchLastClosedLedger (std::shared_ptr< Ledger const > const &newLCL)
 
bool checkLastClosedLedger (Overlay::PeerSequence const &, uint256 &networkClosed)
 
void setTimer (boost::asio::steady_timer &timer, std::chrono::milliseconds const &expiry_time, std::function< void()> onExpire, std::function< void()> onError)
 
void setHeartbeatTimer ()
 
void setClusterTimer ()
 
void processHeartbeatTimer ()
 
void processClusterTimer ()
 
MultiApiJson transJson (std::shared_ptr< STTx const > const &transaction, TER result, bool validated, std::shared_ptr< ReadView const > const &ledger, std::optional< std::reference_wrapper< TxMeta const > > meta)
 
void pubValidatedTransaction (std::shared_ptr< ReadView const > const &ledger, AcceptedLedgerTx const &transaction, bool last)
 
void pubAccountTransaction (std::shared_ptr< ReadView const > const &ledger, AcceptedLedgerTx const &transaction, bool last)
 
void pubProposedAccountTransaction (std::shared_ptr< ReadView const > const &ledger, std::shared_ptr< STTx const > const &transaction, TER result)
 
void pubServer ()
 
void pubConsensus (ConsensusPhase phase)
 
std::string getHostId (bool forAdmin)
 
void subAccountHistoryStart (std::shared_ptr< ReadView const > const &ledger, SubAccountHistoryInfoWeak &subInfo)
 
void addAccountHistoryJob (SubAccountHistoryInfoWeak subInfo)
 
void setAccountHistoryJobTimer (SubAccountHistoryInfoWeak subInfo)
 
void collect_metrics ()
 

Private Attributes

ServiceRegistryregistry_
 
beast::Journal m_journal
 
std::unique_ptr< LocalTxsm_localTX
 
std::recursive_mutex mSubLock
 
std::atomic< OperatingModemMode
 
std::atomic< bool > needNetworkLedger_ {false}
 
std::atomic< bool > amendmentBlocked_ {false}
 
std::atomic< bool > amendmentWarned_ {false}
 
std::atomic< bool > unlBlocked_ {false}
 
ClosureCounter< void, boost::system::error_code const & > waitHandlerCounter_
 
boost::asio::steady_timer heartbeatTimer_
 
boost::asio::steady_timer clusterTimer_
 
boost::asio::steady_timer accountHistoryTxTimer_
 
RCLConsensus mConsensus
 
std::optional< PublicKey > const validatorPK_
 
std::optional< PublicKey > const validatorMasterPK_
 
ConsensusPhase mLastConsensusPhase
 
LedgerMasterm_ledgerMaster
 
SubInfoMapType mSubAccount
 
SubInfoMapType mSubRTAccount
 
subRpcMapType mRpcSubMap
 
SubAccountHistoryMapType mSubAccountHistory
 
std::array< SubMapType, SubTypes::sLastEntrymStreamMaps
 
ServerFeeSummary mLastFeeSummary
 
JobQueuem_job_queue
 
bool const m_standalone
 
std::size_t const minPeerCount_
 
std::condition_variable mCond
 
std::mutex mMutex
 
DispatchState mDispatchState = DispatchState::none
 
std::vector< TransactionStatusmTransactions
 
StateAccounting accounting_ {}
 
std::set< uint256pendingValidations_
 
std::mutex validationsMutex_
 
std::mutex m_statsMutex
 
Stats m_stats
 

Static Private Attributes

static std::array< char const *, 5 > const states_ = stateNames
 

Detailed Description

Definition at line 70 of file NetworkOPs.cpp.

Member Typedef Documentation

◆ SubMapType

Definition at line 613 of file NetworkOPs.cpp.

◆ SubInfoMapType

Definition at line 614 of file NetworkOPs.cpp.

◆ subRpcMapType

Definition at line 615 of file NetworkOPs.cpp.

◆ SubAccountHistoryMapType

Definition at line 659 of file NetworkOPs.cpp.

◆ clock_type

Definition at line 73 of file NetworkOPs.h.

Member Enumeration Documentation

◆ DispatchState

enum class xrpl::NetworkOPsImp::DispatchState : unsigned char
strongprivate

Synchronization states for transaction batches.

Enumerator
none 
scheduled 
running 

Definition at line 99 of file NetworkOPs.cpp.

◆ SubTypes

Enumerator
sLedger 
sManifests 
sServer 
sTransactions 
sRTTransactions 
sValidations 
sPeerStatus 
sConsensusPhase 
sBookChanges 
sLastEntry 

Definition at line 706 of file NetworkOPs.cpp.

◆ FailHard

enum class xrpl::NetworkOPs::FailHard : unsigned char
stronginherited
Enumerator
no 
yes 

Definition at line 75 of file NetworkOPs.h.

Constructor & Destructor Documentation

◆ NetworkOPsImp()

xrpl::NetworkOPsImp::NetworkOPsImp ( ServiceRegistry registry,
NetworkOPs::clock_type clock,
bool  standalone,
std::size_t  minPeerCount,
bool  start_valid,
JobQueue job_queue,
LedgerMaster ledgerMaster,
ValidatorKeys const &  validatorKeys,
boost::asio::io_context &  io_svc,
beast::Journal  journal,
beast::insight::Collector::ptr const &  collector 
)

Definition at line 200 of file NetworkOPs.cpp.

◆ ~NetworkOPsImp()

xrpl::NetworkOPsImp::~NetworkOPsImp ( )
override

Definition at line 240 of file NetworkOPs.cpp.

Member Function Documentation

◆ getOperatingMode()

OperatingMode xrpl::NetworkOPsImp::getOperatingMode ( ) const
overridevirtual

Implements xrpl::NetworkOPs.

Definition at line 801 of file NetworkOPs.cpp.

◆ strOperatingMode() [1/2]

std::string xrpl::NetworkOPsImp::strOperatingMode ( OperatingMode const  mode,
bool const  admin 
) const
overridevirtual

Implements xrpl::NetworkOPs.

Definition at line 1056 of file NetworkOPs.cpp.

◆ strOperatingMode() [2/2]

std::string xrpl::NetworkOPsImp::strOperatingMode ( bool const  admin = false) const
overridevirtual

Implements xrpl::NetworkOPs.

Definition at line 807 of file NetworkOPs.cpp.

◆ submitTransaction()

void xrpl::NetworkOPsImp::submitTransaction ( std::shared_ptr< STTx const > const &  iTrans)
overridevirtual

Implements xrpl::NetworkOPs.

Definition at line 1075 of file NetworkOPs.cpp.

◆ processTransaction()

void xrpl::NetworkOPsImp::processTransaction ( std::shared_ptr< Transaction > &  transaction,
bool  bUnlimited,
bool  bLocal,
FailHard  failType 
)
overridevirtual

Process transactions as they arrive from the network or which are submitted by clients.

Process local transactions synchronously

Parameters
transactionTransaction object
bUnlimitedWhether a privileged client connection submitted it.
bLocalClient submission.
failTypefail_hard setting from transaction submission.

Implements xrpl::NetworkOPs.

Definition at line 1182 of file NetworkOPs.cpp.

◆ processTransactionSet()

void xrpl::NetworkOPsImp::processTransactionSet ( CanonicalTXSet const &  set)
overridevirtual

Process a set of transactions synchronously, and ensuring that they are processed in one batch.

Parameters
setTransaction object set

Implements xrpl::NetworkOPs.

Definition at line 1264 of file NetworkOPs.cpp.

◆ doTransactionSync()

void xrpl::NetworkOPsImp::doTransactionSync ( std::shared_ptr< Transaction transaction,
bool  bUnlimited,
FailHard  failType 
)

For transactions submitted directly by a client, apply batch of transactions and wait for this transaction to complete.

Parameters
transactionTransaction object.
bUnlimitedWhether a privileged client connection submitted it.
failTypefail_hard setting from transaction submission.

Definition at line 1221 of file NetworkOPs.cpp.

◆ doTransactionAsync()

void xrpl::NetworkOPsImp::doTransactionAsync ( std::shared_ptr< Transaction transaction,
bool  bUnlimited,
FailHard  failtype 
)

For transactions not submitted by a locally connected client, fire and forget.

Add to batch and trigger it to be processed if there's no batch currently being applied.

Parameters
transactionTransaction object
bUnlimitedWhether a privileged client connection submitted it.
failTypefail_hard setting from transaction submission.

Definition at line 1201 of file NetworkOPs.cpp.

◆ preProcessTransaction()

bool xrpl::NetworkOPsImp::preProcessTransaction ( std::shared_ptr< Transaction > &  transaction)
private

Definition at line 1131 of file NetworkOPs.cpp.

◆ doTransactionSyncBatch()

void xrpl::NetworkOPsImp::doTransactionSyncBatch ( std::unique_lock< std::mutex > &  lock,
std::function< bool(std::unique_lock< std::mutex > const &)>  retryCallback 
)
private

Definition at line 1236 of file NetworkOPs.cpp.

◆ transactionBatch()

void xrpl::NetworkOPsImp::transactionBatch ( )

Apply transactions in batches.

Continue until none are queued.

Definition at line 1327 of file NetworkOPs.cpp.

◆ apply()

void xrpl::NetworkOPsImp::apply ( std::unique_lock< std::mutex > &  batchLock)

Attempt to apply transactions and post-process based on the results.

Parameters
Lockthat protects the transaction batching

Definition at line 1341 of file NetworkOPs.cpp.

◆ getOwnerInfo()

Json::Value xrpl::NetworkOPsImp::getOwnerInfo ( std::shared_ptr< ReadView const >  lpLedger,
AccountID const &  account 
)
overridevirtual

Implements xrpl::NetworkOPs.

Definition at line 1579 of file NetworkOPs.cpp.

◆ getBookPage()

void xrpl::NetworkOPsImp::getBookPage ( std::shared_ptr< ReadView const > &  lpLedger,
Book const &  book,
AccountID const &  uTakerID,
bool const  bProof,
unsigned int  iLimit,
Json::Value const &  jvMarker,
Json::Value jvResult 
)
overridevirtual

Implements xrpl::NetworkOPs.

Definition at line 4039 of file NetworkOPs.cpp.

◆ processTrustedProposal()

bool xrpl::NetworkOPsImp::processTrustedProposal ( RCLCxPeerPos  proposal)
overridevirtual

Implements xrpl::NetworkOPs.

Definition at line 1912 of file NetworkOPs.cpp.

◆ recvValidation()

bool xrpl::NetworkOPsImp::recvValidation ( std::shared_ptr< STValidation > const &  val,
std::string const &  source 
)
overridevirtual

Implements xrpl::NetworkOPs.

Definition at line 2340 of file NetworkOPs.cpp.

◆ mapComplete()

void xrpl::NetworkOPsImp::mapComplete ( std::shared_ptr< SHAMap > const &  map,
bool  fromAcquire 
)
overridevirtual

Implements xrpl::NetworkOPs.

Definition at line 1937 of file NetworkOPs.cpp.

◆ switchLastClosedLedger()

void xrpl::NetworkOPsImp::switchLastClosedLedger ( std::shared_ptr< Ledger const > const &  newLCL)
private

Definition at line 1799 of file NetworkOPs.cpp.

◆ checkLastClosedLedger()

bool xrpl::NetworkOPsImp::checkLastClosedLedger ( Overlay::PeerSequence const &  peerList,
uint256 networkClosed 
)
private

Definition at line 1699 of file NetworkOPs.cpp.

◆ beginConsensus()

bool xrpl::NetworkOPsImp::beginConsensus ( uint256 const &  networkClosed,
std::unique_ptr< std::stringstream > const &  clog 
)
overridevirtual

Implements xrpl::NetworkOPs.

Definition at line 1849 of file NetworkOPs.cpp.

◆ endConsensus()

void xrpl::NetworkOPsImp::endConsensus ( std::unique_ptr< std::stringstream > const &  clog)
overridevirtual

Implements xrpl::NetworkOPs.

Definition at line 1955 of file NetworkOPs.cpp.

◆ setStandAlone()

void xrpl::NetworkOPsImp::setStandAlone ( )
overridevirtual

Implements xrpl::NetworkOPs.

Definition at line 813 of file NetworkOPs.cpp.

◆ setStateTimer()

void xrpl::NetworkOPsImp::setStateTimer ( )
overridevirtual

Called to initially start our timers.

Not called for stand-alone mode.

Implements xrpl::NetworkOPs.

Definition at line 862 of file NetworkOPs.cpp.

◆ setNeedNetworkLedger()

void xrpl::NetworkOPsImp::setNeedNetworkLedger ( )
overridevirtual

Implements xrpl::NetworkOPs.

Definition at line 819 of file NetworkOPs.cpp.

◆ clearNeedNetworkLedger()

void xrpl::NetworkOPsImp::clearNeedNetworkLedger ( )
overridevirtual

Implements xrpl::NetworkOPs.

Definition at line 825 of file NetworkOPs.cpp.

◆ isNeedNetworkLedger()

bool xrpl::NetworkOPsImp::isNeedNetworkLedger ( )
overridevirtual

Implements xrpl::NetworkOPs.

Definition at line 831 of file NetworkOPs.cpp.

◆ isFull()

bool xrpl::NetworkOPsImp::isFull ( )
overridevirtual

Implements xrpl::NetworkOPs.

Definition at line 837 of file NetworkOPs.cpp.

◆ setMode()

void xrpl::NetworkOPsImp::setMode ( OperatingMode  om)
overridevirtual

Implements xrpl::NetworkOPs.

Definition at line 2311 of file NetworkOPs.cpp.

◆ isBlocked()

bool xrpl::NetworkOPsImp::isBlocked ( )
overridevirtual

Implements xrpl::NetworkOPs.

Definition at line 1643 of file NetworkOPs.cpp.

◆ isAmendmentBlocked()

bool xrpl::NetworkOPsImp::isAmendmentBlocked ( )
overridevirtual

Implements xrpl::NetworkOPs.

Definition at line 1649 of file NetworkOPs.cpp.

◆ setAmendmentBlocked()

void xrpl::NetworkOPsImp::setAmendmentBlocked ( )
overridevirtual

Implements xrpl::NetworkOPs.

Definition at line 1655 of file NetworkOPs.cpp.

◆ isAmendmentWarned()

bool xrpl::NetworkOPsImp::isAmendmentWarned ( )
overridevirtual

Implements xrpl::NetworkOPs.

Definition at line 1662 of file NetworkOPs.cpp.

◆ setAmendmentWarned()

void xrpl::NetworkOPsImp::setAmendmentWarned ( )
overridevirtual

Implements xrpl::NetworkOPs.

Definition at line 1668 of file NetworkOPs.cpp.

◆ clearAmendmentWarned()

void xrpl::NetworkOPsImp::clearAmendmentWarned ( )
overridevirtual

Implements xrpl::NetworkOPs.

Definition at line 1674 of file NetworkOPs.cpp.

◆ isUNLBlocked()

bool xrpl::NetworkOPsImp::isUNLBlocked ( )
overridevirtual

Implements xrpl::NetworkOPs.

Definition at line 1680 of file NetworkOPs.cpp.

◆ setUNLBlocked()

void xrpl::NetworkOPsImp::setUNLBlocked ( )
overridevirtual

Implements xrpl::NetworkOPs.

Definition at line 1686 of file NetworkOPs.cpp.

◆ clearUNLBlocked()

void xrpl::NetworkOPsImp::clearUNLBlocked ( )
overridevirtual

Implements xrpl::NetworkOPs.

Definition at line 1693 of file NetworkOPs.cpp.

◆ consensusViewChange()

void xrpl::NetworkOPsImp::consensusViewChange ( )
overridevirtual

Implements xrpl::NetworkOPs.

Definition at line 2009 of file NetworkOPs.cpp.

◆ getConsensusInfo()

Json::Value xrpl::NetworkOPsImp::getConsensusInfo ( )
overridevirtual

Implements xrpl::NetworkOPs.

Definition at line 2393 of file NetworkOPs.cpp.

◆ getServerInfo()

Json::Value xrpl::NetworkOPsImp::getServerInfo ( bool  human,
bool  admin,
bool  counters 
)
overridevirtual

Implements xrpl::NetworkOPs.

Definition at line 2399 of file NetworkOPs.cpp.

◆ clearLedgerFetch()

void xrpl::NetworkOPsImp::clearLedgerFetch ( )
overridevirtual

Implements xrpl::NetworkOPs.

Definition at line 2767 of file NetworkOPs.cpp.

◆ getLedgerFetchInfo()

Json::Value xrpl::NetworkOPsImp::getLedgerFetchInfo ( )
overridevirtual

Implements xrpl::NetworkOPs.

Definition at line 2773 of file NetworkOPs.cpp.

◆ acceptLedger()

std::uint32_t xrpl::NetworkOPsImp::acceptLedger ( std::optional< std::chrono::milliseconds consensusDelay)
overridevirtual

Accepts the current transaction tree, return the new ledger's sequence.

This API is only used via RPC with the server in STANDALONE mode and performs a virtual consensus round, with all the transactions we are proposing being accepted.

Implements xrpl::NetworkOPs.

Definition at line 3790 of file NetworkOPs.cpp.

◆ reportFeeChange()

void xrpl::NetworkOPsImp::reportFeeChange ( )
overridevirtual

Implements xrpl::NetworkOPs.

Definition at line 2924 of file NetworkOPs.cpp.

◆ reportConsensusStateChange()

void xrpl::NetworkOPsImp::reportConsensusStateChange ( ConsensusPhase  phase)

Definition at line 2939 of file NetworkOPs.cpp.

◆ updateLocalTx()

void xrpl::NetworkOPsImp::updateLocalTx ( ReadView const &  view)
overridevirtual

Implements xrpl::NetworkOPs.

Definition at line 2945 of file NetworkOPs.cpp.

◆ getLocalTxCount()

std::size_t xrpl::NetworkOPsImp::getLocalTxCount ( )
overridevirtual

Implements xrpl::NetworkOPs.

Definition at line 2950 of file NetworkOPs.cpp.

◆ pubLedger()

void xrpl::NetworkOPsImp::pubLedger ( std::shared_ptr< ReadView const > const &  lpAccepted)
overridevirtual

Implements xrpl::NetworkOPs.

Definition at line 2819 of file NetworkOPs.cpp.

◆ pubProposedTransaction()

void xrpl::NetworkOPsImp::pubProposedTransaction ( std::shared_ptr< ReadView const > const &  ledger,
std::shared_ptr< STTx const > const &  transaction,
TER  result 
)
overridevirtual

Implements xrpl::NetworkOPs.

Definition at line 2779 of file NetworkOPs.cpp.

◆ pubValidation()

void xrpl::NetworkOPsImp::pubValidation ( std::shared_ptr< STValidation > const &  val)
overridevirtual

Implements xrpl::NetworkOPs.

Definition at line 2179 of file NetworkOPs.cpp.

◆ subAccount()

void xrpl::NetworkOPsImp::subAccount ( InfoSub::ref  ispListener,
hash_set< AccountID > const &  vnaAccountIDs,
bool  rt 
)
overridevirtual

Implements xrpl::InfoSub::Source.

Definition at line 3314 of file NetworkOPs.cpp.

◆ unsubAccount()

void xrpl::NetworkOPsImp::unsubAccount ( InfoSub::ref  ispListener,
hash_set< AccountID > const &  vnaAccountIDs,
bool  rt 
)
overridevirtual

Implements xrpl::InfoSub::Source.

Definition at line 3347 of file NetworkOPs.cpp.

◆ unsubAccountInternal()

void xrpl::NetworkOPsImp::unsubAccountInternal ( std::uint64_t  seq,
hash_set< AccountID > const &  vnaAccountIDs,
bool  rt 
)
overridevirtual

Implements xrpl::InfoSub::Source.

Definition at line 3360 of file NetworkOPs.cpp.

◆ subAccountHistory()

error_code_i xrpl::NetworkOPsImp::subAccountHistory ( InfoSub::ref  ispListener,
AccountID const &  account 
)
overridevirtual

subscribe an account's new transactions and retrieve the account's historical transactions

Returns
rpcSUCCESS if successful, otherwise an error code

Implements xrpl::InfoSub::Source.

Definition at line 3693 of file NetworkOPs.cpp.

◆ unsubAccountHistory()

void xrpl::NetworkOPsImp::unsubAccountHistory ( InfoSub::ref  ispListener,
AccountID const &  account,
bool  historyOnly 
)
overridevirtual

unsubscribe an account's transactions

Parameters
historyOnlyif true, only stop historical transactions
Note
once a client receives enough historical transactions, it should unsubscribe with historyOnly == true to stop receiving more historical transactions. It will continue to receive new transactions.

Implements xrpl::InfoSub::Source.

Definition at line 3732 of file NetworkOPs.cpp.

◆ unsubAccountHistoryInternal()

void xrpl::NetworkOPsImp::unsubAccountHistoryInternal ( std::uint64_t  seq,
AccountID const &  account,
bool  historyOnly 
)
overridevirtual

Implements xrpl::InfoSub::Source.

Definition at line 3740 of file NetworkOPs.cpp.

◆ subLedger()

bool xrpl::NetworkOPsImp::subLedger ( InfoSub::ref  ispListener,
Json::Value jvResult 
)
overridevirtual

Implements xrpl::InfoSub::Source.

Definition at line 3808 of file NetworkOPs.cpp.

◆ unsubLedger()

bool xrpl::NetworkOPsImp::unsubLedger ( std::uint64_t  uListener)
overridevirtual

Implements xrpl::InfoSub::Source.

Definition at line 3842 of file NetworkOPs.cpp.

◆ subBookChanges()

bool xrpl::NetworkOPsImp::subBookChanges ( InfoSub::ref  ispListener)
overridevirtual

Implements xrpl::InfoSub::Source.

Definition at line 3834 of file NetworkOPs.cpp.

◆ unsubBookChanges()

bool xrpl::NetworkOPsImp::unsubBookChanges ( std::uint64_t  uListener)
overridevirtual

Implements xrpl::InfoSub::Source.

Definition at line 3850 of file NetworkOPs.cpp.

◆ subServer()

bool xrpl::NetworkOPsImp::subServer ( InfoSub::ref  ispListener,
Json::Value jvResult,
bool  admin 
)
overridevirtual

Implements xrpl::InfoSub::Source.

Definition at line 3874 of file NetworkOPs.cpp.

◆ unsubServer()

bool xrpl::NetworkOPsImp::unsubServer ( std::uint64_t  uListener)
overridevirtual

Implements xrpl::InfoSub::Source.

Definition at line 3898 of file NetworkOPs.cpp.

◆ subBook()

bool xrpl::NetworkOPsImp::subBook ( InfoSub::ref  ispListener,
Book const &  book 
)
overridevirtual

Implements xrpl::InfoSub::Source.

Definition at line 3767 of file NetworkOPs.cpp.

◆ unsubBook()

bool xrpl::NetworkOPsImp::unsubBook ( std::uint64_t  uListener,
Book const &  book 
)
overridevirtual

Implements xrpl::InfoSub::Source.

Definition at line 3781 of file NetworkOPs.cpp.

◆ subManifests()

bool xrpl::NetworkOPsImp::subManifests ( InfoSub::ref  ispListener)
overridevirtual

Implements xrpl::InfoSub::Source.

Definition at line 3858 of file NetworkOPs.cpp.

◆ unsubManifests()

bool xrpl::NetworkOPsImp::unsubManifests ( std::uint64_t  uListener)
overridevirtual

Implements xrpl::InfoSub::Source.

Definition at line 3866 of file NetworkOPs.cpp.

◆ pubManifest()

void xrpl::NetworkOPsImp::pubManifest ( Manifest const &  mo)
overridevirtual

Implements xrpl::InfoSub::Source.

Definition at line 2018 of file NetworkOPs.cpp.

◆ subTransactions()

bool xrpl::NetworkOPsImp::subTransactions ( InfoSub::ref  ispListener)
overridevirtual

Implements xrpl::InfoSub::Source.

Definition at line 3906 of file NetworkOPs.cpp.

◆ unsubTransactions()

bool xrpl::NetworkOPsImp::unsubTransactions ( std::uint64_t  uListener)
overridevirtual

Implements xrpl::InfoSub::Source.

Definition at line 3914 of file NetworkOPs.cpp.

◆ subRTTransactions()

bool xrpl::NetworkOPsImp::subRTTransactions ( InfoSub::ref  ispListener)
overridevirtual

Implements xrpl::InfoSub::Source.

Definition at line 3922 of file NetworkOPs.cpp.

◆ unsubRTTransactions()

bool xrpl::NetworkOPsImp::unsubRTTransactions ( std::uint64_t  uListener)
overridevirtual

Implements xrpl::InfoSub::Source.

Definition at line 3930 of file NetworkOPs.cpp.

◆ subValidations()

bool xrpl::NetworkOPsImp::subValidations ( InfoSub::ref  ispListener)
overridevirtual

Implements xrpl::InfoSub::Source.

Definition at line 3938 of file NetworkOPs.cpp.

◆ unsubValidations()

bool xrpl::NetworkOPsImp::unsubValidations ( std::uint64_t  uListener)
overridevirtual

Implements xrpl::InfoSub::Source.

Definition at line 3952 of file NetworkOPs.cpp.

◆ subPeerStatus()

bool xrpl::NetworkOPsImp::subPeerStatus ( InfoSub::ref  ispListener)
overridevirtual

Implements xrpl::InfoSub::Source.

Definition at line 3960 of file NetworkOPs.cpp.

◆ unsubPeerStatus()

bool xrpl::NetworkOPsImp::unsubPeerStatus ( std::uint64_t  uListener)
overridevirtual

Implements xrpl::InfoSub::Source.

Definition at line 3968 of file NetworkOPs.cpp.

◆ pubPeerStatus()

void xrpl::NetworkOPsImp::pubPeerStatus ( std::function< Json::Value(void)> const &  func)
overridevirtual

Implements xrpl::InfoSub::Source.

Definition at line 2283 of file NetworkOPs.cpp.

◆ subConsensus()

bool xrpl::NetworkOPsImp::subConsensus ( InfoSub::ref  ispListener)
overridevirtual

Implements xrpl::InfoSub::Source.

Definition at line 3976 of file NetworkOPs.cpp.

◆ unsubConsensus()

bool xrpl::NetworkOPsImp::unsubConsensus ( std::uint64_t  uListener)
overridevirtual

Implements xrpl::InfoSub::Source.

Definition at line 3984 of file NetworkOPs.cpp.

◆ findRpcSub()

InfoSub::pointer xrpl::NetworkOPsImp::findRpcSub ( std::string const &  strUrl)
overridevirtual

Implements xrpl::InfoSub::Source.

Definition at line 3991 of file NetworkOPs.cpp.

◆ addRpcSub()

InfoSub::pointer xrpl::NetworkOPsImp::addRpcSub ( std::string const &  strUrl,
InfoSub::ref  rspEntry 
)
overridevirtual

Implements xrpl::InfoSub::Source.

Definition at line 4004 of file NetworkOPs.cpp.

◆ tryRemoveRpcSub()

bool xrpl::NetworkOPsImp::tryRemoveRpcSub ( std::string const &  strUrl)
overridevirtual

Implements xrpl::InfoSub::Source.

Definition at line 4014 of file NetworkOPs.cpp.

◆ stop()

void xrpl::NetworkOPsImp::stop ( )
overridevirtual

Implements xrpl::NetworkOPs.

Definition at line 524 of file NetworkOPs.cpp.

◆ stateAccounting()

void xrpl::NetworkOPsImp::stateAccounting ( Json::Value obj)
overridevirtual

Implements xrpl::NetworkOPs.

Definition at line 3945 of file NetworkOPs.cpp.

◆ setTimer()

void xrpl::NetworkOPsImp::setTimer ( boost::asio::steady_timer &  timer,
std::chrono::milliseconds const &  expiry_time,
std::function< void()>  onExpire,
std::function< void()>  onError 
)
private

Definition at line 872 of file NetworkOPs.cpp.

◆ setHeartbeatTimer()

void xrpl::NetworkOPsImp::setHeartbeatTimer ( )
private

Definition at line 900 of file NetworkOPs.cpp.

◆ setClusterTimer()

void xrpl::NetworkOPsImp::setClusterTimer ( )
private

Definition at line 910 of file NetworkOPs.cpp.

◆ processHeartbeatTimer()

void xrpl::NetworkOPsImp::processHeartbeatTimer ( )
private

Definition at line 934 of file NetworkOPs.cpp.

◆ processClusterTimer()

void xrpl::NetworkOPsImp::processClusterTimer ( )
private

Definition at line 1012 of file NetworkOPs.cpp.

◆ transJson()

MultiApiJson xrpl::NetworkOPsImp::transJson ( std::shared_ptr< STTx const > const &  transaction,
TER  result,
bool  validated,
std::shared_ptr< ReadView const > const &  ledger,
std::optional< std::reference_wrapper< TxMeta const > >  meta 
)
private

Definition at line 2958 of file NetworkOPs.cpp.

◆ pubValidatedTransaction()

void xrpl::NetworkOPsImp::pubValidatedTransaction ( std::shared_ptr< ReadView const > const &  ledger,
AcceptedLedgerTx const &  transaction,
bool  last 
)
private

Definition at line 3055 of file NetworkOPs.cpp.

◆ pubAccountTransaction()

void xrpl::NetworkOPsImp::pubAccountTransaction ( std::shared_ptr< ReadView const > const &  ledger,
AcceptedLedgerTx const &  transaction,
bool  last 
)
private

Definition at line 3111 of file NetworkOPs.cpp.

◆ pubProposedAccountTransaction()

void xrpl::NetworkOPsImp::pubProposedAccountTransaction ( std::shared_ptr< ReadView const > const &  ledger,
std::shared_ptr< STTx const > const &  transaction,
TER  result 
)
private

Definition at line 3238 of file NetworkOPs.cpp.

◆ pubServer()

void xrpl::NetworkOPsImp::pubServer ( )
private

Definition at line 2092 of file NetworkOPs.cpp.

◆ pubConsensus()

void xrpl::NetworkOPsImp::pubConsensus ( ConsensusPhase  phase)
private

Definition at line 2152 of file NetworkOPs.cpp.

◆ getHostId()

std::string xrpl::NetworkOPsImp::getHostId ( bool  forAdmin)
private

Definition at line 843 of file NetworkOPs.cpp.

◆ subAccountHistoryStart()

void xrpl::NetworkOPsImp::subAccountHistoryStart ( std::shared_ptr< ReadView const > const &  ledger,
SubAccountHistoryInfoWeak subInfo 
)
private
Note
called while holding mSubLock

Definition at line 3651 of file NetworkOPs.cpp.

◆ addAccountHistoryJob()

void xrpl::NetworkOPsImp::addAccountHistoryJob ( SubAccountHistoryInfoWeak  subInfo)
private

Definition at line 3385 of file NetworkOPs.cpp.

◆ setAccountHistoryJobTimer()

void xrpl::NetworkOPsImp::setAccountHistoryJobTimer ( SubAccountHistoryInfoWeak  subInfo)
private

Definition at line 922 of file NetworkOPs.cpp.

◆ collect_metrics()

void xrpl::NetworkOPsImp::collect_metrics ( )
private

Definition at line 4358 of file NetworkOPs.cpp.

◆ doFailHard()

static FailHard xrpl::NetworkOPs::doFailHard ( bool  noMeansDont)
staticinherited

Definition at line 77 of file NetworkOPs.h.

Member Data Documentation

◆ states_

std::array< char const *, 5 > const xrpl::NetworkOPsImp::states_ = stateNames
staticprivate

Definition at line 105 of file NetworkOPs.cpp.

◆ registry_

ServiceRegistry& xrpl::NetworkOPsImp::registry_
private

Definition at line 671 of file NetworkOPs.cpp.

◆ m_journal

beast::Journal xrpl::NetworkOPsImp::m_journal
private

Definition at line 672 of file NetworkOPs.cpp.

◆ m_localTX

std::unique_ptr<LocalTxs> xrpl::NetworkOPsImp::m_localTX
private

Definition at line 674 of file NetworkOPs.cpp.

◆ mSubLock

std::recursive_mutex xrpl::NetworkOPsImp::mSubLock
private

Definition at line 676 of file NetworkOPs.cpp.

◆ mMode

std::atomic<OperatingMode> xrpl::NetworkOPsImp::mMode
private

Definition at line 678 of file NetworkOPs.cpp.

◆ needNetworkLedger_

std::atomic<bool> xrpl::NetworkOPsImp::needNetworkLedger_ {false}
private

Definition at line 680 of file NetworkOPs.cpp.

◆ amendmentBlocked_

std::atomic<bool> xrpl::NetworkOPsImp::amendmentBlocked_ {false}
private

Definition at line 681 of file NetworkOPs.cpp.

◆ amendmentWarned_

std::atomic<bool> xrpl::NetworkOPsImp::amendmentWarned_ {false}
private

Definition at line 682 of file NetworkOPs.cpp.

◆ unlBlocked_

std::atomic<bool> xrpl::NetworkOPsImp::unlBlocked_ {false}
private

Definition at line 683 of file NetworkOPs.cpp.

◆ waitHandlerCounter_

ClosureCounter<void, boost::system::error_code const&> xrpl::NetworkOPsImp::waitHandlerCounter_
private

Definition at line 685 of file NetworkOPs.cpp.

◆ heartbeatTimer_

boost::asio::steady_timer xrpl::NetworkOPsImp::heartbeatTimer_
private

Definition at line 686 of file NetworkOPs.cpp.

◆ clusterTimer_

boost::asio::steady_timer xrpl::NetworkOPsImp::clusterTimer_
private

Definition at line 687 of file NetworkOPs.cpp.

◆ accountHistoryTxTimer_

boost::asio::steady_timer xrpl::NetworkOPsImp::accountHistoryTxTimer_
private

Definition at line 688 of file NetworkOPs.cpp.

◆ mConsensus

RCLConsensus xrpl::NetworkOPsImp::mConsensus
private

Definition at line 690 of file NetworkOPs.cpp.

◆ validatorPK_

std::optional<PublicKey> const xrpl::NetworkOPsImp::validatorPK_
private

Definition at line 692 of file NetworkOPs.cpp.

◆ validatorMasterPK_

std::optional<PublicKey> const xrpl::NetworkOPsImp::validatorMasterPK_
private

Definition at line 693 of file NetworkOPs.cpp.

◆ mLastConsensusPhase

ConsensusPhase xrpl::NetworkOPsImp::mLastConsensusPhase
private

Definition at line 695 of file NetworkOPs.cpp.

◆ m_ledgerMaster

LedgerMaster& xrpl::NetworkOPsImp::m_ledgerMaster
private

Definition at line 697 of file NetworkOPs.cpp.

◆ mSubAccount

SubInfoMapType xrpl::NetworkOPsImp::mSubAccount
private

Definition at line 699 of file NetworkOPs.cpp.

◆ mSubRTAccount

SubInfoMapType xrpl::NetworkOPsImp::mSubRTAccount
private

Definition at line 700 of file NetworkOPs.cpp.

◆ mRpcSubMap

subRpcMapType xrpl::NetworkOPsImp::mRpcSubMap
private

Definition at line 702 of file NetworkOPs.cpp.

◆ mSubAccountHistory

SubAccountHistoryMapType xrpl::NetworkOPsImp::mSubAccountHistory
private

Definition at line 704 of file NetworkOPs.cpp.

◆ mStreamMaps

std::array<SubMapType, SubTypes::sLastEntry> xrpl::NetworkOPsImp::mStreamMaps
private

Definition at line 719 of file NetworkOPs.cpp.

◆ mLastFeeSummary

ServerFeeSummary xrpl::NetworkOPsImp::mLastFeeSummary
private

Definition at line 721 of file NetworkOPs.cpp.

◆ m_job_queue

JobQueue& xrpl::NetworkOPsImp::m_job_queue
private

Definition at line 723 of file NetworkOPs.cpp.

◆ m_standalone

bool const xrpl::NetworkOPsImp::m_standalone
private

Definition at line 726 of file NetworkOPs.cpp.

◆ minPeerCount_

std::size_t const xrpl::NetworkOPsImp::minPeerCount_
private

Definition at line 729 of file NetworkOPs.cpp.

◆ mCond

std::condition_variable xrpl::NetworkOPsImp::mCond
private

Definition at line 732 of file NetworkOPs.cpp.

◆ mMutex

std::mutex xrpl::NetworkOPsImp::mMutex
private

Definition at line 733 of file NetworkOPs.cpp.

◆ mDispatchState

DispatchState xrpl::NetworkOPsImp::mDispatchState = DispatchState::none
private

Definition at line 734 of file NetworkOPs.cpp.

◆ mTransactions

std::vector<TransactionStatus> xrpl::NetworkOPsImp::mTransactions
private

Definition at line 735 of file NetworkOPs.cpp.

◆ accounting_

StateAccounting xrpl::NetworkOPsImp::accounting_ {}
private

Definition at line 737 of file NetworkOPs.cpp.

◆ pendingValidations_

std::set<uint256> xrpl::NetworkOPsImp::pendingValidations_
private

Definition at line 739 of file NetworkOPs.cpp.

◆ validationsMutex_

std::mutex xrpl::NetworkOPsImp::validationsMutex_
private

Definition at line 740 of file NetworkOPs.cpp.

◆ m_statsMutex

std::mutex xrpl::NetworkOPsImp::m_statsMutex
private

Definition at line 775 of file NetworkOPs.cpp.

◆ m_stats

Stats xrpl::NetworkOPsImp::m_stats
private

Definition at line 776 of file NetworkOPs.cpp.