|
xrpld
|
Calls the JtLedgerReq-dispatched processor synchronously, so the reply is visible through sent(). More...


Public Types | |
| using | MiddleType = boost::beast::tcp_stream |
| using | StreamType = boost::beast::ssl_stream<MiddleType> |
| using | SocketType = boost::asio::ip::tcp::socket |
| enum class | Tracking { Diverged , Unknown , Converged } |
| Whether the peer's view of the ledger converges or diverges from ours. More... | |
| using | Ptr = std::shared_ptr<Peer> |
| using | ID = std::uint32_t |
| Uniquely identifies a peer. | |
Public Member Functions | |
| void | runProcessGetObjectByHash (std::shared_ptr< protocol::TMGetObjectByHash > const &m) |
| CapturePeer (Application &app, Peer::ID id, std::shared_ptr< peer_finder::Slot > const &slot, HttpRequestType request, PublicKey const &publicKey, ProtocolVersion protocol, resource::Consumer consumer, std::unique_ptr< StreamType > streamPtr, OverlayImpl &overlay) | |
| Takes PeerImp's two rvalue-reference parameters by value instead, so a derived double can inherit this constructor without a never-moved-from warning. | |
| void | run () override |
| Does nothing, so the peer stays registered. | |
| void | send (std::shared_ptr< Message > const &m) override |
| Captures the message instead of writing it, so replies are observable. | |
| std::vector< std::shared_ptr< Message > > const & | sent () const |
| std::shared_ptr< Message > | lastSent () const |
| resource::Charge | feeCharge () const |
| Reads the accumulated charge without draining it through charge(). | |
| beast::Journal const & | pJournal () const |
| std::shared_ptr< peer_finder::Slot > const & | slot () |
| void | stop () override |
| void | sendTxQueue () override |
| Send aggregated transactions' hashes. | |
| void | addTxQueue (UInt256 const &hash) override |
| Add transaction's hash to the transactions' hashes queue. | |
| void | removeTxQueue (UInt256 const &hash) override |
| Remove transaction's hash from the transactions' hashes queue. | |
| template<class FwdIt> requires ( std::is_same_v< // typename std::iterator_traits<FwdIt>::value_type, peer_finder::Endpoint>) | |
| void | sendEndpoints (FwdIt first, FwdIt last) |
| Send a set of PeerFinder endpoints as a protocol message. | |
| beast::ip::Endpoint | getRemoteAddress () const override |
| void | charge (resource::Charge const &fee, std::string const &context) override |
| Adjust this peer's load balance based on the type of load imposed. | |
| Peer::ID | id () const override |
| bool | crawl () const |
| Returns true if this connection will publicly share its IP address. | |
| bool | cluster () const override |
| Returns true if this connection is a member of the cluster. | |
| void | checkTracking (std::uint32_t validationSeq) |
| Check if the peer is tracking. | |
| void | checkTracking (std::uint32_t seq1, std::uint32_t seq2) |
| PublicKey const & | getNodePublic () const override |
| std::string | getVersion () const |
| Return the version of xrpld that the peer is running, if reported. | |
| ClockType::duration | uptime () const |
| json::Value | json () override |
| bool | supportsFeature (ProtocolFeature f) const override |
| std::optional< std::size_t > | publisherListSequence (PublicKey const &pubKey) const override |
| void | setPublisherListSequence (PublicKey const &pubKey, std::size_t const seq) override |
| UInt256 | getClosedLedgerHash () const override |
| bool | hasLedger (UInt256 const &hash, std::uint32_t seq) const override |
| void | ledgerRange (std::uint32_t &minSeq, std::uint32_t &maxSeq) const override |
| bool | hasTxSet (UInt256 const &hash) const override |
| void | cycleStatus () override |
| bool | hasRange (std::uint32_t uMin, std::uint32_t uMax) override |
| int | getScore (bool haveItem) const override |
| bool | isHighLatency () const override |
| void | fail (std::string const &reason) |
| bool | compressionEnabled () const override |
| std::size_t | maxManifestsMessageSize () const |
| Largest TMManifests message this node accepts, in bytes. | |
| bool | txReduceRelayEnabled () const override |
| void | onMessageUnknown (std::uint16_t type) |
| void | onMessageBegin (std::uint16_t type, std::shared_ptr<::google::protobuf::Message > const &m, std::size_t size, std::size_t uncompressedSize, bool isCompressed) |
| void | onMessageEnd (std::uint16_t type, std::shared_ptr<::google::protobuf::Message > const &m) |
| void | onMessage (std::shared_ptr< protocol::TMManifests > const &m) |
| void | onMessage (std::shared_ptr< protocol::TMPing > const &m) |
| void | onMessage (std::shared_ptr< protocol::TMCluster > const &m) |
| void | onMessage (std::shared_ptr< protocol::TMEndpoints > const &m) |
| void | onMessage (std::shared_ptr< protocol::TMTransaction > const &m) |
| void | onMessage (std::shared_ptr< protocol::TMGetLedger > const &m) |
| void | onMessage (std::shared_ptr< protocol::TMLedgerData > const &m) |
| void | onMessage (std::shared_ptr< protocol::TMProposeSet > const &m) |
| void | onMessage (std::shared_ptr< protocol::TMStatusChange > const &m) |
| void | onMessage (std::shared_ptr< protocol::TMHaveTransactionSet > const &m) |
| void | onMessage (std::shared_ptr< protocol::TMValidatorListCollection > const &m) |
| void | onMessage (std::shared_ptr< protocol::TMValidation > const &m) |
| void | onMessage (std::shared_ptr< protocol::TMGetObjectByHash > const &m) |
| void | onMessage (std::shared_ptr< protocol::TMHaveTransactions > const &m) |
| void | onMessage (std::shared_ptr< protocol::TMTransactions > const &m) |
| void | onMessage (std::shared_ptr< protocol::TMSquelch > const &m) |
| void | onMessage (std::shared_ptr< protocol::TMProofPathRequest > const &m) |
| void | onMessage (std::shared_ptr< protocol::TMProofPathResponse > const &m) |
| void | onMessage (std::shared_ptr< protocol::TMReplayDeltaRequest > const &m) |
| void | onMessage (std::shared_ptr< protocol::TMReplayDeltaResponse > const &m) |
| T | shared_from_this (T... args) |
| T | weak_from_this (T... args) |
Protected Member Functions | |
| void | processLedgerRequest (std::shared_ptr< protocol::TMGetLedger > const &m, std::vector< SHAMapNodeID > nodeIDs) |
| void | processGetObjectByHash (std::shared_ptr< protocol::TMGetObjectByHash > const &m) |
| Process a generic-query TMGetObjectByHash message. | |
| resource::Charge | currentFeeCharge () const |
| Read-only accessor for the accumulated peer-message charge. | |
Static Protected Member Functions | |
| static resource::Charge | computeGetObjectByHashFee (int const requested, int const found) |
| Compute the per-message resource charge for a TMGetObjectByHash request based on how much work was actually performed. | |
Private Types | |
| using | ClockType = std::chrono::steady_clock |
| using | ErrorCode = boost::system::error_code |
| using | AddressType = boost::asio::ip::address |
| using | EndpointType = boost::asio::ip::tcp::endpoint |
| using | WaitableTimer = boost::asio::basic_waitable_timer<std::chrono::steady_clock> |
| using | Compressed = compression::Compressed |
Private Member Functions | |
| void | fail (std::string const &name, ErrorCode ec) |
| void | close () |
| void | gracefulClose () |
| void | setTimer () |
| void | cancelTimer () noexcept |
| void | onTimer (boost::system::error_code const &ec) |
| void | onShutdown (ErrorCode ec) |
| void | doAccept () |
| std::string | name () const |
| std::string | domain () const |
| void | doProtocolStart () |
| void | onReadMessage (ErrorCode ec, std::size_t bytesTransferred) |
| void | onWriteMessage (ErrorCode ec, std::size_t bytesTransferred) |
| void | handleTransaction (std::shared_ptr< protocol::TMTransaction > const &m, bool eraseTxQueue, bool batch) |
| Called from onMessage(TMTransaction(s)). | |
| void | handleHaveTransactions (std::shared_ptr< protocol::TMHaveTransactions > const &m) |
| Handle protocol message with hashes of transactions that have not been relayed by an upstream node down to its peers - request transactions, which have not been relayed to this peer. | |
| std::string const & | fingerprint () const override |
| std::string const & | prefix () const |
| void | addLedger (UInt256 const &hash, std::scoped_lock< std::mutex > const &lockedRecentLock) |
| void | doFetchPack (std::shared_ptr< protocol::TMGetObjectByHash > const &packet) |
| void | onValidatorListMessage (std::string const &messageType, std::string const &manifest, std::uint32_t version, std::vector< ValidatorBlobInfo > const &blobs) |
| void | doTransactions (std::shared_ptr< protocol::TMGetObjectByHash > const &packet) |
| Process peer's request to send missing transactions. | |
| void | checkTransaction (HashRouterFlags flags, bool checkSignature, std::shared_ptr< STTx const > const &stx, bool batch) |
| void | checkPropose (bool isTrusted, std::shared_ptr< protocol::TMProposeSet > const &packet, RCLCxPeerPos peerPos) |
| void | checkValidation (std::shared_ptr< STValidation > const &val, UInt256 const &key, std::shared_ptr< protocol::TMValidation > const &packet) |
| void | sendLedgerBase (std::shared_ptr< Ledger const > const &ledger, protocol::TMLedgerData &ledgerData) |
| std::shared_ptr< Ledger const > | getLedger (std::shared_ptr< protocol::TMGetLedger > const &m) |
| std::shared_ptr< SHAMap const > | getTxSet (std::shared_ptr< protocol::TMGetLedger > const &m) const |
Static Private Member Functions | |
| static std::string | makePrefix (std::string const &fingerprint) |
Calls the JtLedgerReq-dispatched processor synchronously, so the reply is visible through sent().
Definition at line 39 of file TMGetObjectByHash_test.cpp.
|
inherited |
Definition at line 49 of file CapturePeer.h.
|
inherited |
Definition at line 50 of file CapturePeer.h.
|
inherited |
Definition at line 51 of file CapturePeer.h.
|
privateinherited |
|
privateinherited |
|
privateinherited |
|
privateinherited |
|
privateinherited |
|
privateinherited |
|
inherited |
Definition at line 33 of file xrpld/overlay/Peer.h.
|
inherited |
Uniquely identifies a peer.
This can be stored in tables to find the peer later. Callers can discover if the peer is no longer connected and make adjustments as needed.
Definition at line 41 of file xrpld/overlay/Peer.h.
|
stronginherited |
| void xrpl::test::TMGetObjectByHash_test::GetObjectPeer::runProcessGetObjectByHash | ( | std::shared_ptr< protocol::TMGetObjectByHash > const & | m | ) |
Definition at line 45 of file TMGetObjectByHash_test.cpp.
| xrpl::test::CapturePeer::CapturePeer | ( | Application & | app, |
| Peer::ID | id, | ||
| std::shared_ptr< peer_finder::Slot > const & | slot, | ||
| HttpRequestType | request, | ||
| PublicKey const & | publicKey, | ||
| ProtocolVersion | protocol, | ||
| resource::Consumer | consumer, | ||
| std::unique_ptr< StreamType > | streamPtr, | ||
| OverlayImpl & | overlay ) |
Takes PeerImp's two rvalue-reference parameters by value instead, so a derived double can inherit this constructor without a never-moved-from warning.
| app | The application owning the peer. |
| id | The connection id, unique among the overlay's peers. |
| slot | The peer finder slot; must be seated. |
| request | The handshake request. |
| publicKey | The peer's node public key. |
| protocol | The negotiated protocol version. |
| consumer | The resource manager endpoint for the peer. |
| streamPtr | The connection's ssl stream. |
| overlay | The overlay to register with. |
Definition at line 68 of file CapturePeer.h.
|
overridevirtualinherited |
Does nothing, so the peer stays registered.
The real run() reaches PeerImp::doAccept, which fails on an unconnected socket and detaches.
Reimplemented from xrpl::PeerImp.
Definition at line 98 of file CapturePeer.h.
|
overridevirtualinherited |
Captures the message instead of writing it, so replies are observable.
Implements xrpl::Peer.
Definition at line 106 of file CapturePeer.h.
|
inherited |
Definition at line 115 of file CapturePeer.h.
|
inherited |
Definition at line 124 of file CapturePeer.h.
|
inherited |
Reads the accumulated charge without draining it through charge().
Definition at line 135 of file CapturePeer.h.
|
inherited |
|
inherited |
|
overridevirtualinherited |
Implements xrpl::OverlayImpl::Child.
Definition at line 264 of file PeerImp.cpp.
|
overridevirtualinherited |
Send aggregated transactions' hashes.
Implements xrpl::Peer.
Definition at line 338 of file PeerImp.cpp.
|
overridevirtualinherited |
Add transaction's hash to the transactions' hashes queue.
| hash | transaction's hash |
Implements xrpl::Peer.
Reimplemented in xrpl::test::tx_reduce_relay_test::TxReducePeer.
Definition at line 354 of file PeerImp.cpp.
|
overridevirtualinherited |
Remove transaction's hash from the transactions' hashes queue.
| hash | transaction's hash |
Implements xrpl::Peer.
Definition at line 369 of file PeerImp.cpp.
|
inherited |
|
overridevirtualinherited |
Implements xrpl::Peer.
|
overridevirtualinherited |
Adjust this peer's load balance based on the type of load imposed.
Implements xrpl::Peer.
Definition at line 378 of file PeerImp.cpp.
|
overridevirtualinherited |
Implements xrpl::Peer.
|
inherited |
Returns true if this connection will publicly share its IP address.
Definition at line 404 of file PeerImp.cpp.
|
overridevirtualinherited |
Returns true if this connection is a member of the cluster.
Implements xrpl::Peer.
Definition at line 413 of file PeerImp.cpp.
|
inherited |
Check if the peer is tracking.
| validationSeq | The ledger sequence of a recently-validated ledger |
Definition at line 2177 of file PeerImp.cpp.
|
inherited |
Definition at line 2196 of file PeerImp.cpp.
|
overridevirtualinherited |
Implements xrpl::Peer.
|
inherited |
Return the version of xrpld that the peer is running, if reported.
Definition at line 419 of file PeerImp.cpp.
|
inherited |
|
overridevirtualinherited |
Implements xrpl::Peer.
Definition at line 427 of file PeerImp.cpp.
|
overridevirtualinherited |
Implements xrpl::Peer.
Definition at line 541 of file PeerImp.cpp.
|
overridevirtualinherited |
Implements xrpl::Peer.
|
overridevirtualinherited |
Implements xrpl::Peer.
|
overridevirtualinherited |
Implements xrpl::Peer.
|
overridevirtualinherited |
Implements xrpl::Peer.
Definition at line 556 of file PeerImp.cpp.
|
overridevirtualinherited |
Implements xrpl::Peer.
Definition at line 570 of file PeerImp.cpp.
|
overridevirtualinherited |
Implements xrpl::Peer.
Definition at line 579 of file PeerImp.cpp.
|
overridevirtualinherited |
Implements xrpl::Peer.
Definition at line 586 of file PeerImp.cpp.
|
overridevirtualinherited |
Implements xrpl::Peer.
Definition at line 596 of file PeerImp.cpp.
|
overridevirtualinherited |
Implements xrpl::Peer.
Definition at line 3699 of file PeerImp.cpp.
|
overridevirtualinherited |
Implements xrpl::Peer.
Definition at line 3741 of file PeerImp.cpp.
|
inherited |
Definition at line 622 of file PeerImp.cpp.
|
privateinherited |
Definition at line 635 of file PeerImp.cpp.
|
overridevirtualinherited |
Implements xrpl::Peer.
|
nodiscardinherited |
|
overridevirtualinherited |
Implements xrpl::Peer.
|
privateinherited |
Definition at line 605 of file PeerImp.cpp.
|
privateinherited |
Definition at line 647 of file PeerImp.cpp.
|
privateinherited |
Definition at line 662 of file PeerImp.cpp.
|
privatenoexceptinherited |
Definition at line 679 of file PeerImp.cpp.
|
staticprivateinherited |
Definition at line 694 of file PeerImp.cpp.
|
privateinherited |
Definition at line 702 of file PeerImp.cpp.
|
privateinherited |
Definition at line 762 of file PeerImp.cpp.
|
privateinherited |
Definition at line 788 of file PeerImp.cpp.
|
privateinherited |
Definition at line 862 of file PeerImp.cpp.
|
privateinherited |
Definition at line 869 of file PeerImp.cpp.
|
privateinherited |
Definition at line 879 of file PeerImp.cpp.
|
privateinherited |
Definition at line 917 of file PeerImp.cpp.
|
privateinherited |
Definition at line 989 of file PeerImp.cpp.
|
privateinherited |
Called from onMessage(TMTransaction(s)).
| m | Transaction protocol message |
| eraseTxQueue | is true when called from onMessage(TMTransaction) and is false when called from onMessage(TMTransactions). If true then the transaction hash is erased from txQueue_. Don't need to erase from the queue when called from onMessage(TMTransactions) because this message is a response to the missing transactions request and the queue would not have any of these transactions. |
| batch | is false when called from onMessage(TMTransaction) and is true when called from onMessage(TMTransactions). If true, then the transaction is part of a batch, and should not be charged an extra fee. |
Definition at line 1293 of file PeerImp.cpp.
|
privateinherited |
Handle protocol message with hashes of transactions that have not been relayed by an upstream node down to its peers - request transactions, which have not been relayed to this peer.
| m | protocol message with transactions' hashes |
Definition at line 2811 of file PeerImp.cpp.
|
overrideprivatevirtualinherited |
Implements xrpl::Peer.
|
privateinherited |
|
inherited |
Definition at line 1041 of file PeerImp.cpp.
|
inherited |
Definition at line 1047 of file PeerImp.cpp.
|
inherited |
Definition at line 1088 of file PeerImp.cpp.
|
inherited |
Definition at line 1095 of file PeerImp.cpp.
|
inherited |
Definition at line 1117 of file PeerImp.cpp.
|
inherited |
Definition at line 1161 of file PeerImp.cpp.
|
inherited |
Definition at line 1230 of file PeerImp.cpp.
|
inherited |
Definition at line 1287 of file PeerImp.cpp.
|
inherited |
Definition at line 1427 of file PeerImp.cpp.
|
inherited |
Definition at line 1697 of file PeerImp.cpp.
|
inherited |
Definition at line 1899 of file PeerImp.cpp.
|
inherited |
Definition at line 2004 of file PeerImp.cpp.
|
inherited |
Definition at line 2217 of file PeerImp.cpp.
|
inherited |
Definition at line 2438 of file PeerImp.cpp.
|
inherited |
Definition at line 2463 of file PeerImp.cpp.
|
inherited |
Definition at line 2579 of file PeerImp.cpp.
|
inherited |
Definition at line 2794 of file PeerImp.cpp.
|
inherited |
Definition at line 2857 of file PeerImp.cpp.
|
inherited |
Definition at line 2888 of file PeerImp.cpp.
|
inherited |
Definition at line 1583 of file PeerImp.cpp.
|
inherited |
Definition at line 1618 of file PeerImp.cpp.
|
inherited |
Definition at line 1640 of file PeerImp.cpp.
|
inherited |
Definition at line 1675 of file PeerImp.cpp.
|
privateinherited |
Definition at line 2931 of file PeerImp.cpp.
|
privateinherited |
Definition at line 2944 of file PeerImp.cpp.
|
privateinherited |
Definition at line 2242 of file PeerImp.cpp.
|
privateinherited |
Process peer's request to send missing transactions.
The request is sent in response to TMHaveTransactions.
| packet | protocol message containing missing transactions' hashes. |
Definition at line 2977 of file PeerImp.cpp.
|
privateinherited |
Definition at line 3029 of file PeerImp.cpp.
|
privateinherited |
Definition at line 3174 of file PeerImp.cpp.
|
privateinherited |
Definition at line 3222 of file PeerImp.cpp.
|
privateinherited |
Definition at line 3313 of file PeerImp.cpp.
|
privateinherited |
Definition at line 3350 of file PeerImp.cpp.
|
privateinherited |
Definition at line 3434 of file PeerImp.cpp.
|
protectedinherited |
Definition at line 3466 of file PeerImp.cpp.
|
protectedinherited |
Process a generic-query TMGetObjectByHash message.
Dispatched from onMessage(TMGetObjectByHash) to the JobQueue (JtLedgerReq) so synchronous NodeStore lookups do not block the peer's I/O strand. Caps iteration at tuning::kHardMaxReplyNodes regardless of hit/miss outcome and applies differential pricing via computeGetObjectByHashFee() after the fetch loop completes.
| m | The protocol message containing requested object hashes. |
Definition at line 2731 of file PeerImp.cpp.
|
staticprotectedinherited |
Compute the per-message resource charge for a TMGetObjectByHash request based on how much work was actually performed.
The charge has three components on top of the base resource::kFeeModerateBurdenPeer:
The first tuning::kFreeObjectsPerRequest objects are free so that legitimate InboundLedger::getNeededHashes() traffic (at most 8 objects) is unaffected.
| requested | Number of objects requested by the message. This value is used for request-size pricing and may exceed tuning::kHardMaxReplyNodes when this helper is called directly, even though processing caps the iterations to tuning::kHardMaxReplyNodes. |
| found | Number of objects successfully returned in the reply. |
Definition at line 3673 of file PeerImp.cpp.
|
protectedinherited |
Read-only accessor for the accumulated peer-message charge.
Exposed at protected scope so test subclasses can verify the oversized-request rejection path (Layer 1) without invoking the full JobQueue handler. Production callers should never read this back — the value is consumed by charge()/disconnect() internally.
|
privateinherited |
Definition at line 141 of file CapturePeer.h.
|
privateinherited |
|
privateinherited |
|
privateinherited |
|
privateinherited |
|
privateinherited |
|
privateinherited |
|
privateinherited |
|
privateinherited |
|
privateinherited |
|
privateinherited |
|
privateinherited |
|
privateinherited |
|
privateinherited |
|
privateinherited |
|
privateinherited |
|
privateinherited |
|
privateinherited |
|
privateinherited |
|
privateinherited |
|
mutableprivateinherited |
|
privateinherited |
|
privateinherited |
|
privateinherited |
|
privateinherited |
|
privateinherited |
|
privateinherited |
|
privateinherited |
|
privateinherited |
|
privateinherited |
|
privateinherited |
|
mutableprivateinherited |
|
privateinherited |
|
privateinherited |
|
privateinherited |
|
privateinherited |
|
privateinherited |
|
privateinherited |
|
privateinherited |
|
privateinherited |
|
privateinherited |
|
privateinherited |
|
privateinherited |
|
privateinherited |
|
privateinherited |
|
privateinherited |
|
privateinherited |
|
privateinherited |
|
privateinherited |
| struct { ... } xrpl::PeerImp::metrics_ |