1#include <test/jtx/Env.h>
2#include <test/overlay/CapturePeer.h>
4#include <xrpld/overlay/Compression.h>
5#include <xrpld/overlay/detail/Tuning.h>
7#include <xrpl/basics/base_uint.h>
8#include <xrpl/beast/unit_test/suite.h>
9#include <xrpl/resource/Fees.h>
10#include <xrpl/shamap/SHAMapNodeID.h>
49 request->set_itype(protocol::liTX_NODE);
59 request->add_nodeids(rootNodeId);
86 testcase(
"Process Ledger Request Node Count");
95 request->clear_ledgerhash();
96 request->set_itype(protocol::liAS_NODE);
97 request->set_ltype(protocol::ltCLOSED);
101 auto sentMessage = peer->lastSent();
102 BEAST_EXPECT(sentMessage !=
nullptr);
109 BEAST_EXPECT(buffer.size() > 6);
112 protocol::TMLedgerData reply;
113 BEAST_EXPECT(reply.ParseFromArray(buffer.data() + 6, buffer.size() - 6) ==
true);
115 BEAST_EXPECT(reply.type() == protocol::liAS_NODE);
116 BEAST_EXPECT(reply.nodes_size() > 0);
TestcaseT testcase
Memberspace for declaring test cases.
void processLedgerRequest(std::shared_ptr< protocol::TMGetLedger > const &m, std::vector< SHAMapNodeID > nodeIDs)
Identifies a node inside a SHAMap.
std::string getRawString() const
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 thi...
Calls the JtLedgerReq-dispatched processor synchronously, so the reply is visible through lastSent().
void runProcessLedgerRequest(std::shared_ptr< protocol::TMGetLedger > const &m, std::vector< SHAMapNodeID > nodeIDs)
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 thi...
static std::shared_ptr< protocol::TMGetLedger > createRequest(std::size_t const numNodeIds)
void testNodeIdCountAccepted(std::size_t const numNodeIds, bool const expectRejected)
void testProcessLedgerRequestNodeCount(std::size_t const numNodeIds)
void run() override
Runs the suite.
A transaction testing environment.
bool close(NetClock::time_point closeTime, std::optional< std::chrono::milliseconds > consensusDelay=std::nullopt)
Close and advance the ledger.
Charge const kFeeInvalidData
BEAST_DEFINE_TESTSUITE(AMMClawback, app, xrpl)
std::shared_ptr< PeerType > makeCapturePeer(jtx::Env &env, std::optional< PublicKey > key=std::nullopt, HttpRequestType request={})
Build an active CapturePeer and register it with the overlay.
static UInt256 ledgerHash(LedgerHeader const &info)
static constexpr auto kHardMaxReplyNodes
The hard cap on the number of ledger entries in a single reply.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.