xrpld
Loading...
Searching...
No Matches
xrpl::test::TestPeer Class Reference

Simulate a network peer. More...

Inheritance diagram for xrpl::test::TestPeer:
Collaboration diagram for xrpl::test::TestPeer:

Public Types

using ptr = std::shared_ptr<Peer>
using id_t = std::uint32_t
 Uniquely identifies a peer.

Public Member Functions

 TestPeer (bool enableLedgerReplay)
void send (std::shared_ptr< Message > const &m) override
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.
id_t id () const override
bool cluster () const override
 Returns true if this connection is a member of the cluster.
bool isHighLatency () const override
int getScore (bool) const override
PublicKey const & getNodePublic () const override
json::Value json () override
bool supportsFeature (ProtocolFeature f) const override
std::optional< std::size_tpublisherListSequence (PublicKey const &) const override
void setPublisherListSequence (PublicKey const &, std::size_t const) override
uint256 const & 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
bool compressionEnabled () const override
void sendTxQueue () override
 Send aggregated transactions' hashes.
void addTxQueue (uint256 const &) override
 Aggregate transaction's hash.
void removeTxQueue (uint256 const &) override
 Remove hash from the transactions' hashes queue.
bool txReduceRelayEnabled () const override
std::string const & fingerprint () const override

Public Attributes

std::string fingerprint_
bool ledgerReplayEnabled_
PublicKey nodePublicKey_

Detailed Description

Simulate a network peer.

Depending on the configured PeerFeature, it either supports the ProtocolFeature::LedgerReplay or not

Definition at line 225 of file LedgerReplay_test.cpp.

Member Typedef Documentation

◆ ptr

using xrpl::Peer::ptr = std::shared_ptr<Peer>
inherited

Definition at line 26 of file xrpld/overlay/Peer.h.

◆ id_t

using xrpl::Peer::id_t = std::uint32_t
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 33 of file xrpld/overlay/Peer.h.

Constructor & Destructor Documentation

◆ TestPeer()

xrpl::test::TestPeer::TestPeer ( bool enableLedgerReplay)

Definition at line 228 of file LedgerReplay_test.cpp.

Member Function Documentation

◆ send()

void xrpl::test::TestPeer::send ( std::shared_ptr< Message > const & m)
overridevirtual

Implements xrpl::Peer.

Definition at line 235 of file LedgerReplay_test.cpp.

◆ getRemoteAddress()

beast::IP::Endpoint xrpl::test::TestPeer::getRemoteAddress ( ) const
nodiscardoverridevirtual

Implements xrpl::Peer.

Definition at line 239 of file LedgerReplay_test.cpp.

◆ charge()

void xrpl::test::TestPeer::charge ( Resource::Charge const & fee,
std::string const & context = {} )
overridevirtual

Adjust this peer's load balance based on the type of load imposed.

Implements xrpl::Peer.

Definition at line 244 of file LedgerReplay_test.cpp.

◆ id()

id_t xrpl::test::TestPeer::id ( ) const
nodiscardoverridevirtual

Implements xrpl::Peer.

Definition at line 248 of file LedgerReplay_test.cpp.

◆ cluster()

bool xrpl::test::TestPeer::cluster ( ) const
nodiscardoverridevirtual

Returns true if this connection is a member of the cluster.

Implements xrpl::Peer.

Definition at line 253 of file LedgerReplay_test.cpp.

◆ isHighLatency()

bool xrpl::test::TestPeer::isHighLatency ( ) const
nodiscardoverridevirtual

Implements xrpl::Peer.

Definition at line 258 of file LedgerReplay_test.cpp.

◆ getScore()

int xrpl::test::TestPeer::getScore ( bool ) const
nodiscardoverridevirtual

Implements xrpl::Peer.

Definition at line 263 of file LedgerReplay_test.cpp.

◆ getNodePublic()

PublicKey const & xrpl::test::TestPeer::getNodePublic ( ) const
nodiscardoverridevirtual

Implements xrpl::Peer.

Definition at line 268 of file LedgerReplay_test.cpp.

◆ json()

json::Value xrpl::test::TestPeer::json ( )
overridevirtual

Implements xrpl::Peer.

Definition at line 273 of file LedgerReplay_test.cpp.

