2#include <test/jtx/envconfig.h>
4#include <xrpld/app/ledger/BuildLedger.h>
5#include <xrpld/app/ledger/LedgerMaster.h>
6#include <xrpld/app/ledger/LedgerReplay.h>
7#include <xrpld/app/ledger/LedgerReplayTask.h>
8#include <xrpld/app/ledger/LedgerReplayer.h>
9#include <xrpld/app/ledger/detail/LedgerDeltaAcquire.h>
10#include <xrpld/app/ledger/detail/LedgerReplayMsgHandler.h>
11#include <xrpld/app/ledger/detail/SkipListAcquire.h>
12#include <xrpld/overlay/PeerSet.h>
13#include <xrpld/overlay/detail/PeerImp.h>
15#include <xrpl/basics/Slice.h>
33 auto const alice =
Account(
"alice");
34 auto const bob =
Account(
"bob");
37 env.
fund(
XRP(100000), alice, bob);
42 auto const lastClosedParent =
43 ledgerMaster.getLedgerByHash(lastClosed->info().parentHash);
51 BEAST_EXPECT(replayed->info().hash == lastClosed->info().hash);
341 bool enableLedgerReplay)
361 ::google::protobuf::Message
const& msg,
362 protocol::MessageType type,
371 if ((rand() % 100 + 1) <= dropRate)
376 case protocol::mtPROOF_PATH_REQ: {
380 dynamic_cast<protocol::TMProofPathRequest const&
>(msg));
388 case protocol::mtREPLAY_DELTA_REQ: {
392 dynamic_cast<protocol::TMReplayDeltaRequest const&
>(msg));
484 auto fundedAccounts =
accounts.size();
485 for (
int i = 0; i < newAccounts; ++i)
500 int fundedAccounts =
accounts.size();
501 assert(fundedAccounts >= newTxes);
508 auto updateIdx = [&]() {
509 assert(fundedAccounts > senders.
size());
510 fromIdx = (fromIdx + r) % fundedAccounts;
511 while (senders.
count(fromIdx) != 0)
512 fromIdx = (fromIdx + 1) % fundedAccounts;
514 toIdx = (toIdx + r * 2) % fundedAccounts;
515 if (toIdx == fromIdx)
516 toIdx = (toIdx + 1) % fundedAccounts;
519 for (
int i = 0; i < newTxes; ++i)
581 server.
app.getLedgerMaster(),
606 uint256 hash = finishLedgerHash;
608 for (; i < totalReplay; ++i)
613 hash = l->info().parentHash;
621 int totalRound = 100;
622 for (
int i = 0; i < totalRound; ++i)
626 if (i < totalRound - 1)
635 int totalRound = 100;
636 for (
int i = 0; i < totalRound; ++i)
652 if (i < totalRound - 1)
671 return t->parameter_.finishHash_ == hash &&
672 t->parameter_.totalLedgers_ == totalReplay;
712 return i->second.lock();
722 return i->second.lock();
725 template <
typename T>
745 if (
taskStatus(task->skipListAcquirer_) == skiplistExpect)
747 if (task->deltas_.size() == deltaExpects.
size())
749 for (
int i = 0; i < deltaExpects.
size(); ++i)
751 if (
taskStatus(task->deltas_[i]) != deltaExpects[i])
769 auto t =
findTask(hash, totalReplay);
777 return asExpected(t, taskExpect, skiplistExpect, deltaExpects);
788 auto t =
findTask(hash, totalReplay);
796 return asExpected(t, taskExpect, skiplistExpect, deltaExpects);
811 hash, totalReplay, taskExpect, skiplistExpect, deltaExpects);
847 ,
client(suite,
server, behavior, inboundBhvr, peerFeature)
892 request->set_ledgerhash(
893 l->info().hash.data(), l->info().hash.size());
894 request->set_type(protocol::TMLedgerMapType::lmACCOUNT_STATE);
896 server.msgHandler.processProofPathRequest(request));
897 BEAST_EXPECT(reply->has_error());
898 BEAST_EXPECT(!server.msgHandler.processProofPathResponse(reply));
903 request->set_type(protocol::TMLedgerMapType::lmACCOUNT_STATE);
907 request->set_ledgerhash(hash.
data(), hash.
size());
909 server.msgHandler.processProofPathRequest(request));
910 BEAST_EXPECT(reply->has_error());
916 request->set_ledgerhash(
917 l->info().hash.data(), l->info().hash.size());
918 request->set_type(protocol::TMLedgerMapType::lmACCOUNT_STATE);
923 server.msgHandler.processProofPathRequest(request));
924 BEAST_EXPECT(!reply->has_error());
925 BEAST_EXPECT(server.msgHandler.processProofPathResponse(reply));
932 reply->set_ledgerheader(r);
934 !server.msgHandler.processProofPathResponse(reply));
936 reply->set_ledgerheader(r);
937 BEAST_EXPECT(server.msgHandler.processProofPathResponse(reply));
939 reply->mutable_path()->RemoveLast();
941 !server.msgHandler.processProofPathResponse(reply));
957 server.msgHandler.processReplayDeltaRequest(request));
958 BEAST_EXPECT(reply->has_error());
959 BEAST_EXPECT(!server.msgHandler.processReplayDeltaResponse(reply));
962 request->set_ledgerhash(hash.
data(), hash.
size());
964 server.msgHandler.processReplayDeltaRequest(request));
965 BEAST_EXPECT(reply->has_error());
966 BEAST_EXPECT(!server.msgHandler.processReplayDeltaResponse(reply));
972 request->set_ledgerhash(
973 l->info().hash.data(), l->info().hash.size());
975 server.msgHandler.processReplayDeltaRequest(request));
976 BEAST_EXPECT(!reply->has_error());
977 BEAST_EXPECT(server.msgHandler.processReplayDeltaResponse(reply));
984 reply->set_ledgerheader(r);
986 !server.msgHandler.processReplayDeltaResponse(reply));
988 reply->set_ledgerheader(r);
990 server.msgHandler.processReplayDeltaResponse(reply));
992 reply->mutable_transaction()->RemoveLast();
994 !server.msgHandler.processReplayDeltaResponse(reply));
1006 for (
int i = 0; i < count; ++i)
1013 BEAST_EXPECT(!tp10.
update(
uint256(777), 5, makeSkipList(10)));
1014 BEAST_EXPECT(!tp10.
update(
uint256(10), 5, makeSkipList(8)));
1015 BEAST_EXPECT(tp10.
update(
uint256(10), 10, makeSkipList(10)));
1045 BEAST_EXPECT(tp20.
update(
uint256(20), 20, makeSkipList(20)));
1086 auto handshake = [&](
bool client,
bool server,
bool expecting) ->
bool {
1090 http_request.version(request.version());
1091 http_request.base() = request.base();
1094 if (serverResult != expecting)
1098 boost::asio::ip::make_address(
"172.1.1.100");
1110 auto const clientResult =
1112 if (clientResult != expecting)
1118 BEAST_EXPECT(handshake(
false,
false,
false));
1119 BEAST_EXPECT(handshake(
false,
true,
false));
1120 BEAST_EXPECT(handshake(
true,
false,
false));
1121 BEAST_EXPECT(handshake(
true,
true,
true));
1127 testcase(
"local node has all the ledgers");
1132 NetworkOfTwo net(*
this, {totalReplay + 1}, psBhvr, ilBhvr, peerFeature);
1135 uint256 finalHash = l->info().hash;
1136 for (
int i = 0; i < totalReplay; ++i)
1141 net.client.ledgerMaster.storeLedger(l);
1142 l = net.server.ledgerMaster.getLedgerByHash(
1143 l->info().parentHash);
1149 net.client.replayer.replay(
1154 BEAST_EXPECT(net.client.waitAndCheckStatus(
1162 net.client.replayer.sweep();
1163 BEAST_EXPECT(net.client.countsAsExpected(0, 0, 0));
1169 testcase(
"all the ledgers from InboundLedgers");
1178 uint256 finalHash = l->info().hash;
1179 net.client.replayer.replay(
1184 BEAST_EXPECT(net.client.waitAndCheckStatus(
1192 net.client.replayer.sweep();
1193 BEAST_EXPECT(net.client.countsAsExpected(0, 0, 0));
1199 switch (peerSetBehavior)
1205 testcase(
"network drops 50% messages");
1208 testcase(
"network repeats all messages");
1223 uint256 finalHash = l->info().hash;
1224 for (
int i = 0; i < totalReplay - 1; ++i)
1226 l = net.server.ledgerMaster.getLedgerByHash(l->info().parentHash);
1228 net.client.ledgerMaster.storeLedger(l);
1230 net.client.replayer.replay(
1235 BEAST_EXPECT(net.client.waitAndCheckStatus(
1241 BEAST_EXPECT(net.client.waitForLedgers(finalHash, totalReplay));
1244 net.client.replayer.sweep();
1245 BEAST_EXPECT(net.client.countsAsExpected(0, 0, 0));
1252 int totalReplay = 3;
1261 uint256 finalHash = l->info().hash;
1262 net.client.replayer.replay(
1266 BEAST_EXPECT(net.client.checkStatus(
1273 BEAST_EXPECT(net.client.countsAsExpected(1, 1, 0));
1274 net.client.replayer.stop();
1275 BEAST_EXPECT(net.client.countsAsExpected(0, 0, 0));
1281 testcase(
"SkipListAcquire bad reply");
1282 int totalReplay = 3;
1285 {totalReplay + 1 + 1},
1291 uint256 finalHash = l->info().hash;
1292 net.client.replayer.replay(
1295 auto skipList = net.client.findSkipListAcquire(finalHash);
1298 0x6A, 0x09, 0xE6, 0x67, 0xF3, 0xBC, 0xC9, 0x08, 0xB2};
1301 skipList->processData(l->seq(), item);
1304 BEAST_EXPECT(net.client.waitAndCheckStatus(
1312 net.client.replayer.replay(
1314 BEAST_EXPECT(net.client.waitAndCheckStatus(
1320 BEAST_EXPECT(net.client.countsAsExpected(2, 1, 0));
1326 testcase(
"LedgerDeltaAcquire bad reply");
1327 int totalReplay = 3;
1336 uint256 finalHash = l->info().hash;
1337 net.client.ledgerMaster.storeLedger(l);
1338 net.client.replayer.replay(
1341 auto delta = net.client.findLedgerDeltaAcquire(l->info().parentHash);
1347 net.client.taskStatus(net.client.findTask(
1351 net.client.replayer.replay(
1354 net.client.taskStatus(net.client.findTask(
1362 int totalReplay = 5;
1365 {totalReplay * 3 + 1},
1370 uint256 finalHash = l->info().hash;
1371 net.client.replayer.replay(
1375 BEAST_EXPECT(net.client.waitAndCheckStatus(
1381 BEAST_EXPECT(net.client.waitForLedgers(finalHash, totalReplay));
1384 net.client.replayer.replay(
1386 BEAST_EXPECT(net.client.countsAsExpected(1, 1, totalReplay - 1));
1388 net.client.replayer.replay(
1390 BEAST_EXPECT(net.client.countsAsExpected(2, 1, totalReplay - 1));
1393 for (
int i = 0; i < totalReplay + 2; ++i)
1395 l = net.server.ledgerMaster.getLedgerByHash(l->info().parentHash);
1397 auto finalHash_early = l->info().hash;
1398 net.client.replayer.replay(
1400 BEAST_EXPECT(net.client.waitAndCheckStatus(
1406 BEAST_EXPECT(net.client.waitForLedgers(finalHash_early, totalReplay));
1407 BEAST_EXPECT(net.client.countsAsExpected(3, 2, 2 * (totalReplay - 1)));
1410 l = net.server.ledgerMaster.getLedgerByHash(l->info().parentHash);
1411 auto finalHash_moreEarly = l->info().parentHash;
1412 net.client.replayer.replay(
1414 BEAST_EXPECT(net.client.waitAndCheckStatus(
1415 finalHash_moreEarly,
1421 net.client.waitForLedgers(finalHash_moreEarly, totalReplay));
1423 net.client.countsAsExpected(4, 3, 2 * (totalReplay - 1) + 2));
1426 net.client.replayer.replay(
1430 BEAST_EXPECT(net.client.waitAndCheckStatus(
1436 BEAST_EXPECT(net.client.waitForLedgers(finalHash, totalReplay * 3));
1437 BEAST_EXPECT(net.client.countsAsExpected(5, 3, totalReplay * 3 - 1));
1440 net.client.replayer.sweep();
1441 BEAST_EXPECT(net.client.countsAsExpected(0, 0, 0));
1472 testcase(
"SkipListAcquire timeout");
1473 int totalReplay = 3;
1482 uint256 finalHash = l->info().hash;
1483 net.client.replayer.replay(
1487 BEAST_EXPECT(net.client.waitAndCheckStatus(
1495 BEAST_EXPECT(net.client.countsAsExpected(1, 1, 0));
1496 net.client.replayer.sweep();
1497 BEAST_EXPECT(net.client.countsAsExpected(0, 0, 0));
1503 testcase(
"LedgerDeltaAcquire timeout");
1504 int totalReplay = 3;
1513 uint256 finalHash = l->info().hash;
1514 net.client.ledgerMaster.storeLedger(l);
1515 net.client.replayer.replay(
1521 BEAST_EXPECT(net.client.waitAndCheckStatus(
1529 BEAST_EXPECT(net.client.countsAsExpected(1, 1, totalReplay - 1));
1530 net.client.replayer.sweep();
1531 BEAST_EXPECT(net.client.countsAsExpected(0, 0, 0));
1548 int totalReplay = 250;
1552 {totalReplay * rounds + 1},
1558 auto l = net.server.ledgerMaster.getClosedLedger();
1559 for (
int i = 0; i < rounds; ++i)
1562 for (
int j = 0; j < totalReplay; ++j)
1564 l = net.server.ledgerMaster.getLedgerByHash(
1565 l->info().parentHash);
1568 BEAST_EXPECT(finishHashes.size() == rounds);
1570 for (
int i = 0; i < rounds; ++i)
1572 net.client.replayer.replay(
1578 for (
int i = 0; i < rounds; ++i)
1580 BEAST_EXPECT(net.client.waitAndCheckStatus(
1589 net.client.waitForLedgers(finishHashes[0], totalReplay * rounds));
1590 BEAST_EXPECT(net.client.countsAsExpected(
1591 rounds, rounds, rounds * (totalReplay - 1)));
1594 net.client.replayer.sweep();
1595 BEAST_EXPECT(net.client.countsAsExpected(0, 0, 0));
1601BEAST_DEFINE_TESTSUITE(LedgerReplayerTimeout, app,
ripple);
1602BEAST_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.