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);
353 bool enableLedgerReplay)
373 ::google::protobuf::Message
const& msg,
374 protocol::MessageType type,
383 if ((rand() % 100 + 1) <= dropRate)
388 case protocol::mtPROOF_PATH_REQ: {
391 auto request = std::make_shared<protocol::TMProofPathRequest>(
392 dynamic_cast<protocol::TMProofPathRequest const&
>(msg));
393 auto reply = std::make_shared<protocol::TMProofPathResponse>(
400 case protocol::mtREPLAY_DELTA_REQ: {
403 auto request = std::make_shared<protocol::TMReplayDeltaRequest>(
404 dynamic_cast<protocol::TMReplayDeltaRequest const&
>(msg));
405 auto reply = std::make_shared<protocol::TMReplayDeltaResponse>(
451 return std::make_unique<TestPeerSet>(
496 auto fundedAccounts =
accounts.size();
497 for (
int i = 0; i < newAccounts; ++i)
512 int fundedAccounts =
accounts.size();
513 assert(fundedAccounts >= newTxes);
520 auto updateIdx = [&]() {
521 assert(fundedAccounts > senders.
size());
522 fromIdx = (fromIdx + r) % fundedAccounts;
523 while (senders.
count(fromIdx) != 0)
524 fromIdx = (fromIdx + 1) % fundedAccounts;
526 toIdx = (toIdx + r * 2) % fundedAccounts;
527 if (toIdx == fromIdx)
528 toIdx = (toIdx + 1) % fundedAccounts;
531 for (
int i = 0; i < newTxes; ++i)
593 server.
app.getLedgerMaster(),
618 uint256 hash = finishLedgerHash;
620 for (; i < totalReplay; ++i)
625 hash = l->info().parentHash;
633 int totalRound = 100;
634 for (
int i = 0; i < totalRound; ++i)
638 if (i < totalRound - 1)
647 int totalRound = 100;
648 for (
int i = 0; i < totalRound; ++i)
664 if (i < totalRound - 1)
683 return t->parameter_.finishHash_ == hash &&
684 t->parameter_.totalLedgers_ == totalReplay;
724 return i->second.lock();
734 return i->second.lock();
737 template <
typename T>
757 if (
taskStatus(task->skipListAcquirer_) == skiplistExpect)
759 if (task->deltas_.size() == deltaExpects.
size())
761 for (
int i = 0; i < deltaExpects.
size(); ++i)
763 if (
taskStatus(task->deltas_[i]) != deltaExpects[i])
781 auto t =
findTask(hash, totalReplay);
789 return asExpected(t, taskExpect, skiplistExpect, deltaExpects);
800 auto t =
findTask(hash, totalReplay);
808 return asExpected(t, taskExpect, skiplistExpect, deltaExpects);
823 hash, totalReplay, taskExpect, skiplistExpect, deltaExpects);
859 ,
client(suite,
server, behavior, inboundBhvr, peerFeature)
903 auto request = std::make_shared<protocol::TMProofPathRequest>();
904 request->set_ledgerhash(
905 l->info().hash.data(), l->info().hash.size());
906 request->set_type(protocol::TMLedgerMapType::lmACCOUNT_STATE);
907 auto reply = std::make_shared<protocol::TMProofPathResponse>(
908 server.msgHandler.processProofPathRequest(request));
909 BEAST_EXPECT(reply->has_error());
910 BEAST_EXPECT(!server.msgHandler.processProofPathResponse(reply));
914 auto request = std::make_shared<protocol::TMProofPathRequest>();
915 request->set_type(protocol::TMLedgerMapType::lmACCOUNT_STATE);
919 request->set_ledgerhash(hash.
data(), hash.
size());
920 auto reply = std::make_shared<protocol::TMProofPathResponse>(
921 server.msgHandler.processProofPathRequest(request));
922 BEAST_EXPECT(reply->has_error());
927 auto request = std::make_shared<protocol::TMProofPathRequest>();
928 request->set_ledgerhash(
929 l->info().hash.data(), l->info().hash.size());
930 request->set_type(protocol::TMLedgerMapType::lmACCOUNT_STATE);
934 auto reply = std::make_shared<protocol::TMProofPathResponse>(
935 server.msgHandler.processProofPathRequest(request));
936 BEAST_EXPECT(!reply->has_error());
937 BEAST_EXPECT(server.msgHandler.processProofPathResponse(reply));
944 reply->set_ledgerheader(r);
946 !server.msgHandler.processProofPathResponse(reply));
948 reply->set_ledgerheader(r);
949 BEAST_EXPECT(server.msgHandler.processProofPathResponse(reply));
951 reply->mutable_path()->RemoveLast();
953 !server.msgHandler.processProofPathResponse(reply));
967 auto request = std::make_shared<protocol::TMReplayDeltaRequest>();
968 auto reply = std::make_shared<protocol::TMReplayDeltaResponse>(
969 server.msgHandler.processReplayDeltaRequest(request));
970 BEAST_EXPECT(reply->has_error());
971 BEAST_EXPECT(!server.msgHandler.processReplayDeltaResponse(reply));
974 request->set_ledgerhash(hash.
data(), hash.
size());
975 reply = std::make_shared<protocol::TMReplayDeltaResponse>(
976 server.msgHandler.processReplayDeltaRequest(request));
977 BEAST_EXPECT(reply->has_error());
978 BEAST_EXPECT(!server.msgHandler.processReplayDeltaResponse(reply));
983 auto request = std::make_shared<protocol::TMReplayDeltaRequest>();
984 request->set_ledgerhash(
985 l->info().hash.data(), l->info().hash.size());
986 auto reply = std::make_shared<protocol::TMReplayDeltaResponse>(
987 server.msgHandler.processReplayDeltaRequest(request));
988 BEAST_EXPECT(!reply->has_error());
989 BEAST_EXPECT(server.msgHandler.processReplayDeltaResponse(reply));
996 reply->set_ledgerheader(r);
998 !server.msgHandler.processReplayDeltaResponse(reply));
1000 reply->set_ledgerheader(r);
1002 server.msgHandler.processReplayDeltaResponse(reply));
1004 reply->mutable_transaction()->RemoveLast();
1006 !server.msgHandler.processReplayDeltaResponse(reply));
1018 for (
int i = 0; i < count; ++i)
1025 BEAST_EXPECT(!tp10.
update(
uint256(777), 5, makeSkipList(10)));
1026 BEAST_EXPECT(!tp10.
update(
uint256(10), 5, makeSkipList(8)));
1027 BEAST_EXPECT(tp10.
update(
uint256(10), 10, makeSkipList(10)));
1057 BEAST_EXPECT(tp20.
update(
uint256(20), 20, makeSkipList(20)));
1098 auto handshake = [&](
bool client,
bool server,
bool expecting) ->
bool {
1102 http_request.version(request.version());
1103 http_request.base() = request.base();
1106 if (serverResult != expecting)
1110 boost::asio::ip::address::from_string(
"172.1.1.100");
1122 auto const clientResult =
1124 if (clientResult != expecting)
1130 BEAST_EXPECT(handshake(
false,
false,
false));
1131 BEAST_EXPECT(handshake(
false,
true,
false));
1132 BEAST_EXPECT(handshake(
true,
false,
false));
1133 BEAST_EXPECT(handshake(
true,
true,
true));
1139 testcase(
"local node has all the ledgers");
1144 NetworkOfTwo net(*
this, {totalReplay + 1}, psBhvr, ilBhvr, peerFeature);
1147 uint256 finalHash = l->info().hash;
1148 for (
int i = 0; i < totalReplay; ++i)
1153 net.client.ledgerMaster.storeLedger(l);
1154 l = net.server.ledgerMaster.getLedgerByHash(
1155 l->info().parentHash);
1161 net.client.replayer.replay(
1166 BEAST_EXPECT(net.client.waitAndCheckStatus(
1174 net.client.replayer.sweep();
1175 BEAST_EXPECT(net.client.countsAsExpected(0, 0, 0));
1181 testcase(
"all the ledgers from InboundLedgers");
1190 uint256 finalHash = l->info().hash;
1191 net.client.replayer.replay(
1196 BEAST_EXPECT(net.client.waitAndCheckStatus(
1204 net.client.replayer.sweep();
1205 BEAST_EXPECT(net.client.countsAsExpected(0, 0, 0));
1211 switch (peerSetBehavior)
1217 testcase(
"network drops 50% messages");
1220 testcase(
"network repeats all messages");
1235 uint256 finalHash = l->info().hash;
1236 for (
int i = 0; i < totalReplay - 1; ++i)
1238 l = net.server.ledgerMaster.getLedgerByHash(l->info().parentHash);
1240 net.client.ledgerMaster.storeLedger(l);
1242 net.client.replayer.replay(
1247 BEAST_EXPECT(net.client.waitAndCheckStatus(
1253 BEAST_EXPECT(net.client.waitForLedgers(finalHash, totalReplay));
1256 net.client.replayer.sweep();
1257 BEAST_EXPECT(net.client.countsAsExpected(0, 0, 0));
1264 int totalReplay = 3;
1273 uint256 finalHash = l->info().hash;
1274 net.client.replayer.replay(
1278 BEAST_EXPECT(net.client.checkStatus(
1285 BEAST_EXPECT(net.client.countsAsExpected(1, 1, 0));
1286 net.client.replayer.stop();
1287 BEAST_EXPECT(net.client.countsAsExpected(0, 0, 0));
1293 testcase(
"SkipListAcquire bad reply");
1294 int totalReplay = 3;
1297 {totalReplay + 1 + 1},
1303 uint256 finalHash = l->info().hash;
1304 net.client.replayer.replay(
1307 auto skipList = net.client.findSkipListAcquire(finalHash);
1310 0x6A, 0x09, 0xE6, 0x67, 0xF3, 0xBC, 0xC9, 0x08, 0xB2};
1313 skipList->processData(l->seq(), item);
1316 BEAST_EXPECT(net.client.waitAndCheckStatus(
1324 net.client.replayer.replay(
1326 BEAST_EXPECT(net.client.waitAndCheckStatus(
1332 BEAST_EXPECT(net.client.countsAsExpected(2, 1, 0));
1338 testcase(
"LedgerDeltaAcquire bad reply");
1339 int totalReplay = 3;
1348 uint256 finalHash = l->info().hash;
1349 net.client.ledgerMaster.storeLedger(l);
1350 net.client.replayer.replay(
1353 auto delta = net.client.findLedgerDeltaAcquire(l->info().parentHash);
1359 net.client.taskStatus(net.client.findTask(
1363 net.client.replayer.replay(
1366 net.client.taskStatus(net.client.findTask(
1374 int totalReplay = 5;
1377 {totalReplay * 3 + 1},
1382 uint256 finalHash = l->info().hash;
1383 net.client.replayer.replay(
1387 BEAST_EXPECT(net.client.waitAndCheckStatus(
1393 BEAST_EXPECT(net.client.waitForLedgers(finalHash, totalReplay));
1396 net.client.replayer.replay(
1398 BEAST_EXPECT(net.client.countsAsExpected(1, 1, totalReplay - 1));
1400 net.client.replayer.replay(
1402 BEAST_EXPECT(net.client.countsAsExpected(2, 1, totalReplay - 1));
1405 for (
int i = 0; i < totalReplay + 2; ++i)
1407 l = net.server.ledgerMaster.getLedgerByHash(l->info().parentHash);
1409 auto finalHash_early = l->info().hash;
1410 net.client.replayer.replay(
1412 BEAST_EXPECT(net.client.waitAndCheckStatus(
1418 BEAST_EXPECT(net.client.waitForLedgers(finalHash_early, totalReplay));
1419 BEAST_EXPECT(net.client.countsAsExpected(3, 2, 2 * (totalReplay - 1)));
1422 l = net.server.ledgerMaster.getLedgerByHash(l->info().parentHash);
1423 auto finalHash_moreEarly = l->info().parentHash;
1424 net.client.replayer.replay(
1426 BEAST_EXPECT(net.client.waitAndCheckStatus(
1427 finalHash_moreEarly,
1433 net.client.waitForLedgers(finalHash_moreEarly, totalReplay));
1435 net.client.countsAsExpected(4, 3, 2 * (totalReplay - 1) + 2));
1438 net.client.replayer.replay(
1442 BEAST_EXPECT(net.client.waitAndCheckStatus(
1448 BEAST_EXPECT(net.client.waitForLedgers(finalHash, totalReplay * 3));
1449 BEAST_EXPECT(net.client.countsAsExpected(5, 3, totalReplay * 3 - 1));
1452 net.client.replayer.sweep();
1453 BEAST_EXPECT(net.client.countsAsExpected(0, 0, 0));
1484 testcase(
"SkipListAcquire timeout");
1485 int totalReplay = 3;
1494 uint256 finalHash = l->info().hash;
1495 net.client.replayer.replay(
1499 BEAST_EXPECT(net.client.waitAndCheckStatus(
1507 BEAST_EXPECT(net.client.countsAsExpected(1, 1, 0));
1508 net.client.replayer.sweep();
1509 BEAST_EXPECT(net.client.countsAsExpected(0, 0, 0));
1515 testcase(
"LedgerDeltaAcquire timeout");
1516 int totalReplay = 3;
1525 uint256 finalHash = l->info().hash;
1526 net.client.ledgerMaster.storeLedger(l);
1527 net.client.replayer.replay(
1533 BEAST_EXPECT(net.client.waitAndCheckStatus(
1541 BEAST_EXPECT(net.client.countsAsExpected(1, 1, totalReplay - 1));
1542 net.client.replayer.sweep();
1543 BEAST_EXPECT(net.client.countsAsExpected(0, 0, 0));
1560 int totalReplay = 250;
1564 {totalReplay * rounds + 1},
1570 auto l = net.server.ledgerMaster.getClosedLedger();
1571 for (
int i = 0; i < rounds; ++i)
1574 for (
int j = 0; j < totalReplay; ++j)
1576 l = net.server.ledgerMaster.getLedgerByHash(
1577 l->info().parentHash);
1580 BEAST_EXPECT(finishHashes.size() == rounds);
1582 for (
int i = 0; i < rounds; ++i)
1584 net.client.replayer.replay(
1590 for (
int i = 0; i < rounds; ++i)
1592 BEAST_EXPECT(net.client.waitAndCheckStatus(
1601 net.client.waitForLedgers(finishHashes[0], totalReplay * rounds));
1602 BEAST_EXPECT(net.client.countsAsExpected(
1603 rounds, rounds, rounds * (totalReplay - 1)));
1606 net.client.replayer.sweep();
1607 BEAST_EXPECT(net.client.countsAsExpected(0, 0, 0));
1613BEAST_DEFINE_TESTSUITE(LedgerReplayerTimeout, app,
ripple);
1614BEAST_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
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.