◆ supportsFeature()

bool xrpl::test::TestPeer::supportsFeature ( ProtocolFeature f) const
nodiscardoverridevirtual

Implements xrpl::Peer.

Definition at line 278 of file LedgerReplay_test.cpp.

◆ publisherListSequence()

std::optional< std::size_t > xrpl::test::TestPeer::publisherListSequence ( PublicKey const & ) const
nodiscardoverridevirtual

Implements xrpl::Peer.

Definition at line 283 of file LedgerReplay_test.cpp.

◆ setPublisherListSequence()

void xrpl::test::TestPeer::setPublisherListSequence ( PublicKey const & ,
std::size_t const  )
overridevirtual

Implements xrpl::Peer.

Definition at line 288 of file LedgerReplay_test.cpp.

◆ getClosedLedgerHash()

uint256 const & xrpl::test::TestPeer::getClosedLedgerHash ( ) const
nodiscardoverridevirtual

Implements xrpl::Peer.

Definition at line 292 of file LedgerReplay_test.cpp.

◆ hasLedger()

bool xrpl::test::TestPeer::hasLedger ( uint256 const & hash,
std::uint32_t seq ) const
nodiscardoverridevirtual

Implements xrpl::Peer.

Definition at line 298 of file LedgerReplay_test.cpp.

◆ ledgerRange()

void xrpl::test::TestPeer::ledgerRange ( std::uint32_t & minSeq,
std::uint32_t & maxSeq ) const
overridevirtual

Implements xrpl::Peer.

Definition at line 303 of file LedgerReplay_test.cpp.

◆ hasTxSet()

bool xrpl::test::TestPeer::hasTxSet ( uint256 const & hash) const
nodiscardoverridevirtual

Implements xrpl::Peer.

Definition at line 307 of file LedgerReplay_test.cpp.

◆ cycleStatus()

void xrpl::test::TestPeer::cycleStatus ( )
overridevirtual

Implements xrpl::Peer.

Definition at line 312 of file LedgerReplay_test.cpp.

◆ hasRange()

bool xrpl::test::TestPeer::hasRange ( std::uint32_t uMin,
std::uint32_t uMax )
overridevirtual

Implements xrpl::Peer.

Definition at line 316 of file LedgerReplay_test.cpp.

◆ compressionEnabled()

bool xrpl::test::TestPeer::compressionEnabled ( ) const
nodiscardoverridevirtual

Implements xrpl::Peer.

Definition at line 321 of file LedgerReplay_test.cpp.

◆ sendTxQueue()

void xrpl::test::TestPeer::sendTxQueue ( )
overridevirtual

Send aggregated transactions' hashes.

Implements xrpl::Peer.

Definition at line 326 of file LedgerReplay_test.cpp.

◆ addTxQueue()

void xrpl::test::TestPeer::addTxQueue ( uint256 const & )
overridevirtual

Aggregate transaction's hash.

Implements xrpl::Peer.

Definition at line 330 of file LedgerReplay_test.cpp.

◆ removeTxQueue()

void xrpl::test::TestPeer::removeTxQueue ( uint256 const & )
overridevirtual

Remove hash from the transactions' hashes queue.

Implements xrpl::Peer.

Definition at line 334 of file LedgerReplay_test.cpp.

◆ txReduceRelayEnabled()

bool xrpl::test::TestPeer::txReduceRelayEnabled ( ) const
nodiscardoverridevirtual

Implements xrpl::Peer.

Definition at line 338 of file LedgerReplay_test.cpp.

◆ fingerprint()

std::string const & xrpl::test::TestPeer::fingerprint ( ) const
nodiscardoverridevirtual

Implements xrpl::Peer.

Definition at line 344 of file LedgerReplay_test.cpp.

Member Data Documentation

◆ fingerprint_

std::string xrpl::test::TestPeer::fingerprint_

Definition at line 350 of file LedgerReplay_test.cpp.

◆ ledgerReplayEnabled_

bool xrpl::test::TestPeer::ledgerReplayEnabled_

Definition at line 351 of file LedgerReplay_test.cpp.

◆ nodePublicKey_

PublicKey xrpl::test::TestPeer::nodePublicKey_

Definition at line 352 of file LedgerReplay_test.cpp.