diff --git a/.github/scripts/levelization/results/loops.txt b/.github/scripts/levelization/results/loops.txt index 34842d7f48..7914704f9d 100644 --- a/.github/scripts/levelization/results/loops.txt +++ b/.github/scripts/levelization/results/loops.txt @@ -5,7 +5,7 @@ Loop: test.jtx test.unit_test test.unit_test == test.jtx Loop: xrpld.app xrpld.overlay - xrpld.overlay > xrpld.app + xrpld.overlay ~= xrpld.app Loop: xrpld.app xrpld.peerfinder xrpld.peerfinder == xrpld.app diff --git a/.github/scripts/levelization/results/ordering.txt b/.github/scripts/levelization/results/ordering.txt index 85f2457ea3..1de6f803f3 100644 --- a/.github/scripts/levelization/results/ordering.txt +++ b/.github/scripts/levelization/results/ordering.txt @@ -137,6 +137,7 @@ test.rpc > xrpld.rpc test.rpc > xrpl.json test.rpc > xrpl.protocol test.rpc > xrpl.resource +test.rpc > xrpl.server test.server > test.jtx test.server > test.toplevel test.server > test.unit_test @@ -178,8 +179,11 @@ xrpl.resource > xrpl.protocol xrpl.server > xrpl.basics xrpl.server > xrpl.core xrpl.server > xrpl.json +xrpl.server > xrpl.ledger xrpl.server > xrpl.protocol xrpl.server > xrpl.rdb +xrpl.server > xrpl.resource +xrpl.server > xrpl.shamap xrpl.shamap > xrpl.basics xrpl.shamap > xrpl.nodestore xrpl.shamap > xrpl.protocol diff --git a/cmake/XrplCore.cmake b/cmake/XrplCore.cmake index cea19db9bc..ba14899bd9 100644 --- a/cmake/XrplCore.cmake +++ b/cmake/XrplCore.cmake @@ -95,7 +95,8 @@ add_module(xrpl rdb) target_link_libraries(xrpl.libxrpl.rdb PUBLIC xrpl.libxrpl.basics xrpl.libxrpl.core) add_module(xrpl server) -target_link_libraries(xrpl.libxrpl.server PUBLIC xrpl.libxrpl.protocol xrpl.libxrpl.core xrpl.libxrpl.rdb) +target_link_libraries(xrpl.libxrpl.server PUBLIC xrpl.libxrpl.protocol xrpl.libxrpl.core xrpl.libxrpl.rdb + xrpl.libxrpl.resource) add_module(xrpl ledger) target_link_libraries(xrpl.libxrpl.ledger PUBLIC xrpl.libxrpl.basics xrpl.libxrpl.json xrpl.libxrpl.protocol diff --git a/docs/CodingStyle.md b/docs/CodingStyle.md index 3c26709047..2788f7b210 100644 --- a/docs/CodingStyle.md +++ b/docs/CodingStyle.md @@ -17,8 +17,8 @@ guideline is to maintain the standards that are used in those libraries. ## Guidelines If you want to do something contrary to these guidelines, understand -why you're doing it. Think, use common sense, and consider that this -your changes will probably need to be maintained long after you've +why you're doing it. Think, use common sense, and consider that these +changes will probably need to be maintained long after you've moved on to other projects. - Use white space and blank lines to guide the eye and keep your intent clear. diff --git a/src/xrpld/rpc/InfoSub.h b/include/xrpl/server/InfoSub.h similarity index 99% rename from src/xrpld/rpc/InfoSub.h rename to include/xrpl/server/InfoSub.h index d49e401bd3..1a7222bf5d 100644 --- a/src/xrpld/rpc/InfoSub.h +++ b/include/xrpl/server/InfoSub.h @@ -131,6 +131,7 @@ public: virtual bool subPeerStatus(ref ispListener) = 0; + virtual bool unsubPeerStatus(std::uint64_t uListener) = 0; virtual void diff --git a/src/xrpld/app/misc/NetworkOPs.h b/include/xrpl/server/NetworkOPs.h similarity index 92% rename from src/xrpld/app/misc/NetworkOPs.h rename to include/xrpl/server/NetworkOPs.h index 66c915008a..cfe0021c07 100644 --- a/src/xrpld/app/misc/NetworkOPs.h +++ b/include/xrpl/server/NetworkOPs.h @@ -1,13 +1,13 @@ #pragma once -#include -#include -#include - #include +#include #include #include +#include #include +#include +#include #include @@ -23,6 +23,7 @@ class LedgerMaster; class Transaction; class ValidatorKeys; class CanonicalTXSet; +class RCLCxPeerPos; // This is the primary interface into the "client" portion of the program. // Code that wants to do normal operations on the network such as @@ -245,20 +246,4 @@ public: stateAccounting(Json::Value& obj) = 0; }; -//------------------------------------------------------------------------------ - -std::unique_ptr -make_NetworkOPs( - Application& app, - NetworkOPs::clock_type& clock, - bool standalone, - std::size_t minPeerCount, - bool start_valid, - JobQueue& job_queue, - LedgerMaster& ledgerMaster, - ValidatorKeys const& validatorKeys, - boost::asio::io_context& io_svc, - beast::Journal journal, - beast::insight::Collector::ptr const& collector); - } // namespace xrpl diff --git a/src/xrpld/rpc/detail/InfoSub.cpp b/src/libxrpl/server/InfoSub.cpp similarity index 98% rename from src/xrpld/rpc/detail/InfoSub.cpp rename to src/libxrpl/server/InfoSub.cpp index 27e3a65b2f..c413f5d257 100644 --- a/src/xrpld/rpc/detail/InfoSub.cpp +++ b/src/libxrpl/server/InfoSub.cpp @@ -1,4 +1,4 @@ -#include +#include namespace xrpl { diff --git a/src/test/app/Batch_test.cpp b/src/test/app/Batch_test.cpp index 72f3677e3b..133f10cd28 100644 --- a/src/test/app/Batch_test.cpp +++ b/src/test/app/Batch_test.cpp @@ -3,7 +3,6 @@ #include #include -#include #include #include #include @@ -14,6 +13,7 @@ #include #include #include +#include namespace xrpl { namespace test { diff --git a/src/test/jtx/Env_test.cpp b/src/test/jtx/Env_test.cpp index 0f43691b86..f0a46ba55c 100644 --- a/src/test/jtx/Env_test.cpp +++ b/src/test/jtx/Env_test.cpp @@ -1,6 +1,5 @@ #include -#include #include #include @@ -8,6 +7,7 @@ #include #include #include +#include #include diff --git a/src/test/jtx/impl/Env.cpp b/src/test/jtx/impl/Env.cpp index d8bcec84ee..3fdfa2bf2a 100644 --- a/src/test/jtx/impl/Env.cpp +++ b/src/test/jtx/impl/Env.cpp @@ -10,7 +10,6 @@ #include #include -#include #include #include @@ -25,6 +24,7 @@ #include #include #include +#include #include #include diff --git a/src/test/rpc/AmendmentBlocked_test.cpp b/src/test/rpc/AmendmentBlocked_test.cpp index 73a8c6d299..fc1e21a0b6 100644 --- a/src/test/rpc/AmendmentBlocked_test.cpp +++ b/src/test/rpc/AmendmentBlocked_test.cpp @@ -1,10 +1,10 @@ #include #include -#include #include #include +#include namespace xrpl { diff --git a/src/test/rpc/ServerInfo_test.cpp b/src/test/rpc/ServerInfo_test.cpp index 054c3e563a..c38844e8a6 100644 --- a/src/test/rpc/ServerInfo_test.cpp +++ b/src/test/rpc/ServerInfo_test.cpp @@ -1,10 +1,10 @@ #include -#include #include #include #include +#include #include diff --git a/src/test/rpc/Subscribe_test.cpp b/src/test/rpc/Subscribe_test.cpp index cce45fb4ef..759b02dcc7 100644 --- a/src/test/rpc/Subscribe_test.cpp +++ b/src/test/rpc/Subscribe_test.cpp @@ -4,13 +4,13 @@ #include #include -#include #include #include #include #include #include +#include #include diff --git a/src/test/server/ServerStatus_test.cpp b/src/test/server/ServerStatus_test.cpp index ccfdf2fd2b..5a91ad4b03 100644 --- a/src/test/server/ServerStatus_test.cpp +++ b/src/test/server/ServerStatus_test.cpp @@ -5,12 +5,12 @@ #include #include -#include #include #include #include #include +#include #include #include diff --git a/src/xrpld/app/consensus/RCLConsensus.cpp b/src/xrpld/app/consensus/RCLConsensus.cpp index 35f8eec1a3..4ebd1a502f 100644 --- a/src/xrpld/app/consensus/RCLConsensus.cpp +++ b/src/xrpld/app/consensus/RCLConsensus.cpp @@ -11,7 +11,6 @@ #include #include #include -#include #include #include #include @@ -25,6 +24,7 @@ #include #include #include +#include #include #include diff --git a/src/xrpld/app/ledger/BookListeners.h b/src/xrpld/app/ledger/BookListeners.h index 036e988749..3ed267448b 100644 --- a/src/xrpld/app/ledger/BookListeners.h +++ b/src/xrpld/app/ledger/BookListeners.h @@ -1,8 +1,7 @@ #pragma once -#include - #include +#include #include #include diff --git a/src/xrpld/app/ledger/ConsensusTransSetSF.cpp b/src/xrpld/app/ledger/ConsensusTransSetSF.cpp index 6a8dbd3d7d..a99960fd3a 100644 --- a/src/xrpld/app/ledger/ConsensusTransSetSF.cpp +++ b/src/xrpld/app/ledger/ConsensusTransSetSF.cpp @@ -1,6 +1,5 @@ #include #include -#include #include #include @@ -8,6 +7,7 @@ #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/app/ledger/OrderBookDB.cpp b/src/xrpld/app/ledger/OrderBookDB.cpp index 81a3bf5e4a..6450544f92 100644 --- a/src/xrpld/app/ledger/OrderBookDB.cpp +++ b/src/xrpld/app/ledger/OrderBookDB.cpp @@ -2,12 +2,12 @@ #include #include #include -#include #include #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/app/ledger/detail/InboundLedgers.cpp b/src/xrpld/app/ledger/detail/InboundLedgers.cpp index 626f58b686..5441e2dc95 100644 --- a/src/xrpld/app/ledger/detail/InboundLedgers.cpp +++ b/src/xrpld/app/ledger/detail/InboundLedgers.cpp @@ -1,7 +1,6 @@ #include #include #include -#include #include #include @@ -10,6 +9,7 @@ #include #include #include +#include #include #include diff --git a/src/xrpld/app/ledger/detail/InboundTransactions.cpp b/src/xrpld/app/ledger/detail/InboundTransactions.cpp index 36ebb7bd9e..9e877465a5 100644 --- a/src/xrpld/app/ledger/detail/InboundTransactions.cpp +++ b/src/xrpld/app/ledger/detail/InboundTransactions.cpp @@ -2,12 +2,12 @@ #include #include #include -#include #include #include #include #include +#include #include #include diff --git a/src/xrpld/app/ledger/detail/LedgerMaster.cpp b/src/xrpld/app/ledger/detail/LedgerMaster.cpp index 1fd1a8a8b2..f8ef91a83f 100644 --- a/src/xrpld/app/ledger/detail/LedgerMaster.cpp +++ b/src/xrpld/app/ledger/detail/LedgerMaster.cpp @@ -8,7 +8,6 @@ #include #include #include -#include #include #include #include @@ -30,6 +29,7 @@ #include #include #include +#include #include #include diff --git a/src/xrpld/app/ledger/detail/TransactionAcquire.cpp b/src/xrpld/app/ledger/detail/TransactionAcquire.cpp index f838a912eb..06cd6a2696 100644 --- a/src/xrpld/app/ledger/detail/TransactionAcquire.cpp +++ b/src/xrpld/app/ledger/detail/TransactionAcquire.cpp @@ -3,7 +3,8 @@ #include #include #include -#include + +#include #include diff --git a/src/xrpld/app/main/Application.cpp b/src/xrpld/app/main/Application.cpp index 7a59d586e0..3f7b6c5596 100644 --- a/src/xrpld/app/main/Application.cpp +++ b/src/xrpld/app/main/Application.cpp @@ -18,11 +18,11 @@ #include #include #include -#include #include #include #include #include +#include #include #include #include diff --git a/src/xrpld/app/main/GRPCServer.h b/src/xrpld/app/main/GRPCServer.h index fdac2b6484..1b41722fff 100644 --- a/src/xrpld/app/main/GRPCServer.h +++ b/src/xrpld/app/main/GRPCServer.h @@ -3,13 +3,13 @@ #include #include #include -#include #include #include #include #include #include +#include #include diff --git a/src/xrpld/app/main/LoadManager.cpp b/src/xrpld/app/main/LoadManager.cpp index d1336b20d9..5e3b572e1d 100644 --- a/src/xrpld/app/main/LoadManager.cpp +++ b/src/xrpld/app/main/LoadManager.cpp @@ -1,10 +1,10 @@ #include #include #include -#include #include #include +#include #include #include diff --git a/src/xrpld/app/misc/NetworkOPs.cpp b/src/xrpld/app/misc/NetworkOPs.cpp index 7da26ada40..9e60a8bdc0 100644 --- a/src/xrpld/app/misc/NetworkOPs.cpp +++ b/src/xrpld/app/misc/NetworkOPs.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -14,12 +15,12 @@ #include #include #include -#include #include #include #include #include #include +#include #include #include #include @@ -197,7 +198,7 @@ class NetworkOPsImp final : public NetworkOPs public: NetworkOPsImp( - Application& app, + ServiceRegistry& registry, NetworkOPs::clock_type& clock, bool standalone, std::size_t minPeerCount, @@ -208,7 +209,7 @@ public: boost::asio::io_context& io_svc, beast::Journal journal, beast::insight::Collector::ptr const& collector) - : app_(app) + : registry_(registry) , m_journal(journal) , m_localTX(make_LocalTxs()) , mMode(start_valid ? OperatingMode::FULL : OperatingMode::DISCONNECTED) @@ -216,14 +217,16 @@ public: , clusterTimer_(io_svc) , accountHistoryTxTimer_(io_svc) , mConsensus( - app, - make_FeeVote(setup_FeeVote(app_.config().section("voting")), app_.logs().journal("FeeVote")), + registry_.app(), + make_FeeVote( + setup_FeeVote(registry_.app().config().section("voting")), + registry_.logs().journal("FeeVote")), ledgerMaster, *m_localTX, - app.getInboundTransactions(), + registry.getInboundTransactions(), beast::get_abstract_clock(), validatorKeys, - app_.logs().journal("LedgerConsensus")) + registry_.logs().journal("LedgerConsensus")) , validatorPK_(validatorKeys.keys ? validatorKeys.keys->publicKey : decltype(validatorPK_){}) , validatorMasterPK_(validatorKeys.keys ? validatorKeys.keys->masterPublicKey : decltype(validatorMasterPK_){}) , m_ledgerMaster(ledgerMaster) @@ -665,7 +668,7 @@ private: void setAccountHistoryJobTimer(SubAccountHistoryInfoWeak subInfo); - Application& app_; + ServiceRegistry& registry_; beast::Journal m_journal; std::unique_ptr m_localTX; @@ -847,7 +850,7 @@ NetworkOPsImp::getHostId(bool forAdmin) // For non-admin uses hash the node public key into a // single RFC1751 word: static std::string const shroudedHostId = [this]() { - auto const& id = app_.nodeIdentity(); + auto const& id = registry_.app().nodeIdentity(); return RFC1751::getWordFromBlob(id.first.data(), id.first.size()); }(); @@ -861,7 +864,7 @@ NetworkOPsImp::setStateTimer() setHeartbeatTimer(); // Only do this work if a cluster is configured - if (app_.cluster().size() != 0) + if (registry_.cluster().size() != 0) setClusterTimer(); } @@ -932,13 +935,13 @@ NetworkOPsImp::processHeartbeatTimer() { RclConsensusLogger clog("Heartbeat Timer", mConsensus.validating(), m_journal); { - std::unique_lock lock{app_.getMasterMutex()}; + std::unique_lock lock{registry_.app().getMasterMutex()}; // VFALCO NOTE This is for diagnosing a crash on exit - LoadManager& mgr(app_.getLoadManager()); + LoadManager& mgr(registry_.getLoadManager()); mgr.heartbeat(); - std::size_t const numPeers = app_.overlay().size(); + std::size_t const numPeers = registry_.overlay().size(); // do we have sufficient peers? If not, we are disconnected. if (numPeers < minPeerCount_) @@ -990,7 +993,7 @@ NetworkOPsImp::processHeartbeatTimer() CLOG(clog.ss()) << ". "; } - mConsensus.timerEntry(app_.timeKeeper().closeTime(), clog.ss()); + mConsensus.timerEntry(registry_.timeKeeper().closeTime(), clog.ss()); CLOG(clog.ss()) << "consensus phase " << to_string(mLastConsensusPhase); ConsensusPhase const currPhase = mConsensus.phase(); @@ -1008,16 +1011,16 @@ NetworkOPsImp::processHeartbeatTimer() void NetworkOPsImp::processClusterTimer() { - if (app_.cluster().size() == 0) + if (registry_.cluster().size() == 0) return; using namespace std::chrono_literals; - bool const update = app_.cluster().update( - app_.nodeIdentity().first, + bool const update = registry_.cluster().update( + registry_.app().nodeIdentity().first, "", - (m_ledgerMaster.getValidatedLedgerAge() <= 4min) ? app_.getFeeTrack().getLocalFee() : 0, - app_.timeKeeper().now()); + (m_ledgerMaster.getValidatedLedgerAge() <= 4min) ? registry_.getFeeTrack().getLocalFee() : 0, + registry_.timeKeeper().now()); if (!update) { @@ -1027,7 +1030,7 @@ NetworkOPsImp::processClusterTimer() } protocol::TMCluster cluster; - app_.cluster().for_each([&cluster](ClusterNode const& node) { + registry_.cluster().for_each([&cluster](ClusterNode const& node) { protocol::TMClusterNode& n = *cluster.add_clusternodes(); n.set_publickey(toBase58(TokenType::NodePublic, node.identity())); n.set_reporttime(node.getReportTime().time_since_epoch().count()); @@ -1036,14 +1039,14 @@ NetworkOPsImp::processClusterTimer() n.set_nodename(node.name()); }); - Resource::Gossip gossip = app_.getResourceManager().exportConsumers(); + Resource::Gossip gossip = registry_.getResourceManager().exportConsumers(); for (auto& item : gossip.items) { protocol::TMLoadSource& node = *cluster.add_loadsources(); node.set_name(to_string(item.address)); node.set_cost(item.balance); } - app_.overlay().foreach(send_if(std::make_shared(cluster, protocol::mtCLUSTER), peer_in_cluster())); + registry_.overlay().foreach(send_if(std::make_shared(cluster, protocol::mtCLUSTER), peer_in_cluster())); setClusterTimer(); } @@ -1088,7 +1091,7 @@ NetworkOPsImp::submitTransaction(std::shared_ptr const& iTrans) auto const trans = sterilize(*iTrans); auto const txid = trans->getTransactionID(); - auto const flags = app_.getHashRouter().getFlags(txid); + auto const flags = registry_.getHashRouter().getFlags(txid); if ((flags & HashRouterFlags::BAD) != HashRouterFlags::UNDEFINED) { @@ -1098,8 +1101,8 @@ NetworkOPsImp::submitTransaction(std::shared_ptr const& iTrans) try { - auto const [validity, reason] = - checkValidity(app_.getHashRouter(), *trans, m_ledgerMaster.getValidatedRules(), app_.config()); + auto const [validity, reason] = checkValidity( + registry_.getHashRouter(), *trans, m_ledgerMaster.getValidatedRules(), registry_.app().config()); if (validity != Validity::Valid) { @@ -1116,7 +1119,7 @@ NetworkOPsImp::submitTransaction(std::shared_ptr const& iTrans) std::string reason; - auto tx = std::make_shared(trans, reason, app_); + auto tx = std::make_shared(trans, reason, registry_.app()); m_job_queue.addJob(jtTRANSACTION, "SubmitTxn", [this, tx]() { auto t = tx; @@ -1127,7 +1130,7 @@ NetworkOPsImp::submitTransaction(std::shared_ptr const& iTrans) bool NetworkOPsImp::preProcessTransaction(std::shared_ptr& transaction) { - auto const newFlags = app_.getHashRouter().getFlags(transaction->getID()); + auto const newFlags = registry_.getHashRouter().getFlags(transaction->getID()); if ((newFlags & HashRouterFlags::BAD) != HashRouterFlags::UNDEFINED) { @@ -1148,14 +1151,15 @@ NetworkOPsImp::preProcessTransaction(std::shared_ptr& transaction) { transaction->setStatus(INVALID); transaction->setResult(temINVALID_FLAG); - app_.getHashRouter().setFlags(transaction->getID(), HashRouterFlags::BAD); + registry_.getHashRouter().setFlags(transaction->getID(), HashRouterFlags::BAD); return false; } // NOTE ximinez - I think this check is redundant, // but I'm not 100% sure yet. // If so, only cost is looking up HashRouter flags. - auto const [validity, reason] = checkValidity(app_.getHashRouter(), sttx, view->rules(), app_.config()); + auto const [validity, reason] = + checkValidity(registry_.getHashRouter(), sttx, view->rules(), registry_.app().config()); XRPL_ASSERT(validity == Validity::Valid, "xrpl::NetworkOPsImp::processTransaction : valid validity"); // Not concerned with local checks at this point. @@ -1164,12 +1168,12 @@ NetworkOPsImp::preProcessTransaction(std::shared_ptr& transaction) JLOG(m_journal.info()) << "Transaction has bad signature: " << reason; transaction->setStatus(INVALID); transaction->setResult(temBAD_SIGNATURE); - app_.getHashRouter().setFlags(transaction->getID(), HashRouterFlags::BAD); + registry_.getHashRouter().setFlags(transaction->getID(), HashRouterFlags::BAD); return false; } // canonicalize can change our pointer - app_.getMasterTransaction().canonicalize(&transaction); + registry_.getMasterTransaction().canonicalize(&transaction); return true; } @@ -1265,7 +1269,7 @@ NetworkOPsImp::processTransactionSet(CanonicalTXSet const& set) for (auto const& [_, tx] : set) { std::string reason; - auto transaction = std::make_shared(tx, reason, app_); + auto transaction = std::make_shared(tx, reason, registry_.app()); if (transaction->getStatus() == INVALID) { @@ -1273,7 +1277,7 @@ NetworkOPsImp::processTransactionSet(CanonicalTXSet const& set) { JLOG(m_journal.trace()) << "Exception checking transaction: " << reason; } - app_.getHashRouter().setFlags(tx->getTransactionID(), HashRouterFlags::BAD); + registry_.getHashRouter().setFlags(tx->getTransactionID(), HashRouterFlags::BAD); continue; } @@ -1347,13 +1351,13 @@ NetworkOPsImp::apply(std::unique_lock& batchLock) batchLock.unlock(); { - std::unique_lock masterLock{app_.getMasterMutex(), std::defer_lock}; + std::unique_lock masterLock{registry_.app().getMasterMutex(), std::defer_lock}; bool changed = false; { std::unique_lock ledgerLock{m_ledgerMaster.peekMutex(), std::defer_lock}; std::lock(masterLock, ledgerLock); - app_.openLedger().modify([&](OpenView& view, beast::Journal j) { + registry_.openLedger().modify([&](OpenView& view, beast::Journal j) { for (TransactionStatus& e : transactions) { // we check before adding to the batch @@ -1364,7 +1368,8 @@ NetworkOPsImp::apply(std::unique_lock& batchLock) if (e.failType == FailHard::yes) flags |= tapFAIL_HARD; - auto const result = app_.getTxQ().apply(app_, view, e.transaction->getSTransaction(), flags, j); + auto const result = + registry_.getTxQ().apply(registry_.app(), view, e.transaction->getSTransaction(), flags, j); e.result = result.ter; e.applied = result.applied; changed = changed || result.applied; @@ -1379,7 +1384,7 @@ NetworkOPsImp::apply(std::unique_lock& batchLock) if (auto const l = m_ledgerMaster.getValidatedLedger()) validatedLedgerIndex = l->header().seq; - auto newOL = app_.openLedger().current(); + auto newOL = registry_.openLedger().current(); for (TransactionStatus& e : transactions) { e.transaction->clearSubmitResult(); @@ -1393,7 +1398,7 @@ NetworkOPsImp::apply(std::unique_lock& batchLock) e.transaction->setResult(e.result); if (isTemMalformed(e.result)) - app_.getHashRouter().setFlags(e.transaction->getID(), HashRouterFlags::BAD); + registry_.getHashRouter().setFlags(e.transaction->getID(), HashRouterFlags::BAD); #ifdef DEBUG if (e.result != tesSUCCESS) @@ -1427,7 +1432,7 @@ NetworkOPsImp::apply(std::unique_lock& batchLock) batchLock.lock(); std::string reason; auto const trans = sterilize(*txNext); - auto t = std::make_shared(trans, reason, app_); + auto t = std::make_shared(trans, reason, registry_.app()); if (t->getApplying()) break; submit_held.emplace_back(t, false, false, FailHard::no); @@ -1479,7 +1484,7 @@ NetworkOPsImp::apply(std::unique_lock& batchLock) // up!) // if (e.local || (ledgersLeft && ledgersLeft <= LocalTxs::holdLedgers) || - app_.getHashRouter().setFlags(e.transaction->getID(), HashRouterFlags::HELD)) + registry_.getHashRouter().setFlags(e.transaction->getID(), HashRouterFlags::HELD)) { // transaction should be held JLOG(m_journal.debug()) << "Transaction should be held: " << e.result; @@ -1513,7 +1518,7 @@ NetworkOPsImp::apply(std::unique_lock& batchLock) (e.result == terQUEUED)) && !enforceFailHard) { - auto const toSkip = app_.getHashRouter().shouldRelay(e.transaction->getID()); + auto const toSkip = registry_.getHashRouter().shouldRelay(e.transaction->getID()); if (auto const sttx = *(e.transaction->getSTransaction()); toSkip && // Skip relaying if it's an inner batch txn. The flag should // only be set if the Batch feature is enabled. If Batch is @@ -1527,10 +1532,10 @@ NetworkOPsImp::apply(std::unique_lock& batchLock) sttx.add(s); tx.set_rawtransaction(s.data(), s.size()); tx.set_status(protocol::tsCURRENT); - tx.set_receivetimestamp(app_.timeKeeper().now().time_since_epoch().count()); + tx.set_receivetimestamp(registry_.timeKeeper().now().time_since_epoch().count()); tx.set_deferred(e.result == terQUEUED); // FIXME: This should be when we received it - app_.overlay().relay(e.transaction->getID(), tx, *toSkip); + registry_.overlay().relay(e.transaction->getID(), tx, *toSkip); e.transaction->setBroadcast(); } } @@ -1538,7 +1543,7 @@ NetworkOPsImp::apply(std::unique_lock& batchLock) if (validatedLedgerIndex) { auto [fee, accountSeq, availableSeq] = - app_.getTxQ().getTxRequiredFeeAndSeq(*newOL, e.transaction->getSTransaction()); + registry_.getTxQ().getTxRequiredFeeAndSeq(*newOL, e.transaction->getSTransaction()); e.transaction->setCurrentLedgerState(*validatedLedgerIndex, fee, accountSeq, availableSeq); } } @@ -1713,7 +1718,7 @@ NetworkOPsImp::checkLastClosedLedger(Overlay::PeerSequence const& peerList, uint //------------------------------------------------------------------------- // Determine preferred last closed ledger - auto& validations = app_.getValidations(); + auto& validations = registry_.getValidations(); JLOG(m_journal.debug()) << "ValidationTrie " << Json::Compact(validations.getJsonTrie()); // Will rely on peer LCL if no trusted validations exist @@ -1758,7 +1763,7 @@ NetworkOPsImp::checkLastClosedLedger(Overlay::PeerSequence const& peerList, uint auto consensus = m_ledgerMaster.getLedgerByHash(closedLedger); if (!consensus) - consensus = app_.getInboundLedgers().acquire(closedLedger, 0, InboundLedger::Reason::CONSENSUS); + consensus = registry_.getInboundLedgers().acquire(closedLedger, 0, InboundLedger::Reason::CONSENSUS); if (consensus && (!m_ledgerMaster.canBeCurrent(consensus) || @@ -1799,7 +1804,7 @@ NetworkOPsImp::switchLastClosedLedger(std::shared_ptr const& newLC clearNeedNetworkLedger(); // Update fee computations. - app_.getTxQ().processClosedLedger(app_, *newLCL, true); + registry_.getTxQ().processClosedLedger(registry_.app(), *newLCL, true); // Caller must own master lock { @@ -1807,14 +1812,14 @@ NetworkOPsImp::switchLastClosedLedger(std::shared_ptr const& newLC // open ledger. Then apply local tx. auto retries = m_localTX->getTxSet(); - auto const lastVal = app_.getLedgerMaster().getValidatedLedger(); + auto const lastVal = registry_.getLedgerMaster().getValidatedLedger(); std::optional rules; if (lastVal) - rules = makeRulesGivenLedger(*lastVal, app_.config().features); + rules = makeRulesGivenLedger(*lastVal, registry_.app().config().features); else - rules.emplace(app_.config().features); - app_.openLedger().accept( - app_, + rules.emplace(registry_.app().config().features); + registry_.openLedger().accept( + registry_.app(), *rules, newLCL, OrderedTxs({}), @@ -1824,7 +1829,7 @@ NetworkOPsImp::switchLastClosedLedger(std::shared_ptr const& newLC "jump", [&](OpenView& view, beast::Journal j) { // Stuff the ledger with transactions from the queue. - return app_.getTxQ().accept(app_, view); + return registry_.getTxQ().accept(registry_.app(), view); }); } @@ -1833,11 +1838,11 @@ NetworkOPsImp::switchLastClosedLedger(std::shared_ptr const& newLC protocol::TMStatusChange s; s.set_newevent(protocol::neSWITCHED_LEDGER); s.set_ledgerseq(newLCL->header().seq); - s.set_networktime(app_.timeKeeper().now().time_since_epoch().count()); + s.set_networktime(registry_.timeKeeper().now().time_since_epoch().count()); s.set_ledgerhashprevious(newLCL->header().parentHash.begin(), newLCL->header().parentHash.size()); s.set_ledgerhash(newLCL->header().hash.begin(), newLCL->header().hash.size()); - app_.overlay().foreach(send_always(std::make_shared(s, protocol::mtSTATUS_CHANGE))); + registry_.overlay().foreach(send_always(std::make_shared(s, protocol::mtSTATUS_CHANGE))); } bool @@ -1874,23 +1879,23 @@ NetworkOPsImp::beginConsensus(uint256 const& networkClosed, std::unique_ptrnegativeUNL()); - TrustChanges const changes = app_.validators().updateTrusted( - app_.getValidations().getCurrentNodeIDs(), + registry_.validators().setNegativeUNL(prevLedger->negativeUNL()); + TrustChanges const changes = registry_.validators().updateTrusted( + registry_.getValidations().getCurrentNodeIDs(), closingInfo.parentCloseTime, *this, - app_.overlay(), - app_.getHashRouter()); + registry_.overlay(), + registry_.getHashRouter()); if (!changes.added.empty() || !changes.removed.empty()) { - app_.getValidations().trustChanged(changes.added, changes.removed); + registry_.getValidations().trustChanged(changes.added, changes.removed); // Update the AmendmentTable so it tracks the current validators. - app_.getAmendmentTable().trustChanged(app_.validators().getQuorumKeys().second); + registry_.getAmendmentTable().trustChanged(registry_.validators().getQuorumKeys().second); } mConsensus.startRound( - app_.timeKeeper().closeTime(), networkClosed, prevLedger, changes.removed, changes.added, clog); + registry_.timeKeeper().closeTime(), networkClosed, prevLedger, changes.removed, changes.added, clog); ConsensusPhase const currPhase = mConsensus.phase(); if (mLastConsensusPhase != currPhase) @@ -1925,7 +1930,7 @@ NetworkOPsImp::processTrustedProposal(RCLCxPeerPos peerPos) return false; } - return mConsensus.peerProposal(app_.timeKeeper().closeTime(), peerPos); + return mConsensus.peerProposal(registry_.timeKeeper().closeTime(), peerPos); } void @@ -1939,11 +1944,11 @@ NetworkOPsImp::mapComplete(std::shared_ptr const& map, bool fromAcquire) protocol::TMHaveTransactionSet msg; msg.set_hash(map->getHash().as_uint256().begin(), 256 / 8); msg.set_status(protocol::tsHAVE); - app_.overlay().foreach(send_always(std::make_shared(msg, protocol::mtHAVE_SET))); + registry_.overlay().foreach(send_always(std::make_shared(msg, protocol::mtHAVE_SET))); // We acquired it because consensus asked us to if (fromAcquire) - mConsensus.gotTxSet(app_.timeKeeper().closeTime(), RCLTxSet{map}); + mConsensus.gotTxSet(registry_.timeKeeper().closeTime(), RCLTxSet{map}); } void @@ -1951,7 +1956,7 @@ NetworkOPsImp::endConsensus(std::unique_ptr const& clog) { uint256 deadLedger = m_ledgerMaster.getClosedLedger()->header().parentHash; - for (auto const& it : app_.overlay().getActivePeers()) + for (auto const& it : registry_.overlay().getActivePeers()) { if (it && (it->getClosedLedgerHash() == deadLedger)) { @@ -1961,7 +1966,7 @@ NetworkOPsImp::endConsensus(std::unique_ptr const& clog) } uint256 networkClosed; - bool ledgerChange = checkLastClosedLedger(app_.overlay().getActivePeers(), networkClosed); + bool ledgerChange = checkLastClosedLedger(registry_.overlay().getActivePeers(), networkClosed); if (networkClosed.isZero()) { @@ -1990,7 +1995,8 @@ NetworkOPsImp::endConsensus(std::unique_ptr const& clog) // Note: Do not go to FULL if we don't have the previous ledger // check if the ledger is bad enough to go to CONNECTED -- TODO auto current = m_ledgerMaster.getCurrentLedger(); - if (app_.timeKeeper().now() < (current->header().parentCloseTime + 2 * current->header().closeTimeResolution)) + if (registry_.timeKeeper().now() < + (current->header().parentCloseTime + 2 * current->header().closeTimeResolution)) { setMode(OperatingMode::FULL); } @@ -2096,9 +2102,9 @@ NetworkOPsImp::pubServer() Json::Value jvObj(Json::objectValue); ServerFeeSummary f{ - app_.openLedger().current()->fees().base, - app_.getTxQ().getMetrics(*app_.openLedger().current()), - app_.getFeeTrack()}; + registry_.openLedger().current()->fees().base, + registry_.getTxQ().getMetrics(*registry_.openLedger().current()), + registry_.getFeeTrack()}; jvObj[jss::type] = "serverStatus"; jvObj[jss::server_status] = strOperatingMode(); @@ -2189,7 +2195,7 @@ NetworkOPsImp::pubValidation(std::shared_ptr const& val) jvObj[jss::flags] = val->getFlags(); jvObj[jss::signing_time] = *(*val)[~sfSigningTime]; jvObj[jss::data] = strHex(val->getSerializer().slice()); - jvObj[jss::network_id] = app_.config().NETWORK_ID; + jvObj[jss::network_id] = registry_.app().config().NETWORK_ID; if (auto version = (*val)[~sfServerVersion]) jvObj[jss::server_version] = std::to_string(*version); @@ -2200,7 +2206,7 @@ NetworkOPsImp::pubValidation(std::shared_ptr const& val) if (auto hash = (*val)[~sfValidatedHash]) jvObj[jss::validated_hash] = strHex(*hash); - auto const masterKey = app_.validatorManifests().getMasterKey(signerPublic); + auto const masterKey = registry_.validatorManifests().getMasterKey(signerPublic); if (masterKey != signerPublic) jvObj[jss::master_key] = toBase58(TokenType::NodePublic, masterKey); @@ -2307,12 +2313,12 @@ NetworkOPsImp::setMode(OperatingMode om) using namespace std::chrono_literals; if (om == OperatingMode::CONNECTED) { - if (app_.getLedgerMaster().getValidatedLedgerAge() < 1min) + if (registry_.getLedgerMaster().getValidatedLedgerAge() < 1min) om = OperatingMode::SYNCING; } else if (om == OperatingMode::SYNCING) { - if (app_.getLedgerMaster().getValidatedLedgerAge() >= 1min) + if (registry_.getLedgerMaster().getValidatedLedgerAge() >= 1min) om = OperatingMode::CONNECTED; } @@ -2344,7 +2350,7 @@ NetworkOPsImp::recvValidation(std::shared_ptr const& val, std::str else pendingValidations_.insert(val->getLedgerHash()); scope_unlock unlock(lock); - handleNewValidation(app_, val, source, bypassAccept, m_journal); + handleNewValidation(registry_.app(), val, source, bypassAccept, m_journal); } catch (std::exception const& e) { @@ -2366,7 +2372,7 @@ NetworkOPsImp::recvValidation(std::shared_ptr const& val, std::str JLOG(m_journal.debug()) << [this, &val]() -> auto { std::stringstream ss; ss << "VALIDATION: " << val->render() << " master_key: "; - auto master = app_.validators().getTrustedKey(val->getSignerPublic()); + auto master = registry_.validators().getTrustedKey(val->getSignerPublic()); if (master) { ss << toBase58(TokenType::NodePublic, *master); @@ -2380,7 +2386,7 @@ NetworkOPsImp::recvValidation(std::shared_ptr const& val, std::str // We will always relay trusted validations; if configured, we will // also relay all untrusted validations. - return app_.config().RELAY_UNTRUSTED_VALIDATIONS == 1 || val->isTrusted(); + return registry_.app().config().RELAY_UNTRUSTED_VALIDATIONS == 1 || val->isTrusted(); } Json::Value @@ -2422,7 +2428,7 @@ NetworkOPsImp::getServerInfo(bool human, bool admin, bool counters) "One or more unsupported amendments have reached majority. " "Upgrade to the latest version before they are activated " "to avoid being amendment blocked."; - if (auto const expected = app_.getAmendmentTable().firstUnsupportedExpected()) + if (auto const expected = registry_.getAmendmentTable().firstUnsupportedExpected()) { auto& d = w[jss::details] = Json::objectValue; d[jss::expected_date] = expected->time_since_epoch().count(); @@ -2439,8 +2445,8 @@ NetworkOPsImp::getServerInfo(bool human, bool admin, bool counters) info[jss::hostid] = getHostId(admin); // domain: if configured with a domain, report it: - if (!app_.config().SERVER_DOMAIN.empty()) - info[jss::server_domain] = app_.config().SERVER_DOMAIN; + if (!registry_.app().config().SERVER_DOMAIN.empty()) + info[jss::server_domain] = registry_.app().config().SERVER_DOMAIN; info[jss::build_version] = BuildInfo::getVersionString(); @@ -2451,11 +2457,11 @@ NetworkOPsImp::getServerInfo(bool human, bool admin, bool counters) if (needNetworkLedger_) info[jss::network_ledger] = "waiting"; - info[jss::validation_quorum] = static_cast(app_.validators().quorum()); + info[jss::validation_quorum] = static_cast(registry_.validators().quorum()); if (admin) { - switch (app_.config().NODE_SIZE) + switch (registry_.app().config().NODE_SIZE) { case 0: info[jss::node_size] = "tiny"; @@ -2474,7 +2480,7 @@ NetworkOPsImp::getServerInfo(bool human, bool admin, bool counters) break; } - auto when = app_.validators().expires(); + auto when = registry_.validators().expires(); if (!human) { @@ -2487,7 +2493,7 @@ NetworkOPsImp::getServerInfo(bool human, bool admin, bool counters) { auto& x = (info[jss::validator_list] = Json::objectValue); - x[jss::count] = static_cast(app_.validators().count()); + x[jss::count] = static_cast(registry_.validators().count()); if (when) { @@ -2500,7 +2506,7 @@ NetworkOPsImp::getServerInfo(bool human, bool admin, bool counters) { x[jss::expiration] = to_string(*when); - if (*when > app_.timeKeeper().now()) + if (*when > registry_.timeKeeper().now()) x[jss::status] = "active"; else x[jss::status] = "expired"; @@ -2525,11 +2531,12 @@ NetworkOPsImp::getServerInfo(bool human, bool admin, bool counters) } #endif } - info[jss::io_latency_ms] = static_cast(app_.getIOLatency().count()); + info[jss::io_latency_ms] = static_cast(registry_.app().getIOLatency().count()); if (admin) { - if (auto const localPubKey = app_.validators().localPublicKey(); localPubKey && app_.getValidationPublicKey()) + if (auto const localPubKey = registry_.validators().localPublicKey(); + localPubKey && registry_.app().getValidationPublicKey()) { info[jss::pubkey_validator] = toBase58(TokenType::NodePublic, localPubKey.value()); } @@ -2541,17 +2548,17 @@ NetworkOPsImp::getServerInfo(bool human, bool admin, bool counters) if (counters) { - info[jss::counters] = app_.getPerfLog().countersJson(); + info[jss::counters] = registry_.getPerfLog().countersJson(); Json::Value nodestore(Json::objectValue); - app_.getNodeStore().getCountsJson(nodestore); + registry_.getNodeStore().getCountsJson(nodestore); info[jss::counters][jss::nodestore] = nodestore; - info[jss::current_activities] = app_.getPerfLog().currentJson(); + info[jss::current_activities] = registry_.getPerfLog().currentJson(); } - info[jss::pubkey_node] = toBase58(TokenType::NodePublic, app_.nodeIdentity().first); + info[jss::pubkey_node] = toBase58(TokenType::NodePublic, registry_.app().nodeIdentity().first); - info[jss::complete_ledgers] = app_.getLedgerMaster().getCompleteLedgers(); + info[jss::complete_ledgers] = registry_.getLedgerMaster().getCompleteLedgers(); if (amendmentBlocked_) info[jss::amendment_blocked] = true; @@ -2561,7 +2568,7 @@ NetworkOPsImp::getServerInfo(bool human, bool admin, bool counters) if (fp != 0) info[jss::fetch_pack] = Json::UInt(fp); - info[jss::peers] = Json::UInt(app_.overlay().size()); + info[jss::peers] = Json::UInt(registry_.overlay().size()); Json::Value lastClose = Json::objectValue; lastClose[jss::proposers] = Json::UInt(mConsensus.prevProposers()); @@ -2582,13 +2589,13 @@ NetworkOPsImp::getServerInfo(bool human, bool admin, bool counters) if (admin) info[jss::load] = m_job_queue.getJson(); - if (auto const netid = app_.overlay().networkID()) + if (auto const netid = registry_.overlay().networkID()) info[jss::network_id] = static_cast(*netid); - auto const escalationMetrics = app_.getTxQ().getMetrics(*app_.openLedger().current()); + auto const escalationMetrics = registry_.getTxQ().getMetrics(*registry_.openLedger().current()); - auto const loadFactorServer = app_.getFeeTrack().getLoadFactor(); - auto const loadBaseServer = app_.getFeeTrack().getLoadBase(); + auto const loadFactorServer = registry_.getFeeTrack().getLoadFactor(); + auto const loadBaseServer = registry_.getFeeTrack().getLoadBase(); /* Scale the escalated fee level to unitless "load factor". In practice, this just strips the units, but it will continue to work correctly if either base value ever changes. */ @@ -2622,13 +2629,13 @@ NetworkOPsImp::getServerInfo(bool human, bool admin, bool counters) if (admin) { - std::uint32_t fee = app_.getFeeTrack().getLocalFee(); + std::uint32_t fee = registry_.getFeeTrack().getLocalFee(); if (fee != loadBaseServer) info[jss::load_factor_local] = static_cast(fee) / loadBaseServer; - fee = app_.getFeeTrack().getRemoteFee(); + fee = registry_.getFeeTrack().getRemoteFee(); if (fee != loadBaseServer) info[jss::load_factor_net] = static_cast(fee) / loadBaseServer; - fee = app_.getFeeTrack().getClusterFee(); + fee = registry_.getFeeTrack().getClusterFee(); if (fee != loadBaseServer) info[jss::load_factor_cluster] = static_cast(fee) / loadBaseServer; } @@ -2669,7 +2676,7 @@ NetworkOPsImp::getServerInfo(bool human, bool admin, bool counters) l[jss::reserve_base_xrp] = lpClosed->fees().reserve.decimalXRP(); l[jss::reserve_inc_xrp] = lpClosed->fees().increment.decimalXRP(); - if (auto const closeOffset = app_.timeKeeper().closeOffset(); std::abs(closeOffset.count()) >= 60) + if (auto const closeOffset = registry_.timeKeeper().closeOffset(); std::abs(closeOffset.count()) >= 60) l[jss::close_time_offset] = static_cast(closeOffset.count()); constexpr std::chrono::seconds highAgeThreshold{1000000}; @@ -2681,7 +2688,7 @@ NetworkOPsImp::getServerInfo(bool human, bool admin, bool counters) else { auto lCloseTime = lpClosed->header().closeTime; - auto closeTime = app_.timeKeeper().closeTime(); + auto closeTime = registry_.timeKeeper().closeTime(); if (lCloseTime <= closeTime) { using namespace std::chrono_literals; @@ -2705,16 +2712,16 @@ NetworkOPsImp::getServerInfo(bool human, bool admin, bool counters) accounting_.json(info); info[jss::uptime] = UptimeClock::now().time_since_epoch().count(); - info[jss::jq_trans_overflow] = std::to_string(app_.overlay().getJqTransOverflow()); - info[jss::peer_disconnects] = std::to_string(app_.overlay().getPeerDisconnect()); - info[jss::peer_disconnects_resources] = std::to_string(app_.overlay().getPeerDisconnectCharges()); + info[jss::jq_trans_overflow] = std::to_string(registry_.overlay().getJqTransOverflow()); + info[jss::peer_disconnects] = std::to_string(registry_.overlay().getPeerDisconnect()); + info[jss::peer_disconnects_resources] = std::to_string(registry_.overlay().getPeerDisconnectCharges()); // This array must be sorted in increasing order. static constexpr std::array protocols{"http", "https", "peer", "ws", "ws2", "wss", "wss2"}; static_assert(std::is_sorted(std::begin(protocols), std::end(protocols))); { Json::Value ports{Json::arrayValue}; - for (auto const& port : app_.getServerHandler().setup().ports) + for (auto const& port : registry_.getServerHandler().setup().ports) { // Don't publish admin ports for non-admin users if (!admin && @@ -2738,9 +2745,9 @@ NetworkOPsImp::getServerInfo(bool human, bool admin, bool counters) } } - if (app_.config().exists(SECTION_PORT_GRPC)) + if (registry_.app().config().exists(SECTION_PORT_GRPC)) { - auto const& grpcSection = app_.config().section(SECTION_PORT_GRPC); + auto const& grpcSection = registry_.app().config().section(SECTION_PORT_GRPC); auto const optPort = grpcSection.get("port"); if (optPort && grpcSection.get("ip")) { @@ -2759,13 +2766,13 @@ NetworkOPsImp::getServerInfo(bool human, bool admin, bool counters) void NetworkOPsImp::clearLedgerFetch() { - app_.getInboundLedgers().clearFailures(); + registry_.getInboundLedgers().clearFailures(); } Json::Value NetworkOPsImp::getLedgerFetchInfo() { - return app_.getInboundLedgers().getInfo(); + return registry_.getInboundLedgers().getInfo(); } void @@ -2814,11 +2821,11 @@ NetworkOPsImp::pubLedger(std::shared_ptr const& lpAccepted) // Ledgers are published only when they acquire sufficient validations // Holes are filled across connection loss or other catastrophe - std::shared_ptr alpAccepted = app_.getAcceptedLedgerCache().fetch(lpAccepted->header().hash); + std::shared_ptr alpAccepted = registry_.getAcceptedLedgerCache().fetch(lpAccepted->header().hash); if (!alpAccepted) { - alpAccepted = std::make_shared(lpAccepted, app_); - app_.getAcceptedLedgerCache().canonicalize_replace_client(lpAccepted->header().hash, alpAccepted); + alpAccepted = std::make_shared(lpAccepted, registry_.app()); + registry_.getAcceptedLedgerCache().canonicalize_replace_client(lpAccepted->header().hash, alpAccepted); } XRPL_ASSERT(alpAccepted->getLedger().get() == lpAccepted.get(), "xrpl::NetworkOPsImp::pubLedger : accepted input"); @@ -2837,7 +2844,7 @@ NetworkOPsImp::pubLedger(std::shared_ptr const& lpAccepted) jvObj[jss::ledger_hash] = to_string(lpAccepted->header().hash); jvObj[jss::ledger_time] = Json::Value::UInt(lpAccepted->header().closeTime.time_since_epoch().count()); - jvObj[jss::network_id] = app_.config().NETWORK_ID; + jvObj[jss::network_id] = registry_.app().config().NETWORK_ID; if (!lpAccepted->rules().enabled(featureXRPFees)) jvObj[jss::fee_ref] = Config::FEE_UNITS_DEPRECATED; @@ -2849,7 +2856,7 @@ NetworkOPsImp::pubLedger(std::shared_ptr const& lpAccepted) if (mMode >= OperatingMode::SYNCING) { - jvObj[jss::validated_ledgers] = app_.getLedgerMaster().getCompleteLedgers(); + jvObj[jss::validated_ledgers] = registry_.getLedgerMaster().getCompleteLedgers(); } auto it = mStreamMaps[sLedger].begin(); @@ -2917,9 +2924,9 @@ void NetworkOPsImp::reportFeeChange() { ServerFeeSummary f{ - app_.openLedger().current()->fees().base, - app_.getTxQ().getMetrics(*app_.openLedger().current()), - app_.getFeeTrack()}; + registry_.openLedger().current()->fees().base, + registry_.getTxQ().getMetrics(*registry_.openLedger().current()), + registry_.getFeeTrack()}; // only schedule the job if something has changed if (f != mLastFeeSummary) @@ -2980,7 +2987,7 @@ NetworkOPsImp::transJson( lookup.second && lookup.second->isFieldPresent(sfTransactionIndex)) { uint32_t const txnSeq = lookup.second->getFieldU32(sfTransactionIndex); - uint32_t netID = app_.config().NETWORK_ID; + uint32_t netID = registry_.app().config().NETWORK_ID; if (transaction->isFieldPresent(sfNetworkID)) netID = transaction->getFieldU32(sfNetworkID); @@ -3018,7 +3025,7 @@ NetworkOPsImp::transJson( // If the offer create is not self funded then add the owner balance if (account != amount.issue().account) { - auto const ownerFunds = accountFunds(*ledger, account, amount, fhIGNORE_FREEZE, app_.journal("View")); + auto const ownerFunds = accountFunds(*ledger, account, amount, fhIGNORE_FREEZE, registry_.journal("View")); jvObj[jss::transaction][jss::owner_funds] = ownerFunds.getText(); } } @@ -3095,7 +3102,7 @@ NetworkOPsImp::pubValidatedTransaction( } if (transaction.getResult() == tesSUCCESS) - app_.getOrderBookDB().processTxn(ledger, transaction, jvObj); + registry_.getOrderBookDB().processTxn(ledger, transaction, jvObj); pubAccountTransaction(ledger, transaction, last); } @@ -3381,7 +3388,7 @@ NetworkOPsImp::addAccountHistoryJob(SubAccountHistoryInfoWeak subInfo) static auto const databaseType = [&]() -> DatabaseType { // Use a dynamic_cast to return DatabaseType::None // on failure. - if (dynamic_cast(&app_.getRelationalDatabase())) + if (dynamic_cast(®istry_.getRelationalDatabase())) { return DatabaseType::Sqlite; } @@ -3403,7 +3410,7 @@ NetworkOPsImp::addAccountHistoryJob(SubAccountHistoryInfoWeak subInfo) // LCOV_EXCL_STOP } - app_.getJobQueue().addJob(jtCLIENT_ACCT_HIST, "HistTxStream", [this, dbType = databaseType, subInfo]() { + registry_.getJobQueue().addJob(jtCLIENT_ACCT_HIST, "HistTxStream", [this, dbType = databaseType, subInfo]() { auto const& accountId = subInfo.index_->accountId_; auto& lastLedgerSeq = subInfo.index_->historyLastLedgerSeq_; auto& txHistoryIndex = subInfo.index_->historyTxIndex_; @@ -3478,7 +3485,7 @@ NetworkOPsImp::addAccountHistoryJob(SubAccountHistoryInfoWeak subInfo) switch (dbType) { case Sqlite: { - auto db = static_cast(&app_.getRelationalDatabase()); + auto db = static_cast(®istry_.getRelationalDatabase()); RelationalDatabase::AccountTxPageOptions options{accountId, minLedger, maxLedger, marker, 0, true}; return db->newestAccountTxPage(options); } @@ -3519,7 +3526,8 @@ NetworkOPsImp::addAccountHistoryJob(SubAccountHistoryInfoWeak subInfo) auto haveRange = [&]() -> bool { std::uint32_t validatedMin = UINT_MAX; std::uint32_t validatedMax = 0; - auto haveSomeValidatedLedgers = app_.getLedgerMaster().getValidatedRange(validatedMin, validatedMax); + auto haveSomeValidatedLedgers = + registry_.getLedgerMaster().getValidatedRange(validatedMin, validatedMax); return haveSomeValidatedLedgers && validatedMin <= startLedgerSeq && lastLedgerSeq <= validatedMax; }(); @@ -3564,7 +3572,7 @@ NetworkOPsImp::addAccountHistoryJob(SubAccountHistoryInfoWeak subInfo) send(rpcError(rpcINTERNAL), true); return; } - auto curTxLedger = app_.getLedgerMaster().getLedgerBySeq(tx->getLedger()); + auto curTxLedger = registry_.getLedgerMaster().getLedgerBySeq(tx->getLedger()); if (!curTxLedger) { // LCOV_EXCL_START @@ -3704,7 +3712,7 @@ NetworkOPsImp::subAccountHistory(InfoSub::ref isrListener, AccountID const& acco simIterator->second.emplace(isrListener->getSeq(), ahi); } - auto const ledger = app_.getLedgerMaster().getValidatedLedger(); + auto const ledger = registry_.getLedgerMaster().getValidatedLedger(); if (ledger) { subAccountHistoryStart(ledger, ahi); @@ -3758,7 +3766,7 @@ NetworkOPsImp::unsubAccountHistoryInternal(std::uint64_t seq, AccountID const& a bool NetworkOPsImp::subBook(InfoSub::ref isrListener, Book const& book) { - if (auto listeners = app_.getOrderBookDB().makeBookListeners(book)) + if (auto listeners = registry_.getOrderBookDB().makeBookListeners(book)) listeners->addSubscriber(isrListener); else { @@ -3772,7 +3780,7 @@ NetworkOPsImp::subBook(InfoSub::ref isrListener, Book const& book) bool NetworkOPsImp::unsubBook(std::uint64_t uSeq, Book const& book) { - if (auto listeners = app_.getOrderBookDB().getBookListeners(book)) + if (auto listeners = registry_.getOrderBookDB().getBookListeners(book)) listeners->removeSubscriber(uSeq); return true; @@ -3791,7 +3799,7 @@ NetworkOPsImp::acceptLedger(std::optional consensusDe // FIXME Could we improve on this and remove the need for a specialized // API in Consensus? beginConsensus(m_ledgerMaster.getClosedLedger()->header().hash, {}); - mConsensus.simulate(app_.timeKeeper().closeTime(), consensusDelay); + mConsensus.simulate(registry_.timeKeeper().closeTime(), consensusDelay); return m_ledgerMaster.getCurrentLedger()->header().seq; } @@ -3809,12 +3817,12 @@ NetworkOPsImp::subLedger(InfoSub::ref isrListener, Json::Value& jvResult) jvResult[jss::fee_base] = lpClosed->fees().base.jsonClipped(); jvResult[jss::reserve_base] = lpClosed->fees().reserve.jsonClipped(); jvResult[jss::reserve_inc] = lpClosed->fees().increment.jsonClipped(); - jvResult[jss::network_id] = app_.config().NETWORK_ID; + jvResult[jss::network_id] = registry_.app().config().NETWORK_ID; } if ((mMode >= OperatingMode::SYNCING) && !isNeedNetworkLedger()) { - jvResult[jss::validated_ledgers] = app_.getLedgerMaster().getCompleteLedgers(); + jvResult[jss::validated_ledgers] = registry_.getLedgerMaster().getCompleteLedgers(); } std::lock_guard sl(mSubLock); @@ -3873,13 +3881,13 @@ NetworkOPsImp::subServer(InfoSub::ref isrListener, Json::Value& jvResult, bool a // CHECKME: is it necessary to provide a random number here? beast::rngfill(uRandom.begin(), uRandom.size(), crypto_prng()); - auto const& feeTrack = app_.getFeeTrack(); + auto const& feeTrack = registry_.getFeeTrack(); jvResult[jss::random] = to_string(uRandom); jvResult[jss::server_status] = strOperatingMode(admin); jvResult[jss::load_base] = feeTrack.getLoadBase(); jvResult[jss::load_factor] = feeTrack.getLoadFactor(); jvResult[jss::hostid] = getHostId(admin); - jvResult[jss::pubkey_node] = toBase58(TokenType::NodePublic, app_.nodeIdentity().first); + jvResult[jss::pubkey_node] = toBase58(TokenType::NodePublic, registry_.app().nodeIdentity().first); std::lock_guard sl(mSubLock); return mStreamMaps[sServer].emplace(isrListener->getSeq(), isrListener).second; @@ -4065,7 +4073,7 @@ NetworkOPsImp::getBookPage( STAmount saDirRate; auto const rate = transferRate(view, book.out.account); - auto viewJ = app_.journal("View"); + auto viewJ = registry_.journal("View"); while (!bDone && iLimit-- > 0) { @@ -4413,7 +4421,7 @@ NetworkOPsImp::StateAccounting::json(Json::Value& obj) const std::unique_ptr make_NetworkOPs( - Application& app, + ServiceRegistry& registry, NetworkOPs::clock_type& clock, bool standalone, std::size_t minPeerCount, @@ -4426,7 +4434,7 @@ make_NetworkOPs( beast::insight::Collector::ptr const& collector) { return std::make_unique( - app, + registry, clock, standalone, minPeerCount, diff --git a/src/xrpld/app/misc/SHAMapStoreImp.cpp b/src/xrpld/app/misc/SHAMapStoreImp.cpp index c963d18d2c..8de47207a6 100644 --- a/src/xrpld/app/misc/SHAMapStoreImp.cpp +++ b/src/xrpld/app/misc/SHAMapStoreImp.cpp @@ -1,5 +1,4 @@ #include -#include #include #include #include @@ -7,6 +6,7 @@ #include #include #include +#include #include #include diff --git a/src/xrpld/app/misc/detail/ValidatorList.cpp b/src/xrpld/app/misc/detail/ValidatorList.cpp index 0edd0de9be..3a46d2baa1 100644 --- a/src/xrpld/app/misc/detail/ValidatorList.cpp +++ b/src/xrpld/app/misc/detail/ValidatorList.cpp @@ -1,5 +1,4 @@ #include -#include #include #include @@ -13,6 +12,7 @@ #include #include #include +#include #include diff --git a/src/xrpld/app/misc/make_NetworkOPs.h b/src/xrpld/app/misc/make_NetworkOPs.h new file mode 100644 index 0000000000..7dce966f04 --- /dev/null +++ b/src/xrpld/app/misc/make_NetworkOPs.h @@ -0,0 +1,32 @@ +#pragma once + +#include +#include +#include +#include +#include + +#include + +#include + +namespace xrpl { + +class LedgerMaster; +class ValidatorKeys; + +std::unique_ptr +make_NetworkOPs( + ServiceRegistry& registry, + NetworkOPs::clock_type& clock, + bool standalone, + std::size_t minPeerCount, + bool start_valid, + JobQueue& job_queue, + LedgerMaster& ledgerMaster, + ValidatorKeys const& validatorKeys, + boost::asio::io_context& io_svc, + beast::Journal journal, + beast::insight::Collector::ptr const& collector); + +} // namespace xrpl diff --git a/src/xrpld/app/paths/PathRequest.cpp b/src/xrpld/app/paths/PathRequest.cpp index e2a3e14485..53a4e03752 100644 --- a/src/xrpld/app/paths/PathRequest.cpp +++ b/src/xrpld/app/paths/PathRequest.cpp @@ -1,6 +1,5 @@ #include #include -#include #include #include #include @@ -14,6 +13,7 @@ #include #include #include +#include #include #include diff --git a/src/xrpld/app/paths/PathRequest.h b/src/xrpld/app/paths/PathRequest.h index 864d2cb932..09e97e4497 100644 --- a/src/xrpld/app/paths/PathRequest.h +++ b/src/xrpld/app/paths/PathRequest.h @@ -3,11 +3,11 @@ #include #include #include -#include #include #include #include +#include #include #include diff --git a/src/xrpld/app/rdb/backend/SQLiteDatabase.h b/src/xrpld/app/rdb/backend/SQLiteDatabase.h index b79b66787e..963ec1da72 100644 --- a/src/xrpld/app/rdb/backend/SQLiteDatabase.h +++ b/src/xrpld/app/rdb/backend/SQLiteDatabase.h @@ -2,7 +2,11 @@ #include +#include #include +#include +#include +#include namespace xrpl { @@ -378,7 +382,7 @@ public: SQLiteDatabase& operator=(SQLiteDatabase const&) = delete; SQLiteDatabase& - operator=(SQLiteDatabase&& rhs) = delete; + operator=(SQLiteDatabase&&) = delete; /** * @brief ledgerDbHasSpace Checks if the ledger database has available @@ -400,7 +404,7 @@ public: private: ServiceRegistry& registry_; - bool const useTxTables_; + bool useTxTables_; beast::Journal j_; std::unique_ptr ledgerDb_, txdb_; @@ -464,7 +468,9 @@ private: /** * @brief setup_RelationalDatabase Creates and returns a SQLiteDatabase - * instance based on configuration. + * instance based on configuration. It's recommended to use it as + * a singleton, but it's not enforced (e.g. if you have more than one + * database). * @param registry The service registry. * @param config Config object. * @param jobQueue JobQueue object. diff --git a/src/xrpld/app/rdb/backend/detail/SQLiteDatabase.cpp b/src/xrpld/app/rdb/backend/detail/SQLiteDatabase.cpp index 6c3e76a86f..93d7662917 100644 --- a/src/xrpld/app/rdb/backend/detail/SQLiteDatabase.cpp +++ b/src/xrpld/app/rdb/backend/detail/SQLiteDatabase.cpp @@ -499,6 +499,13 @@ SQLiteDatabase::getTransaction( return TxSearched::unknown; } +SQLiteDatabase::SQLiteDatabase(SQLiteDatabase&& rhs) noexcept + : registry_(rhs.registry_), useTxTables_(rhs.useTxTables_), j_(rhs.j_) +{ + std::exchange(ledgerDb_, std::move(rhs.ledgerDb_)); + std::exchange(txdb_, std::move(rhs.txdb_)); +} + bool SQLiteDatabase::ledgerDbHasSpace(Config const& config) { @@ -587,15 +594,6 @@ SQLiteDatabase::SQLiteDatabase(ServiceRegistry& registry, Config const& config, } } -SQLiteDatabase::SQLiteDatabase(SQLiteDatabase&& rhs) noexcept - : registry_(rhs.registry_) - , useTxTables_(rhs.useTxTables_) - , j_(rhs.j_) - , ledgerDb_(std::move(rhs.ledgerDb_)) - , txdb_(std::move(rhs.txdb_)) -{ -} - SQLiteDatabase setup_RelationalDatabase(ServiceRegistry& registry, Config const& config, JobQueue& jobQueue) { diff --git a/src/xrpld/app/rdb/detail/RelationalDatabase.cpp b/src/xrpld/app/rdb/detail/RelationalDatabase.cpp deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/xrpld/app/tx/detail/Change.cpp b/src/xrpld/app/tx/detail/Change.cpp index dbef2eadf9..67c7db68c5 100644 --- a/src/xrpld/app/tx/detail/Change.cpp +++ b/src/xrpld/app/tx/detail/Change.cpp @@ -1,7 +1,6 @@ #include #include #include -#include #include #include @@ -9,6 +8,7 @@ #include #include #include +#include #include diff --git a/src/xrpld/app/tx/detail/XChainBridge.cpp b/src/xrpld/app/tx/detail/XChainBridge.cpp index beeab41f67..f4abb9145b 100644 --- a/src/xrpld/app/tx/detail/XChainBridge.cpp +++ b/src/xrpld/app/tx/detail/XChainBridge.cpp @@ -556,7 +556,7 @@ struct FinalizeClaimHelperResult the fields mean. The individual ters need to be returned instead of an overall ter because the caller needs this information if the attestation list changed or not. - */ +*/ FinalizeClaimHelperResult finalizeClaimHelper( diff --git a/src/xrpld/overlay/detail/OverlayImpl.cpp b/src/xrpld/overlay/detail/OverlayImpl.cpp index 549bff024e..ceefab24f1 100644 --- a/src/xrpld/overlay/detail/OverlayImpl.cpp +++ b/src/xrpld/overlay/detail/OverlayImpl.cpp @@ -1,5 +1,4 @@ #include -#include #include #include #include @@ -18,6 +17,7 @@ #include #include #include +#include #include #include diff --git a/src/xrpld/overlay/detail/PeerImp.cpp b/src/xrpld/overlay/detail/PeerImp.cpp index 0664f64256..d66a57bae6 100644 --- a/src/xrpld/overlay/detail/PeerImp.cpp +++ b/src/xrpld/overlay/detail/PeerImp.cpp @@ -5,7 +5,6 @@ #include #include #include -#include #include #include #include @@ -20,6 +19,7 @@ #include #include #include +#include #include #include diff --git a/src/xrpld/rpc/Context.h b/src/xrpld/rpc/Context.h index 7ff02a9e8b..e77d9adeb3 100644 --- a/src/xrpld/rpc/Context.h +++ b/src/xrpld/rpc/Context.h @@ -1,10 +1,10 @@ #pragma once -#include #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/rpc/RPCSub.h b/src/xrpld/rpc/RPCSub.h index 53c46139cb..e89f8f34e4 100644 --- a/src/xrpld/rpc/RPCSub.h +++ b/src/xrpld/rpc/RPCSub.h @@ -1,8 +1,7 @@ #pragma once -#include - #include +#include #include diff --git a/src/xrpld/rpc/detail/Handler.h b/src/xrpld/rpc/detail/Handler.h index f6fadd9cbd..664fd04ab8 100644 --- a/src/xrpld/rpc/detail/Handler.h +++ b/src/xrpld/rpc/detail/Handler.h @@ -1,12 +1,12 @@ #pragma once #include -#include #include #include #include #include +#include namespace Json { class Object; diff --git a/src/xrpld/rpc/detail/RPCHandler.cpp b/src/xrpld/rpc/detail/RPCHandler.cpp index 93cb58a117..159649e6d7 100644 --- a/src/xrpld/rpc/detail/RPCHandler.cpp +++ b/src/xrpld/rpc/detail/RPCHandler.cpp @@ -2,10 +2,8 @@ #include #include #include -#include #include #include -#include #include #include #include @@ -18,6 +16,8 @@ #include #include #include +#include +#include #include #include diff --git a/src/xrpld/rpc/detail/RPCHelpers.h b/src/xrpld/rpc/detail/RPCHelpers.h index 1b5e06ce42..b0dc839404 100644 --- a/src/xrpld/rpc/detail/RPCHelpers.h +++ b/src/xrpld/rpc/detail/RPCHelpers.h @@ -1,6 +1,5 @@ #pragma once -#include #include #include #include @@ -9,6 +8,7 @@ #include #include #include +#include #include diff --git a/src/xrpld/rpc/detail/RPCLedgerHelpers.h b/src/xrpld/rpc/detail/RPCLedgerHelpers.h index b2d9df809f..81877e6f49 100644 --- a/src/xrpld/rpc/detail/RPCLedgerHelpers.h +++ b/src/xrpld/rpc/detail/RPCLedgerHelpers.h @@ -1,6 +1,6 @@ #pragma once -#include +#include #include #include #include @@ -8,6 +8,7 @@ #include #include +#include #include diff --git a/src/xrpld/rpc/detail/ServerHandler.cpp b/src/xrpld/rpc/detail/ServerHandler.cpp index d40965ec79..9c18143eb4 100644 --- a/src/xrpld/rpc/detail/ServerHandler.cpp +++ b/src/xrpld/rpc/detail/ServerHandler.cpp @@ -1,5 +1,4 @@ #include -#include #include #include #include @@ -23,6 +22,7 @@ #include #include #include +#include #include #include #include diff --git a/src/xrpld/rpc/detail/TransactionSign.h b/src/xrpld/rpc/detail/TransactionSign.h index cc85d67815..8d064d65d5 100644 --- a/src/xrpld/rpc/detail/TransactionSign.h +++ b/src/xrpld/rpc/detail/TransactionSign.h @@ -1,10 +1,11 @@ #pragma once #include -#include #include #include +#include + namespace xrpl { // Forward declarations diff --git a/src/xrpld/rpc/detail/WSInfoSub.h b/src/xrpld/rpc/detail/WSInfoSub.h index 8ed5ff8d6d..4042cd5479 100644 --- a/src/xrpld/rpc/detail/WSInfoSub.h +++ b/src/xrpld/rpc/detail/WSInfoSub.h @@ -1,10 +1,10 @@ #pragma once -#include #include #include #include +#include #include #include diff --git a/src/xrpld/rpc/handlers/BookOffers.cpp b/src/xrpld/rpc/handlers/BookOffers.cpp index 1a79bdcdd2..ff49bf2290 100644 --- a/src/xrpld/rpc/handlers/BookOffers.cpp +++ b/src/xrpld/rpc/handlers/BookOffers.cpp @@ -1,5 +1,4 @@ #include -#include #include #include #include @@ -12,6 +11,7 @@ #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/rpc/handlers/ConsensusInfo.cpp b/src/xrpld/rpc/handlers/ConsensusInfo.cpp index 386ff99458..f9c5a97785 100644 --- a/src/xrpld/rpc/handlers/ConsensusInfo.cpp +++ b/src/xrpld/rpc/handlers/ConsensusInfo.cpp @@ -1,9 +1,9 @@ -#include #include #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/rpc/handlers/FetchInfo.cpp b/src/xrpld/rpc/handlers/FetchInfo.cpp index 0a54042820..f25f18acf7 100644 --- a/src/xrpld/rpc/handlers/FetchInfo.cpp +++ b/src/xrpld/rpc/handlers/FetchInfo.cpp @@ -1,9 +1,9 @@ -#include #include #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/rpc/handlers/GetCounts.cpp b/src/xrpld/rpc/handlers/GetCounts.cpp index 360389ba3a..54600d4761 100644 --- a/src/xrpld/rpc/handlers/GetCounts.cpp +++ b/src/xrpld/rpc/handlers/GetCounts.cpp @@ -2,7 +2,6 @@ #include #include #include -#include #include #include @@ -11,6 +10,7 @@ #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/rpc/handlers/LedgerAccept.cpp b/src/xrpld/rpc/handlers/LedgerAccept.cpp index abf5780629..c7a828863a 100644 --- a/src/xrpld/rpc/handlers/LedgerAccept.cpp +++ b/src/xrpld/rpc/handlers/LedgerAccept.cpp @@ -1,11 +1,11 @@ #include #include -#include #include #include #include #include +#include #include diff --git a/src/xrpld/rpc/handlers/LedgerClosed.cpp b/src/xrpld/rpc/handlers/LedgerClosed.cpp index 3b93e0734f..e26019cca6 100644 --- a/src/xrpld/rpc/handlers/LedgerClosed.cpp +++ b/src/xrpld/rpc/handlers/LedgerClosed.cpp @@ -1,9 +1,9 @@ #include -#include #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/rpc/handlers/LedgerCurrent.cpp b/src/xrpld/rpc/handlers/LedgerCurrent.cpp index c5ca962751..861080c5f2 100644 --- a/src/xrpld/rpc/handlers/LedgerCurrent.cpp +++ b/src/xrpld/rpc/handlers/LedgerCurrent.cpp @@ -1,9 +1,9 @@ #include -#include #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/rpc/handlers/OwnerInfo.cpp b/src/xrpld/rpc/handlers/OwnerInfo.cpp index bbab938cfb..b92d3c7d0a 100644 --- a/src/xrpld/rpc/handlers/OwnerInfo.cpp +++ b/src/xrpld/rpc/handlers/OwnerInfo.cpp @@ -1,11 +1,11 @@ #include -#include #include #include #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/rpc/handlers/ServerInfo.cpp b/src/xrpld/rpc/handlers/ServerInfo.cpp index 70b92c99bd..1086760bf6 100644 --- a/src/xrpld/rpc/handlers/ServerInfo.cpp +++ b/src/xrpld/rpc/handlers/ServerInfo.cpp @@ -1,10 +1,10 @@ -#include #include #include #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/rpc/handlers/ServerState.cpp b/src/xrpld/rpc/handlers/ServerState.cpp index e2adbc8ff2..603b9f9c51 100644 --- a/src/xrpld/rpc/handlers/ServerState.cpp +++ b/src/xrpld/rpc/handlers/ServerState.cpp @@ -1,9 +1,9 @@ -#include #include #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/rpc/handlers/Subscribe.cpp b/src/xrpld/rpc/handlers/Subscribe.cpp index c1f506e623..574da255d2 100644 --- a/src/xrpld/rpc/handlers/Subscribe.cpp +++ b/src/xrpld/rpc/handlers/Subscribe.cpp @@ -1,6 +1,5 @@ #include #include -#include #include #include #include @@ -12,6 +11,7 @@ #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/rpc/handlers/Tx.cpp b/src/xrpld/rpc/handlers/Tx.cpp index 2f8d71c2c8..d2d7bed04d 100644 --- a/src/xrpld/rpc/handlers/Tx.cpp +++ b/src/xrpld/rpc/handlers/Tx.cpp @@ -1,7 +1,6 @@ #include #include #include -#include #include #include #include @@ -16,6 +15,7 @@ #include #include #include +#include #include diff --git a/src/xrpld/rpc/handlers/Unsubscribe.cpp b/src/xrpld/rpc/handlers/Unsubscribe.cpp index 24c4cd51a5..da5cd8eecb 100644 --- a/src/xrpld/rpc/handlers/Unsubscribe.cpp +++ b/src/xrpld/rpc/handlers/Unsubscribe.cpp @@ -1,4 +1,3 @@ -#include #include #include #include @@ -7,6 +6,7 @@ #include #include #include +#include namespace xrpl {