21#include <test/jtx/envconfig.h>
23#include <xrpld/app/ledger/BuildLedger.h>
24#include <xrpld/app/ledger/LedgerMaster.h>
25#include <xrpld/app/ledger/LedgerReplay.h>
26#include <xrpld/app/ledger/LedgerReplayTask.h>
27#include <xrpld/app/ledger/LedgerReplayer.h>
28#include <xrpld/app/ledger/detail/LedgerDeltaAcquire.h>
29#include <xrpld/app/ledger/detail/LedgerReplayMsgHandler.h>
30#include <xrpld/app/ledger/detail/SkipListAcquire.h>
31#include <xrpld/overlay/PeerSet.h>
32#include <xrpld/overlay/detail/PeerImp.h>
34#include <xrpl/basics/Slice.h>
52 auto const alice =
Account(
"alice");
53 auto const bob =
Account(
"bob");
56 env.
fund(
XRP(100000), alice, bob);
61 auto const lastClosedParent =
62 ledgerMaster.getLedgerByHash(lastClosed->info().parentHash);
70 BEAST_EXPECT(replayed->info().hash == lastClosed->info().hash);
360 bool enableLedgerReplay)
380 ::google::protobuf::Message
const& msg,
381 protocol::MessageType type,
390 if ((rand() % 100 + 1) <= dropRate)
395 case protocol::mtPROOF_PATH_REQ: {
399 dynamic_cast<protocol::TMProofPathRequest const&
>(msg));
407 case protocol::mtREPLAY_DELTA_REQ: {
411 dynamic_cast<protocol::TMReplayDeltaRequest const&
>(msg));
503 auto fundedAccounts =
accounts.size();
504 for (
int i = 0; i < newAccounts; ++i)
519 int fundedAccounts =
accounts.size();
520 assert(fundedAccounts >= newTxes);
527 auto updateIdx = [&]() {
528 assert(fundedAccounts > senders.
size());
529 fromIdx = (fromIdx + r) % fundedAccounts;
530 while (senders.
count(fromIdx) != 0)
531 fromIdx = (fromIdx + 1) % fundedAccounts;
533 toIdx = (toIdx + r * 2) % fundedAccounts;
534 if (toIdx == fromIdx)
535 toIdx = (toIdx + 1) % fundedAccounts;
538 for (
int i = 0; i < newTxes; ++i)
600 server.
app.getLedgerMaster(),
625 uint256 hash = finishLedgerHash;
627 for (; i < totalReplay; ++i)
632 hash = l->info().parentHash;
640 int totalRound = 100;
641 for (
int i = 0; i < totalRound; ++i)
645 if (i < totalRound - 1)
654 int totalRound = 100;
655 for (
int i = 0; i < totalRound; ++i)
671 if (i < totalRound - 1)
690 return t->parameter_.finishHash_ == hash &&
691 t->parameter_.totalLedgers_ == totalReplay;
731 return i->second.lock();
741 return i->second.lock();
744 template <
typename T>
764 if (
taskStatus(task->skipListAcquirer_) == skiplistExpect)
766 if (task->deltas_.size() == deltaExpects.
size())
768 for (
int i = 0; i < deltaExpects.
size(); ++i)
770 if (
taskStatus(task->deltas_[i]) != deltaExpects[i])
788 auto t =
findTask(hash, totalReplay);
796 return asExpected(t, taskExpect, skiplistExpect, deltaExpects);
807 auto t =
findTask(hash, totalReplay);
815 return asExpected(t, taskExpect, skiplistExpect, deltaExpects);
830 hash, totalReplay, taskExpect, skiplistExpect, deltaExpects);
866 ,
client(suite,
server, behavior, inboundBhvr, peerFeature)
911 request->set_ledgerhash(
912 l->info().hash.data(), l->info().hash.size());
913 request->set_type(protocol::TMLedgerMapType::lmACCOUNT_STATE);
915 server.msgHandler.processProofPathRequest(request));
916 BEAST_EXPECT(reply->has_error());
917 BEAST_EXPECT(!server.msgHandler.processProofPathResponse(reply));
922 request->set_type(protocol::TMLedgerMapType::lmACCOUNT_STATE);
926 request->set_ledgerhash(hash.
data(), hash.
size());
928 server.msgHandler.processProofPathRequest(request));
929 BEAST_EXPECT(reply->has_error());
935 request->set_ledgerhash(
936 l->info().hash.data(), l->info().hash.size());
937 request->set_type(protocol::TMLedgerMapType::lmACCOUNT_STATE);
942 server.msgHandler.processProofPathRequest(request));
943 BEAST_EXPECT(!reply->has_error());
944 BEAST_EXPECT(server.msgHandler.processProofPathResponse(reply));
951 reply->set_ledgerheader(r);
953 !server.msgHandler.processProofPathResponse(reply));
955 reply->set_ledgerheader(r);
956 BEAST_EXPECT(server.msgHandler.processProofPathResponse(reply));
958 reply->mutable_path()->RemoveLast();
960 !server.msgHandler.processProofPathResponse(reply));
976 server.msgHandler.processReplayDeltaRequest(request));
977 BEAST_EXPECT(reply->has_error());
978 BEAST_EXPECT(!server.msgHandler.processReplayDeltaResponse(reply));
981 request->set_ledgerhash(hash.
data(), hash.
size());
983 server.msgHandler.processReplayDeltaRequest(request));
984 BEAST_EXPECT(reply->has_error());
985 BEAST_EXPECT(!server.msgHandler.processReplayDeltaResponse(reply));
991 request->set_ledgerhash(
992 l->info().hash.data(), l->info().hash.size());
994 server.msgHandler.processReplayDeltaRequest(request));
995 BEAST_EXPECT(!reply->has_error());
996 BEAST_EXPECT(server.msgHandler.processReplayDeltaResponse(reply));
1003 reply->set_ledgerheader(r);
1005 !server.msgHandler.processReplayDeltaResponse(reply));
1007 reply->set_ledgerheader(r);
1009 server.msgHandler.processReplayDeltaResponse(reply));
1011 reply->mutable_transaction()->RemoveLast();
1013 !server.msgHandler.processReplayDeltaResponse(reply));
1025 for (
int i = 0; i < count; ++i)
1032 BEAST_EXPECT(!tp10.
update(
uint256(777), 5, makeSkipList(10)));
1033 BEAST_EXPECT(!tp10.
update(
uint256(10), 5, makeSkipList(8)));
1034 BEAST_EXPECT(tp10.
update(
uint256(10), 10, makeSkipList(10)));
1064 BEAST_EXPECT(tp20.
update(
uint256(20), 20, makeSkipList(20)));
1105 auto handshake = [&](
bool client,
bool server,
bool expecting) ->
bool {
1109 http_request.version(request.version());
1110 http_request.base() = request.base();
1113 if (serverResult != expecting)
1117 boost::asio::ip::make_address(
"172.1.1.100");
1129 auto const clientResult =
1131 if (clientResult != expecting)
1137 BEAST_EXPECT(handshake(
false,
false,
false));
1138 BEAST_EXPECT(handshake(
false,
true,
false));
1139 BEAST_EXPECT(handshake(
true,
false,
false));
1140 BEAST_EXPECT(handshake(
true,
true,
true));
1146 testcase(
"local node has all the ledgers");
1151 NetworkOfTwo net(*
this, {totalReplay + 1}, psBhvr, ilBhvr, peerFeature);
1154 uint256 finalHash = l->info().hash;
1155 for (
int i = 0; i < totalReplay; ++i)
1160 net.client.ledgerMaster.storeLedger(l);
1161 l = net.server.ledgerMaster.getLedgerByHash(
1162 l->info().parentHash);
1168 net.client.replayer.replay(
1173 BEAST_EXPECT(net.client.waitAndCheckStatus(
1181 net.client.replayer.sweep();
1182 BEAST_EXPECT(net.client.countsAsExpected(0, 0, 0));
1188 testcase(
"all the ledgers from InboundLedgers");
1197 uint256 finalHash = l->info().hash;
1198 net.client.replayer.replay(
1203 BEAST_EXPECT(net.client.waitAndCheckStatus(
1211 net.client.replayer.sweep();
1212 BEAST_EXPECT(net.client.countsAsExpected(0, 0, 0));
1218 switch (peerSetBehavior)
1224 testcase(
"network drops 50% messages");
1227 testcase(
"network repeats all messages");
1242 uint256 finalHash = l->info().hash;
1243 for (
int i = 0; i < totalReplay - 1; ++i)
1245 l = net.server.ledgerMaster.getLedgerByHash(l->info().parentHash);
1247 net.client.ledgerMaster.storeLedger(l);
1249 net.client.replayer.replay(
1254 BEAST_EXPECT(net.client.waitAndCheckStatus(
1260 BEAST_EXPECT(net.client.waitForLedgers(finalHash, totalReplay));
1263 net.client.replayer.sweep();
1264 BEAST_EXPECT(net.client.countsAsExpected(0, 0, 0));
1271 int totalReplay = 3;
1280 uint256 finalHash = l->info().hash;
1281 net.client.replayer.replay(
1285 BEAST_EXPECT(net.client.checkStatus(
1292 BEAST_EXPECT(net.client.countsAsExpected(1, 1, 0));
1293 net.client.replayer.stop();
1294 BEAST_EXPECT(net.client.countsAsExpected(0, 0, 0));
1300 testcase(
"SkipListAcquire bad reply");
1301 int totalReplay = 3;
1304 {totalReplay + 1 + 1},
1310 uint256 finalHash = l->info().hash;
1311 net.client.replayer.replay(
1314 auto skipList = net.client.findSkipListAcquire(finalHash);
1317 0x6A, 0x09, 0xE6, 0x67, 0xF3, 0xBC, 0xC9, 0x08, 0xB2};
1320 skipList->processData(l->seq(), item);
1323 BEAST_EXPECT(net.client.waitAndCheckStatus(
1331 net.client.replayer.replay(
1333 BEAST_EXPECT(net.client.waitAndCheckStatus(
1339 BEAST_EXPECT(net.client.countsAsExpected(2, 1, 0));
1345 testcase(
"LedgerDeltaAcquire bad reply");
1346 int totalReplay = 3;
1355 uint256 finalHash = l->info().hash;
1356 net.client.ledgerMaster.storeLedger(l);
1357 net.client.replayer.replay(
1360 auto delta = net.client.findLedgerDeltaAcquire(l->info().parentHash);
1366 net.client.taskStatus(net.client.findTask(
1370 net.client.replayer.replay(
1373 net.client.taskStatus(net.client.findTask(
1381 int totalReplay = 5;
1384 {totalReplay * 3 + 1},
1389 uint256 finalHash = l->info().hash;
1390 net.client.replayer.replay(
1394 BEAST_EXPECT(net.client.waitAndCheckStatus(
1400 BEAST_EXPECT(net.client.waitForLedgers(finalHash, totalReplay));
1403 net.client.replayer.replay(
1405 BEAST_EXPECT(net.client.countsAsExpected(1, 1, totalReplay - 1));
1407 net.client.replayer.replay(
1409 BEAST_EXPECT(net.client.countsAsExpected(2, 1, totalReplay - 1));
1412 for (
int i = 0; i < totalReplay + 2; ++i)
1414 l = net.server.ledgerMaster.getLedgerByHash(l->info().parentHash);
1416 auto finalHash_early = l->info().hash;
1417 net.client.replayer.replay(
1419 BEAST_EXPECT(net.client.waitAndCheckStatus(
1425 BEAST_EXPECT(net.client.waitForLedgers(finalHash_early, totalReplay));
1426 BEAST_EXPECT(net.client.countsAsExpected(3, 2, 2 * (totalReplay - 1)));
1429 l = net.server.ledgerMaster.getLedgerByHash(l->info().parentHash);
1430 auto finalHash_moreEarly = l->info().parentHash;
1431 net.client.replayer.replay(
1433 BEAST_EXPECT(net.client.waitAndCheckStatus(
1434 finalHash_moreEarly,
1440 net.client.waitForLedgers(finalHash_moreEarly, totalReplay));
1442 net.client.countsAsExpected(4, 3, 2 * (totalReplay - 1) + 2));
1445 net.client.replayer.replay(
1449 BEAST_EXPECT(net.client.waitAndCheckStatus(
1455 BEAST_EXPECT(net.client.waitForLedgers(finalHash, totalReplay * 3));
1456 BEAST_EXPECT(net.client.countsAsExpected(5, 3, totalReplay * 3 - 1));
1459 net.client.replayer.sweep();
1460 BEAST_EXPECT(net.client.countsAsExpected(0, 0, 0));
1491 testcase(
"SkipListAcquire timeout");
1492 int totalReplay = 3;
1501 uint256 finalHash = l->info().hash;
1502 net.client.replayer.replay(
1506 BEAST_EXPECT(net.client.waitAndCheckStatus(
1514 BEAST_EXPECT(net.client.countsAsExpected(1, 1, 0));
1515 net.client.replayer.sweep();
1516 BEAST_EXPECT(net.client.countsAsExpected(0, 0, 0));
1522 testcase(
"LedgerDeltaAcquire timeout");
1523 int totalReplay = 3;
1532 uint256 finalHash = l->info().hash;
1533 net.client.ledgerMaster.storeLedger(l);
1534 net.client.replayer.replay(
1540 BEAST_EXPECT(net.client.waitAndCheckStatus(
1548 BEAST_EXPECT(net.client.countsAsExpected(1, 1, totalReplay - 1));
1549 net.client.replayer.sweep();
1550 BEAST_EXPECT(net.client.countsAsExpected(0, 0, 0));
1567 int totalReplay = 250;
1571 {totalReplay * rounds + 1},
1577 auto l = net.server.ledgerMaster.getClosedLedger();
1578 for (
int i = 0; i < rounds; ++i)
1581 for (
int j = 0; j < totalReplay; ++j)
1583 l = net.server.ledgerMaster.getLedgerByHash(
1584 l->info().parentHash);
1587 BEAST_EXPECT(finishHashes.size() == rounds);
1589 for (
int i = 0; i < rounds; ++i)
1591 net.client.replayer.replay(
1597 for (
int i = 0; i < rounds; ++i)
1599 BEAST_EXPECT(net.client.waitAndCheckStatus(
1608 net.client.waitForLedgers(finishHashes[0], totalReplay * rounds));
1609 BEAST_EXPECT(net.client.countsAsExpected(
1610 rounds, rounds, rounds * (totalReplay - 1)));
1613 net.client.replayer.sweep();
1614 BEAST_EXPECT(net.client.countsAsExpected(0, 0, 0));
1620BEAST_DEFINE_TESTSUITE(LedgerReplayerTimeout, app,
ripple);
1621BEAST_DEFINE_TESTSUITE_MANUAL(LedgerReplayerLong, app,
ripple);
A version-independent IP address and port combination.
testcase_t testcase
Memberspace for declaring test cases.
virtual Config & config()=0
virtual LedgerMaster & getLedgerMaster()=0
void loadFromString(std::string const &fileContents)
Load the config from the contents of the string.
Manages the lifetime of inbound ledgers.
std::shared_ptr< Ledger const > getClosedLedger()
bool storeLedger(std::shared_ptr< Ledger const > ledger)
std::shared_ptr< Ledger const > getLedgerByHash(uint256 const &hash)
protocol::TMReplayDeltaResponse processReplayDeltaRequest(std::shared_ptr< protocol::TMReplayDeltaRequest > const &msg)
Process TMReplayDeltaRequest and return TMReplayDeltaResponse.
bool processProofPathResponse(std::shared_ptr< protocol::TMProofPathResponse > const &msg)
Process TMProofPathResponse.
bool processReplayDeltaResponse(std::shared_ptr< protocol::TMReplayDeltaResponse > const &msg)
Process TMReplayDeltaResponse.
protocol::TMProofPathResponse processProofPathRequest(std::shared_ptr< protocol::TMProofPathRequest > const &msg)
Process TMProofPathRequest and return TMProofPathResponse.
bool update(uint256 const &hash, std::uint32_t seq, std::vector< uint256 > const &sList)
fill all the fields that was not filled during construction
bool canMergeInto(TaskParameter const &existingTask) const
check if this task can be merged into an existing task
InboundLedger::Reason reason_
std::uint32_t totalLedgers_
Manages the lifetime of ledger replay tasks.
std::vector< std::shared_ptr< LedgerReplayTask > > tasks_
hash_map< uint256, std::weak_ptr< SkipListAcquire > > skipLists_
hash_map< uint256, std::weak_ptr< LedgerDeltaAcquire > > deltas_
beast::severities::Severity threshold() const
Supports data retrieval by managing a set of peers.
Represents a peer connection in the overlay.
std::uint32_t id_t
Uniquely identifies a peer.
An immutable linear range of bytes.
static constexpr std::size_t size()
Ledger replay client side.
bool waitForLedgers(uint256 const &finishLedgerHash, int totalReplay)
bool asExpected(uint256 const &hash, int totalReplay, TaskStatus taskExpect, TaskStatus skiplistExpect, std::vector< TaskStatus > const &deltaExpects)
bool waitAndCheckStatus(uint256 const &hash, int totalReplay, TaskStatus taskExpect, TaskStatus skiplistExpect, std::vector< TaskStatus > const &deltaExpects)
MagicInboundLedgers inboundLedgers
LedgerReplayMsgHandler clientMsgHandler
LedgerMaster & ledgerMaster
std::shared_ptr< LedgerReplayTask > findTask(uint256 const &hash, int totalReplay)
LedgerReplayMsgHandler serverMsgHandler
bool countsAsExpected(std::size_t tasks, std::size_t skipLists, std::size_t deltas)
std::size_t countDeltas()
bool asExpected(std::shared_ptr< LedgerReplayTask > const &task, TaskStatus taskExpect, TaskStatus skiplistExpect, std::vector< TaskStatus > const &deltaExpects)
std::vector< std::shared_ptr< LedgerReplayTask > > getTasks()
std::shared_ptr< LedgerDeltaAcquire > findLedgerDeltaAcquire(uint256 const &hash)
bool haveLedgers(uint256 const &finishLedgerHash, int totalReplay)
std::size_t countSkipLists()
LedgerReplayClient(beast::unit_test::suite &suite, LedgerServer &server, PeerSetBehavior behavior=PeerSetBehavior::Good, InboundLedgersBehavior inboundBhvr=InboundLedgersBehavior::Good, PeerFeature peerFeature=PeerFeature::LedgerReplayEnabled)
bool checkStatus(uint256 const &hash, int totalReplay, TaskStatus taskExpect, TaskStatus skiplistExpect, std::vector< TaskStatus > const &deltaExpects)
TaskStatus taskStatus(std::shared_ptr< T > const &t)
void addLedger(std::shared_ptr< Ledger const > const &l)
std::shared_ptr< SkipListAcquire > findSkipListAcquire(uint256 const &hash)
Simulate a network InboundLedgers.
virtual void acquireAsync(uint256 const &hash, std::uint32_t seq, InboundLedger::Reason reason) override
virtual void onLedgerFetched() override
Called when a complete ledger is obtained.
LedgerMaster & ledgerSink
virtual void clearFailures() override
virtual bool gotLedgerData(LedgerHash const &ledgerHash, std::shared_ptr< Peer >, std::shared_ptr< protocol::TMLedgerData >) override
virtual void sweep() override
virtual std::shared_ptr< InboundLedger > find(LedgerHash const &hash) override
virtual ~MagicInboundLedgers()=default
virtual Json::Value getInfo() override
virtual void stop() override
virtual size_t cacheSize() override
virtual void logFailure(uint256 const &h, std::uint32_t seq) override
MagicInboundLedgers(LedgerMaster &ledgerSource, LedgerMaster &ledgerSink, InboundLedgersBehavior bhvr)
virtual bool isFailure(uint256 const &h) override
virtual void gotStaleData(std::shared_ptr< protocol::TMLedgerData > packet) override
LedgerMaster & ledgerSource
virtual std::size_t fetchRate() override
Returns the rate of historical ledger fetches per minute.
virtual void gotFetchPack() override
virtual std::shared_ptr< Ledger const > acquire(uint256 const &hash, std::uint32_t seq, InboundLedger::Reason) override
InboundLedgersBehavior bhvr
LedgerReplayMsgHandler & local
std::unique_ptr< PeerSet > build() override
LedgerReplayMsgHandler & remote
TestPeerSetBuilder(LedgerReplayMsgHandler &me, LedgerReplayMsgHandler &other, PeerSetBehavior bhvr, PeerFeature peerFeature)
bool hasLedger(uint256 const &hash, std::uint32_t seq) const override
void setPublisherListSequence(PublicKey const &, std::size_t const) override
bool cluster() const override
Returns true if this connection is a member of the cluster.
std::optional< std::size_t > publisherListSequence(PublicKey const &) const override
void removeTxQueue(uint256 const &) override
Remove hash from the transactions' hashes queue.
beast::IP::Endpoint getRemoteAddress() const override
TestPeer(bool enableLedgerReplay)
int getScore(bool) const override
PublicKey const & getNodePublic() 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.
Json::Value json() override
void send(std::shared_ptr< Message > const &m) override
void ledgerRange(std::uint32_t &minSeq, std::uint32_t &maxSeq) const override
bool ledgerReplayEnabled_
void addTxQueue(uint256 const &) override
Aggregate transaction's hash.
void cycleStatus() override
bool txReduceRelayEnabled() const override
bool isHighLatency() const override
bool hasTxSet(uint256 const &hash) const override
std::string const & fingerprint() const override
uint256 const & getClosedLedgerHash() const override
bool compressionEnabled() const override
bool hasRange(std::uint32_t uMin, std::uint32_t uMax) override
bool supportsFeature(ProtocolFeature f) const override
void sendTxQueue() override
Send aggregated transactions' hashes.
Immutable cryptographic account descriptor.
A transaction testing environment.
bool close(NetClock::time_point closeTime, std::optional< std::chrono::milliseconds > consensusDelay=std::nullopt)
Close and advance the ledger.
beast::Journal const journal
Env & apply(JsonValue &&jv, FN const &... fN)
Apply funclets and submit.
void fund(bool setDefaultRipple, STAmount const &amount, Account const &account)
Set the regular signature on a JTx.
T emplace_back(T... args)
boost::asio::ip::address Address
A namespace for easy access to logging severity values.
Severity
Severity level / threshold of a Journal message.
Keylet const & skip() noexcept
The index of the "short" skip list.
static autofill_t const autofill
PrettyAmount drops(Integer i)
Returns an XRP PrettyAmount, which is trivially convertible to STAmount.
Json::Value pay(AccountID const &account, AccountID const &to, AnyAmount amount)
Create a payment.
std::unique_ptr< Config > envconfig()
creates and initializes a default configuration for jtx::Env
XRP_t const XRP
Converts to XRP Issue or STAmount.
static uint256 ledgerHash(LedgerInfo const &info)
void logAll(LedgerServer &server, LedgerReplayClient &client, beast::severities::Severity level=Severity::kTrace)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
http_response_type makeResponse(bool crawlPublic, http_request_type const &req, beast::IP::Address public_ip, beast::IP::Address remote_ip, uint256 const &sharedValue, std::optional< std::uint32_t > networkID, ProtocolVersion protocol, Application &app)
Make http response.
static constexpr char FEATURE_LEDGER_REPLAY[]
PublicKey derivePublicKey(KeyType type, SecretKey const &sk)
Derive the public key from a secret key.
SecretKey randomSecretKey()
Create a secret key using secure random numbers.
std::shared_ptr< Ledger > buildLedger(std::shared_ptr< Ledger const > const &parent, NetClock::time_point closeTime, bool const closeTimeCorrect, NetClock::duration closeResolution, Application &app, CanonicalTXSet &txns, std::set< TxID > &failedTxs, beast::Journal j)
Build a new ledger by applying consensus transactions.
boost::beast::http::request< boost::beast::http::dynamic_body > http_request_type
boost::intrusive_ptr< SHAMapItem > make_shamapitem(uint256 const &tag, Slice data)
bool peerFeatureEnabled(headers const &request, std::string const &feature, std::string value, bool config)
Check if a feature should be enabled for a peer.
auto makeRequest(bool crawlPublic, bool comprEnabled, bool ledgerReplayEnabled, bool txReduceRelayEnabled, bool vpReduceRelayEnabled) -> request_type
Make outbound http request.
@ ledgerMaster
ledger master data for signing
void run() override
Runs the suite.
void run() override
Runs the suite.
void run() override
Runs the suite.
void testSkipListTimeout()
void testLedgerDeltaTimeout()
Test cases: LedgerReplayer_test: – process TMProofPathRequest and TMProofPathResponse – process TMRep...
void testLedgerReplayOverlap()
void testLedgerDeltaBadReply()
void run() override
Runs the suite.
void testAllInboundLedgers(int totalReplay)
void testSkipListBadReply()
void testPeerSetBehavior(PeerSetBehavior peerSetBehavior, int totalReplay=4)
void testAllLocal(int totalReplay)
Utility class for (1) creating ledgers with txns and (2) providing the ledgers via the ledgerMaster.
void sendPayments(int newTxes)
void createAccounts(int newAccounts)
LedgerReplayMsgHandler msgHandler
std::vector< jtx::Account > accounts
LedgerMaster & ledgerMaster
void createLedgerHistory()
create ledger history
LedgerServer(beast::unit_test::suite &suite, Parameter const &p)
NetworkOfTwo(beast::unit_test::suite &suite, LedgerServer::Parameter const ¶m, PeerSetBehavior behavior=PeerSetBehavior::Good, InboundLedgersBehavior inboundBhvr=InboundLedgersBehavior::Good, PeerFeature peerFeature=PeerFeature::LedgerReplayEnabled)
LedgerReplayClient client
Simulate a peerSet that supplies peers to ledger replay subtasks.
void addPeers(std::size_t limit, std::function< bool(std::shared_ptr< Peer > const &)> hasItem, std::function< void(std::shared_ptr< Peer > const &)> onPeerAdded) override
Try add more peers.
LedgerReplayMsgHandler & remote
TestPeerSet(LedgerReplayMsgHandler &me, LedgerReplayMsgHandler &other, PeerSetBehavior bhvr, bool enableLedgerReplay)
void sendRequest(::google::protobuf::Message const &msg, protocol::MessageType type, std::shared_ptr< Peer > const &peer) override
std::set< Peer::id_t > const & getPeerIds() const override
get the set of ids of previously added peers
LedgerReplayMsgHandler & local
std::shared_ptr< TestPeer > dummyPeer
Set the sequence number on a JTx.