21#include <test/jtx/envconfig.h>
22#include <xrpld/app/ledger/BuildLedger.h>
23#include <xrpld/app/ledger/LedgerMaster.h>
24#include <xrpld/app/ledger/LedgerReplay.h>
25#include <xrpld/app/ledger/LedgerReplayTask.h>
26#include <xrpld/app/ledger/LedgerReplayer.h>
27#include <xrpld/app/ledger/detail/LedgerDeltaAcquire.h>
28#include <xrpld/app/ledger/detail/LedgerReplayMsgHandler.h>
29#include <xrpld/app/ledger/detail/SkipListAcquire.h>
30#include <xrpld/overlay/PeerSet.h>
31#include <xrpld/overlay/detail/PeerImp.h>
32#include <xrpl/basics/Slice.h>
50 auto const alice =
Account(
"alice");
51 auto const bob =
Account(
"bob");
54 env.
fund(
XRP(100000), alice, bob);
59 auto const lastClosedParent =
60 ledgerMaster.getLedgerByHash(lastClosed->info().parentHash);
68 BEAST_EXPECT(replayed->info().hash == lastClosed->info().hash);
351 bool enableLedgerReplay)
371 ::google::protobuf::Message
const& msg,
372 protocol::MessageType type,
381 if ((rand() % 100 + 1) <= dropRate)
386 case protocol::mtPROOF_PATH_REQ: {
389 auto request = std::make_shared<protocol::TMProofPathRequest>(
390 dynamic_cast<protocol::TMProofPathRequest const&
>(msg));
391 auto reply = std::make_shared<protocol::TMProofPathResponse>(
398 case protocol::mtREPLAY_DELTA_REQ: {
401 auto request = std::make_shared<protocol::TMReplayDeltaRequest>(
402 dynamic_cast<protocol::TMReplayDeltaRequest const&
>(msg));
403 auto reply = std::make_shared<protocol::TMReplayDeltaResponse>(
449 return std::make_unique<TestPeerSet>(
494 auto fundedAccounts =
accounts.size();
495 for (
int i = 0; i < newAccounts; ++i)
510 int fundedAccounts =
accounts.size();
511 assert(fundedAccounts >= newTxes);
518 auto updateIdx = [&]() {
519 assert(fundedAccounts > senders.
size());
520 fromIdx = (fromIdx + r) % fundedAccounts;
521 while (senders.
count(fromIdx) != 0)
522 fromIdx = (fromIdx + 1) % fundedAccounts;
524 toIdx = (toIdx + r * 2) % fundedAccounts;
525 if (toIdx == fromIdx)
526 toIdx = (toIdx + 1) % fundedAccounts;
529 for (
int i = 0; i < newTxes; ++i)
591 server.
app.getLedgerMaster(),
616 uint256 hash = finishLedgerHash;
618 for (; i < totalReplay; ++i)
623 hash = l->info().parentHash;
631 int totalRound = 100;
632 for (
int i = 0; i < totalRound; ++i)
636 if (i < totalRound - 1)
645 int totalRound = 100;
646 for (
int i = 0; i < totalRound; ++i)
662 if (i < totalRound - 1)
681 return t->parameter_.finishHash_ == hash &&
682 t->parameter_.totalLedgers_ == totalReplay;
722 return i->second.lock();
732 return i->second.lock();
735 template <
typename T>
755 if (
taskStatus(task->skipListAcquirer_) == skiplistExpect)
757 if (task->deltas_.size() == deltaExpects.
size())
759 for (
int i = 0; i < deltaExpects.
size(); ++i)
761 if (
taskStatus(task->deltas_[i]) != deltaExpects[i])
779 auto t =
findTask(hash, totalReplay);
787 return asExpected(t, taskExpect, skiplistExpect, deltaExpects);
798 auto t =
findTask(hash, totalReplay);
806 return asExpected(t, taskExpect, skiplistExpect, deltaExpects);
821 hash, totalReplay, taskExpect, skiplistExpect, deltaExpects);
857 ,
client(suite,
server, behavior, inboundBhvr, peerFeature)
901 auto request = std::make_shared<protocol::TMProofPathRequest>();
902 request->set_ledgerhash(
903 l->info().hash.data(), l->info().hash.size());
904 request->set_type(protocol::TMLedgerMapType::lmACCOUNT_STATE);
905 auto reply = std::make_shared<protocol::TMProofPathResponse>(
906 server.msgHandler.processProofPathRequest(request));
907 BEAST_EXPECT(reply->has_error());
908 BEAST_EXPECT(!server.msgHandler.processProofPathResponse(reply));
912 auto request = std::make_shared<protocol::TMProofPathRequest>();
913 request->set_type(protocol::TMLedgerMapType::lmACCOUNT_STATE);
917 request->set_ledgerhash(hash.
data(), hash.
size());
918 auto reply = std::make_shared<protocol::TMProofPathResponse>(
919 server.msgHandler.processProofPathRequest(request));
920 BEAST_EXPECT(reply->has_error());
925 auto request = std::make_shared<protocol::TMProofPathRequest>();
926 request->set_ledgerhash(
927 l->info().hash.data(), l->info().hash.size());
928 request->set_type(protocol::TMLedgerMapType::lmACCOUNT_STATE);
932 auto reply = std::make_shared<protocol::TMProofPathResponse>(
933 server.msgHandler.processProofPathRequest(request));
934 BEAST_EXPECT(!reply->has_error());
935 BEAST_EXPECT(server.msgHandler.processProofPathResponse(reply));
942 reply->set_ledgerheader(r);
944 !server.msgHandler.processProofPathResponse(reply));
946 reply->set_ledgerheader(r);
947 BEAST_EXPECT(server.msgHandler.processProofPathResponse(reply));
949 reply->mutable_path()->RemoveLast();
951 !server.msgHandler.processProofPathResponse(reply));
965 auto request = std::make_shared<protocol::TMReplayDeltaRequest>();
966 auto reply = std::make_shared<protocol::TMReplayDeltaResponse>(
967 server.msgHandler.processReplayDeltaRequest(request));
968 BEAST_EXPECT(reply->has_error());
969 BEAST_EXPECT(!server.msgHandler.processReplayDeltaResponse(reply));
972 request->set_ledgerhash(hash.
data(), hash.
size());
973 reply = std::make_shared<protocol::TMReplayDeltaResponse>(
974 server.msgHandler.processReplayDeltaRequest(request));
975 BEAST_EXPECT(reply->has_error());
976 BEAST_EXPECT(!server.msgHandler.processReplayDeltaResponse(reply));
981 auto request = std::make_shared<protocol::TMReplayDeltaRequest>();
982 request->set_ledgerhash(
983 l->info().hash.data(), l->info().hash.size());
984 auto reply = std::make_shared<protocol::TMReplayDeltaResponse>(
985 server.msgHandler.processReplayDeltaRequest(request));
986 BEAST_EXPECT(!reply->has_error());
987 BEAST_EXPECT(server.msgHandler.processReplayDeltaResponse(reply));
994 reply->set_ledgerheader(r);
996 !server.msgHandler.processReplayDeltaResponse(reply));
998 reply->set_ledgerheader(r);
1000 server.msgHandler.processReplayDeltaResponse(reply));
1002 reply->mutable_transaction()->RemoveLast();
1004 !server.msgHandler.processReplayDeltaResponse(reply));
1016 for (
int i = 0; i < count; ++i)
1023 BEAST_EXPECT(!tp10.
update(
uint256(777), 5, makeSkipList(10)));
1024 BEAST_EXPECT(!tp10.
update(
uint256(10), 5, makeSkipList(8)));
1025 BEAST_EXPECT(tp10.
update(
uint256(10), 10, makeSkipList(10)));
1055 BEAST_EXPECT(tp20.
update(
uint256(20), 20, makeSkipList(20)));
1096 auto handshake = [&](
bool client,
bool server,
bool expecting) ->
bool {
1100 http_request.version(request.version());
1101 http_request.base() = request.base();
1104 if (serverResult != expecting)
1108 boost::asio::ip::address::from_string(
"172.1.1.100");
1120 auto const clientResult =
1122 if (clientResult != expecting)
1128 BEAST_EXPECT(handshake(
false,
false,
false));
1129 BEAST_EXPECT(handshake(
false,
true,
false));
1130 BEAST_EXPECT(handshake(
true,
false,
false));
1131 BEAST_EXPECT(handshake(
true,
true,
true));
1137 testcase(
"local node has all the ledgers");
1142 NetworkOfTwo net(*
this, {totalReplay + 1}, psBhvr, ilBhvr, peerFeature);
1145 uint256 finalHash = l->info().hash;
1146 for (
int i = 0; i < totalReplay; ++i)
1151 net.client.ledgerMaster.storeLedger(l);
1152 l = net.server.ledgerMaster.getLedgerByHash(
1153 l->info().parentHash);
1159 net.client.replayer.replay(
1164 BEAST_EXPECT(net.client.waitAndCheckStatus(
1172 net.client.replayer.sweep();
1173 BEAST_EXPECT(net.client.countsAsExpected(0, 0, 0));
1179 testcase(
"all the ledgers from InboundLedgers");
1188 uint256 finalHash = l->info().hash;
1189 net.client.replayer.replay(
1194 BEAST_EXPECT(net.client.waitAndCheckStatus(
1202 net.client.replayer.sweep();
1203 BEAST_EXPECT(net.client.countsAsExpected(0, 0, 0));
1209 switch (peerSetBehavior)
1215 testcase(
"network drops 50% messages");
1218 testcase(
"network repeats all messages");
1233 uint256 finalHash = l->info().hash;
1234 for (
int i = 0; i < totalReplay - 1; ++i)
1236 l = net.server.ledgerMaster.getLedgerByHash(l->info().parentHash);
1238 net.client.ledgerMaster.storeLedger(l);
1240 net.client.replayer.replay(
1245 BEAST_EXPECT(net.client.waitAndCheckStatus(
1251 BEAST_EXPECT(net.client.waitForLedgers(finalHash, totalReplay));
1254 net.client.replayer.sweep();
1255 BEAST_EXPECT(net.client.countsAsExpected(0, 0, 0));
1262 int totalReplay = 3;
1271 uint256 finalHash = l->info().hash;
1272 net.client.replayer.replay(
1276 BEAST_EXPECT(net.client.checkStatus(
1283 BEAST_EXPECT(net.client.countsAsExpected(1, 1, 0));
1284 net.client.replayer.stop();
1285 BEAST_EXPECT(net.client.countsAsExpected(0, 0, 0));
1291 testcase(
"SkipListAcquire bad reply");
1292 int totalReplay = 3;
1295 {totalReplay + 1 + 1},
1301 uint256 finalHash = l->info().hash;
1302 net.client.replayer.replay(
1305 auto skipList = net.client.findSkipListAcquire(finalHash);
1308 0x6A, 0x09, 0xE6, 0x67, 0xF3, 0xBC, 0xC9, 0x08, 0xB2};
1311 skipList->processData(l->seq(), item);
1314 BEAST_EXPECT(net.client.waitAndCheckStatus(
1322 net.client.replayer.replay(
1324 BEAST_EXPECT(net.client.waitAndCheckStatus(
1330 BEAST_EXPECT(net.client.countsAsExpected(2, 1, 0));
1336 testcase(
"LedgerDeltaAcquire bad reply");
1337 int totalReplay = 3;
1346 uint256 finalHash = l->info().hash;
1347 net.client.ledgerMaster.storeLedger(l);
1348 net.client.replayer.replay(
1351 auto delta = net.client.findLedgerDeltaAcquire(l->info().parentHash);
1357 net.client.taskStatus(net.client.findTask(
1361 net.client.replayer.replay(
1364 net.client.taskStatus(net.client.findTask(
1372 int totalReplay = 5;
1375 {totalReplay * 3 + 1},
1380 uint256 finalHash = l->info().hash;
1381 net.client.replayer.replay(
1385 BEAST_EXPECT(net.client.waitAndCheckStatus(
1391 BEAST_EXPECT(net.client.waitForLedgers(finalHash, totalReplay));
1394 net.client.replayer.replay(
1396 BEAST_EXPECT(net.client.countsAsExpected(1, 1, totalReplay - 1));
1398 net.client.replayer.replay(
1400 BEAST_EXPECT(net.client.countsAsExpected(2, 1, totalReplay - 1));
1403 for (
int i = 0; i < totalReplay + 2; ++i)
1405 l = net.server.ledgerMaster.getLedgerByHash(l->info().parentHash);
1407 auto finalHash_early = l->info().hash;
1408 net.client.replayer.replay(
1410 BEAST_EXPECT(net.client.waitAndCheckStatus(
1416 BEAST_EXPECT(net.client.waitForLedgers(finalHash_early, totalReplay));
1417 BEAST_EXPECT(net.client.countsAsExpected(3, 2, 2 * (totalReplay - 1)));
1420 l = net.server.ledgerMaster.getLedgerByHash(l->info().parentHash);
1421 auto finalHash_moreEarly = l->info().parentHash;
1422 net.client.replayer.replay(
1424 BEAST_EXPECT(net.client.waitAndCheckStatus(
1425 finalHash_moreEarly,
1431 net.client.waitForLedgers(finalHash_moreEarly, totalReplay));
1433 net.client.countsAsExpected(4, 3, 2 * (totalReplay - 1) + 2));
1436 net.client.replayer.replay(
1440 BEAST_EXPECT(net.client.waitAndCheckStatus(
1446 BEAST_EXPECT(net.client.waitForLedgers(finalHash, totalReplay * 3));
1447 BEAST_EXPECT(net.client.countsAsExpected(5, 3, totalReplay * 3 - 1));
1450 net.client.replayer.sweep();
1451 BEAST_EXPECT(net.client.countsAsExpected(0, 0, 0));
1482 testcase(
"SkipListAcquire timeout");
1483 int totalReplay = 3;
1492 uint256 finalHash = l->info().hash;
1493 net.client.replayer.replay(
1497 BEAST_EXPECT(net.client.waitAndCheckStatus(
1505 BEAST_EXPECT(net.client.countsAsExpected(1, 1, 0));
1506 net.client.replayer.sweep();
1507 BEAST_EXPECT(net.client.countsAsExpected(0, 0, 0));
1513 testcase(
"LedgerDeltaAcquire timeout");
1514 int totalReplay = 3;
1523 uint256 finalHash = l->info().hash;
1524 net.client.ledgerMaster.storeLedger(l);
1525 net.client.replayer.replay(
1531 BEAST_EXPECT(net.client.waitAndCheckStatus(
1539 BEAST_EXPECT(net.client.countsAsExpected(1, 1, totalReplay - 1));
1540 net.client.replayer.sweep();
1541 BEAST_EXPECT(net.client.countsAsExpected(0, 0, 0));
1558 int totalReplay = 250;
1562 {totalReplay * rounds + 1},
1568 auto l = net.server.ledgerMaster.getClosedLedger();
1569 for (
int i = 0; i < rounds; ++i)
1572 for (
int j = 0; j < totalReplay; ++j)
1574 l = net.server.ledgerMaster.getLedgerByHash(
1575 l->info().parentHash);
1578 BEAST_EXPECT(finishHashes.size() == rounds);
1580 for (
int i = 0; i < rounds; ++i)
1582 net.client.replayer.replay(
1588 for (
int i = 0; i < rounds; ++i)
1590 BEAST_EXPECT(net.client.waitAndCheckStatus(
1599 net.client.waitForLedgers(finishHashes[0], totalReplay * rounds));
1600 BEAST_EXPECT(net.client.countsAsExpected(
1601 rounds, rounds, rounds * (totalReplay - 1)));
1604 net.client.replayer.sweep();
1605 BEAST_EXPECT(net.client.countsAsExpected(0, 0, 0));
1611BEAST_DEFINE_TESTSUITE(LedgerReplayerTimeout, app,
ripple);
1612BEAST_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
beast::IP::Endpoint getRemoteAddress() const override
void removeTxQueue(const uint256 &) override
Remove hash from the transactions' hashes queue.
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 cycleStatus() override
bool txReduceRelayEnabled() const override
bool isHighLatency() const override
bool hasTxSet(uint256 const &hash) const override
void addTxQueue(const uint256 &) override
Aggregate transaction's hash.
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.
std::shared_ptr< Ledger > buildLedger(std::shared_ptr< Ledger const > const &parent, NetClock::time_point closeTime, const bool closeTimeCorrect, NetClock::duration closeResolution, Application &app, CanonicalTXSet &txns, std::set< TxID > &failedTxs, beast::Journal j)
Build a new ledger by applying consensus transactions.
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.
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
LedgerReplayMsgHandler & local
std::shared_ptr< TestPeer > dummyPeer
const std::set< Peer::id_t > & getPeerIds() const override
get the set of ids of previously added peers
Set the sequence number on a JTx.