20 #include <ripple/app/consensus/RCLValidations.h>
21 #include <ripple/app/ledger/InboundLedgers.h>
22 #include <ripple/app/ledger/InboundTransactions.h>
23 #include <ripple/app/ledger/LedgerMaster.h>
24 #include <ripple/app/ledger/LedgerToJson.h>
25 #include <ripple/app/ledger/OpenLedger.h>
26 #include <ripple/app/ledger/OrderBookDB.h>
27 #include <ripple/app/ledger/PendingSaves.h>
28 #include <ripple/app/ledger/TransactionMaster.h>
29 #include <ripple/app/main/Application.h>
30 #include <ripple/app/main/BasicApp.h>
31 #include <ripple/app/main/DBInit.h>
32 #include <ripple/app/main/GRPCServer.h>
33 #include <ripple/app/main/LoadManager.h>
34 #include <ripple/app/main/NodeIdentity.h>
35 #include <ripple/app/main/NodeStoreScheduler.h>
36 #include <ripple/app/misc/AmendmentTable.h>
37 #include <ripple/app/misc/HashRouter.h>
38 #include <ripple/app/misc/LoadFeeTrack.h>
39 #include <ripple/app/misc/NetworkOPs.h>
40 #include <ripple/app/misc/SHAMapStore.h>
41 #include <ripple/app/misc/TxQ.h>
42 #include <ripple/app/misc/ValidatorKeys.h>
43 #include <ripple/app/misc/ValidatorSite.h>
44 #include <ripple/app/paths/PathRequests.h>
45 #include <ripple/app/tx/apply.h>
46 #include <ripple/basics/ByteUtilities.h>
47 #include <ripple/basics/PerfLog.h>
48 #include <ripple/basics/ResolverAsio.h>
49 #include <ripple/basics/safe_cast.h>
50 #include <ripple/beast/asio/io_latency_probe.h>
51 #include <ripple/beast/core/LexicalCast.h>
52 #include <ripple/core/DatabaseCon.h>
53 #include <ripple/core/Stoppable.h>
54 #include <ripple/json/json_reader.h>
55 #include <ripple/nodestore/DatabaseShard.h>
56 #include <ripple/nodestore/DummyScheduler.h>
57 #include <ripple/overlay/Cluster.h>
58 #include <ripple/overlay/PeerReservationTable.h>
59 #include <ripple/overlay/make_Overlay.h>
60 #include <ripple/protocol/BuildInfo.h>
61 #include <ripple/protocol/Feature.h>
62 #include <ripple/protocol/Protocol.h>
63 #include <ripple/protocol/STParsedJSON.h>
64 #include <ripple/resource/Fees.h>
65 #include <ripple/rpc/ShardArchiveHandler.h>
66 #include <ripple/rpc/impl/RPCHelpers.h>
67 #include <ripple/shamap/NodeFamily.h>
68 #include <ripple/shamap/ShardFamily.h>
70 #include <boost/algorithm/string/predicate.hpp>
71 #include <boost/asio/steady_timer.hpp>
72 #include <boost/system/error_code.hpp>
98 boost::asio::io_service& ios)
112 template <
class Duration>
117 auto const lastSample = date::ceil<milliseconds>(elapsed);
121 if (lastSample >= 10ms)
123 if (lastSample >= 500ms)
126 <<
"io_service latency = " << lastSample.count();
234 #if RIPPLE_SINGLE_IO_SERVICE_THREAD
279 logs_->journal(
"SHAMapStore")))
288 logs_->journal(
"TaggedCache"))
291 config_->section(SECTION_INSIGHT),
292 logs_->journal(
"Collector")))
298 logs_->journal(
"Resource")))
306 logs_->journal(
"JobQueue"),
320 logs_->journal(
"ShardStore")))
326 logs_->journal(
"PathRequest"),
334 logs_->journal(
"LedgerMaster")))
350 gotTXSet(set, fromAcquire);
358 logs_->journal(
"TaggedCache"))
371 logs_->journal(
"NetworkOPs"),
374 ,
cluster_(std::make_unique<Cluster>(
logs_->journal(
"Overlay")))
377 logs_->journal(
"PeerReservationTable")))
380 std::make_unique<ManifestCache>(
logs_->journal(
"ManifestCache")))
383 std::make_unique<ManifestCache>(
logs_->journal(
"ManifestCache")))
389 config_->legacy(
"database_path"),
390 logs_->journal(
"ValidatorList"),
405 std::make_unique<LoadFeeTrack>(
logs_->journal(
"LoadManager")))
416 logs_->journal(
"Validations"))
439 logs_->journal(
"Application"),
472 doStart(
bool withTimers)
override;
550 boost::asio::io_service&
639 if (!handler->init())
642 <<
"Failed to initialize ShardArchiveHandler.";
658 <<
"ShardArchiveHandler already created at startup.";
666 if (!initAndSet(std::move(handler)))
676 if (!initAndSet(std::move(handler)))
819 assert(
txQ_.get() !=
nullptr);
826 assert(
mTxnDB.get() !=
nullptr);
853 assert(
mTxnDB.get() ==
nullptr);
862 mTxnDB = std::make_unique<DatabaseCon>(
868 mTxnDB->getSession() << boost::str(
869 boost::format(
"PRAGMA cache_size=-%d;") %
881 (
mTxnDB->getSession().prepare
882 << (
"PRAGMA table_info(AccountTransactions);"),
887 soci::into(dflt_value, ind),
896 <<
"AccountTransactions database "
897 "should not have a primary key";
904 mLedgerDB = std::make_unique<DatabaseCon>(
911 boost::format(
"PRAGMA cache_size=-%d;") %
915 setup.useGlobalPragma =
false;
916 mWalletDB = std::make_unique<DatabaseCon>(
925 <<
"Failed to initialize SQLite databases: " << e.
what();
937 auto j =
logs_->journal(
"NodeObject");
949 JLOG(j.warn()) <<
"Starting node import from '" << source->getName()
953 auto const start = steady_clock::now();
958 duration_cast<seconds>(steady_clock::now() -
start);
959 JLOG(j.warn()) <<
"Node import from '" << source->getName()
960 <<
"' took " << elapsed.count() <<
" seconds.";
967 seconds{config_->getValueFor(SizedItem::nodeCacheAge)});
971 seconds{config_->getValueFor(SizedItem::ledgerAge)});
989 JLOG(
m_journal.
info()) <<
"Application starting. Version is "
992 using namespace std::chrono_literals;
1028 boost::system::error_code ec;
1033 <<
"Application: sweepTimer cancel error: " << ec.message();
1041 <<
"Application: entropyTimer cancel error: "
1047 using namespace std::chrono_literals;
1057 "ValidatorManifests",
1064 "PublisherManifests",
1089 [
this](boost::system::error_code
const& e) {
1090 if ((e.value() == boost::system::errc::success) &&
1091 (!m_jobQueue->isStopped()))
1094 jtSWEEP,
"sweep", [this](Job&) { doSweep(); });
1097 if (e.value() != boost::system::errc::success &&
1098 e.value() != boost::asio::error::operation_aborted)
1101 JLOG(m_journal.error())
1102 <<
"Sweep timer got error '" << e.message()
1103 <<
"'. Restarting timer.";
1111 sweepTimer_.async_wait(std::move(*optionalCountedHandler));
1120 [
this](boost::system::error_code
const& e) {
1121 if (e.value() == boost::system::errc::success)
1123 crypto_prng().mix_entropy();
1127 if (e.value() != boost::system::errc::success &&
1128 e.value() != boost::asio::error::operation_aborted)
1131 JLOG(m_journal.error())
1132 <<
"Entropy timer got error '" << e.message()
1133 <<
"'. Restarting timer.";
1138 using namespace std::chrono_literals;
1140 entropyTimer_.async_wait(std::move(*optionalCountedHandler));
1149 boost::filesystem::space_info space =
1150 boost::filesystem::space(
config_->legacy(
"database_path"));
1155 <<
"Remaining free disk space is less than 512MB";
1161 boost::system::error_code ec;
1162 boost::optional<std::uint64_t> dbSize =
1163 boost::filesystem::file_size(dbPath, ec);
1167 <<
"Error checking transaction db file size: "
1172 auto db =
mTxnDB->checkoutDb();
1173 static auto const pageSize = [&] {
1175 *db <<
"PRAGMA page_size;", soci::into(ps);
1178 static auto const maxPages = [&] {
1180 *db <<
"PRAGMA max_page_count;", soci::into(mp);
1184 *db <<
"PRAGMA page_count;", soci::into(pageCount);
1187 safe_cast<std::uint64_t>(freePages) * pageSize;
1189 <<
"Transaction DB pathname: " << dbPath.string()
1190 <<
"; file size: " << dbSize.value_or(-1) <<
" bytes"
1191 <<
"; SQLite page size: " << pageSize <<
" bytes"
1192 <<
"; Free pages: " << freePages
1193 <<
"; Free space: " << freeSpace <<
" bytes; "
1194 <<
"Note that this does not take into account available disk "
1200 <<
"Free SQLite space for transaction db is less than "
1201 "512MB. To fix this, rippled must be executed with the "
1202 "\"--vacuum\" parameter before restarting. "
1203 "Note that this activity can take multiple days, "
1204 "depending on database size.";
1279 [
this](boost::system::error_code
const& ec,
int signum) {
1281 if (ec == boost::asio::error::operation_aborted)
1286 if (signum == SIGTERM || signum == SIGINT)
1290 assert(
mTxnDB ==
nullptr);
1292 auto debug_log =
config_->getDebugLogFile();
1294 if (!debug_log.empty())
1299 if (!
logs_->open(debug_log))
1300 std::cerr <<
"Can't open log file " << debug_log <<
'\n';
1311 JLOG(
m_journal.
warn()) <<
"Limited to a single I/O service thread by "
1312 "system configuration.";
1350 for (
auto const&
name : sa)
1357 Section supportedAmendments(
"Supported Amendments");
1358 supportedAmendments.append(saHashes);
1360 Section enabledAmendments =
config_->section(SECTION_AMENDMENTS);
1363 config().AMENDMENT_MAJORITY_TIME,
1364 supportedAmendments,
1366 config_->section(SECTION_VETO_AMENDMENTS),
1367 logs_->journal(
"Amendments"));
1372 auto const startUp =
config_->START_UP;
1391 <<
"The specified ledger could not be loaded.";
1415 JLOG(
m_journal.
fatal()) <<
"Invalid entry in cluster configuration.";
1425 "ValidatorManifests",
1427 config().section(SECTION_VALIDATOR_KEY_REVOCATION).values()))
1429 JLOG(
m_journal.
fatal()) <<
"Invalid configured validator manifest.";
1438 config().section(SECTION_VALIDATORS).values(),
1439 config().section(SECTION_VALIDATOR_LIST_KEYS).values()))
1442 <<
"Invalid entry in validator configuration.";
1448 config().section(SECTION_VALIDATOR_LIST_SITES).values()))
1451 <<
"Invalid entry in [" << SECTION_VALIDATOR_LIST_SITES <<
"]";
1503 setup.makeContexts();
1510 stream <<
"Unable to setup server handler";
1512 stream <<
": " << e.
what();
1526 <<
"No outbound peer connections will be made";
1542 JLOG(
m_journal.
warn()) <<
"*** The server is configured to allow the "
1543 "'sign' and 'sign_for'";
1544 JLOG(
m_journal.
warn()) <<
"*** commands. These commands have security "
1545 "implications and have";
1546 JLOG(
m_journal.
warn()) <<
"*** been deprecated. They will be removed "
1547 "in a future release of";
1549 JLOG(
m_journal.
warn()) <<
"*** If you do not use them to sign "
1550 "transactions please edit your";
1552 <<
"*** configuration file and remove the [enable_signing] stanza.";
1553 JLOG(
m_journal.
warn()) <<
"*** If you do use them to sign transactions "
1554 "please migrate to a";
1556 <<
"*** standalone signing solution as soon as possible.";
1562 for (
auto cmd :
config_->section(SECTION_RPC_STARTUP).lines())
1567 if (!jrReader.
parse(cmd, jvCommand))
1570 << SECTION_RPC_STARTUP <<
"]: '" << cmd;
1576 <<
"Startup RPC: " << jvCommand <<
std::endl;
1615 if (!handler->start())
1618 <<
"Failed to start ShardArchiveHandler.";
1627 <<
"Exception when starting ShardArchiveHandler from "
1742 std::make_shared<Ledger>(*genesis,
timeKeeper().closeTime());
1743 next->updateSkipList();
1757 auto const [ledger, seq, hash] =
1763 ledger->setImmutable(*
config_);
1766 ledger->setValidated();
1768 if (ledger->info().hash == hash)
1770 JLOG(j.trace()) <<
"Loaded ledger: " << hash;
1774 if (
auto stream = j.error())
1776 stream <<
"Failed on ledger";
1786 JLOG(j.warn()) <<
"Ledger in database: " << mn.
what();
1807 if (!reader.
parse(ledgerFile, jLedger))
1816 if (ledger.
get().isMember(
"result"))
1817 ledger = ledger.
get()[
"result"];
1819 if (ledger.
get().isMember(
"ledger"))
1820 ledger = ledger.
get()[
"ledger"];
1824 using namespace std::chrono_literals;
1825 auto closeTimeResolution = 30s;
1826 bool closeTimeEstimated =
false;
1829 if (ledger.
get().isMember(
"accountState"))
1831 if (ledger.
get().isMember(jss::ledger_index))
1833 seq = ledger.
get()[jss::ledger_index].asUInt();
1836 if (ledger.
get().isMember(
"close_time"))
1839 using d = tp::duration;
1840 closeTime = tp{d{ledger.
get()[
"close_time"].asUInt()}};
1842 if (ledger.
get().isMember(
"close_time_resolution"))
1845 closeTimeResolution =
1846 seconds{ledger.
get()[
"close_time_resolution"].asUInt()};
1848 if (ledger.
get().isMember(
"close_time_estimated"))
1850 closeTimeEstimated =
1851 ledger.
get()[
"close_time_estimated"].asBool();
1853 if (ledger.
get().isMember(
"total_coins"))
1855 totalDrops = beast::lexicalCastThrow<std::uint64_t>(
1856 ledger.
get()[
"total_coins"].asString());
1859 ledger = ledger.
get()[
"accountState"];
1862 if (!ledger.
get().isArrayOrNull())
1870 loadLedger->setTotalDrops(totalDrops);
1872 for (
Json::UInt index = 0; index < ledger.
get().size(); ++index)
1904 if (!loadLedger->addSLE(sle))
1907 <<
"Couldn't add serialized ledger: " << uIndex;
1912 loadLedger->stateMap().flushDirty(
1915 loadLedger->setAccepted(
1916 closeTime, closeTimeResolution, !closeTimeEstimated, *
config_);
1939 if (!ledgerID.
empty())
1942 else if (ledgerID.
length() == 64)
1946 if (hash.
SetHex(ledgerID))
1953 auto il = std::make_shared<InboundLedger>(
1959 if (il->checkLocal())
1960 loadLedger = il->getLedger();
1964 else if (ledgerID.
empty() || boost::iequals(ledgerID,
"latest"))
1985 replayLedger = loadLedger;
1989 loadLedger =
loadByHash(replayLedger->info().parentHash, *
this);
1993 <<
"Loading parent ledger from node store";
1996 auto il = std::make_shared<InboundLedger>(
1998 replayLedger->info().parentHash,
2003 if (il->checkLocal())
2004 loadLedger = il->getLedger();
2014 using namespace std::chrono_literals;
2015 using namespace date;
2017 sys_days{January / 1 / 2018} - sys_days{January / 1 / 2000}};
2018 if (loadLedger->info().closeTime < ledgerWarnTimePoint)
2021 <<
"\n\n*** WARNING ***\n"
2022 "You are replaying a ledger from before "
2025 "This replay will not handle your ledger as it was "
2027 "handled.\nConsider running an earlier version of rippled "
2029 "get the older rules.\n*** CONTINUING ***\n";
2032 JLOG(
m_journal.
info()) <<
"Loading ledger " << loadLedger->info().hash
2033 <<
" seq:" << loadLedger->info().seq;
2035 if (loadLedger->info().accountHash.isZero())
2042 if (!loadLedger->walkLedger(
journal(
"Ledger")))
2049 if (!loadLedger->assertSane(
journal(
"Ledger")))
2057 loadLedger->info().seq, loadLedger->info().seq);
2060 loadLedger->setValidated();
2070 std::make_unique<LedgerReplay>(loadLedger, replayLedger);
2072 for (
auto const& [_, tx] : replayData->orderedTxns())
2075 auto txID = tx->getTransactionID();
2077 auto s = std::make_shared<Serializer>();
2095 <<
"While loading specified ledger: " << mn.
what();
2098 catch (boost::bad_lexical_cast&)
2101 <<
"Ledger specified '" << ledgerID <<
"' is not valid";
2111 if (!
config().ELB_SUPPORT)
2116 reason =
"Server is shutting down";
2120 if (
getOPs().isNeedNetworkLedger())
2122 reason =
"Not synchronized with network yet";
2128 reason =
"Not synchronized with network";
2137 reason =
"Too much load";
2141 if (
getOPs().isAmendmentBlocked())
2143 reason =
"Server version too old";
2160 assert(!
config_->standalone());
2165 <<
"The [shard_db] configuration setting must be set";
2181 assert(!
config_->standalone());
2186 <<
"The [shard_db] configuration setting must be set";
2201 boost::optional<LedgerIndex> seq;
2204 *db <<
"SELECT MAX(LedgerSeq) FROM Ledgers;", soci::into(seq);
2227 return std::make_unique<ApplicationImp>(
2228 std::move(config), std::move(logs), std::move(timeKeeper));
A NodeStore::Scheduler which uses the JobQueue and implements the Stoppable API.
void expire()
Expire old validation sets.
std::string const & name() const
Returns the name of this source.
std::unique_ptr< Resource::Manager > m_resourceManager
TxQ::Setup setup_TxQ(Config const &config)
Build a TxQ::Setup object from application configuration.
DatabaseCon & getTxnDB() override
Simple NodeStore Scheduler that just peforms the tasks synchronously.
std::unique_ptr< DatabaseCon > mTxnDB
PublicKey const & getValidationPublicKey() const override
NodeCache m_tempNodeCache
Holds a collection of configuration values.
Provides server functionality for clients.
std::unique_ptr< NodeStore::DatabaseShard > shardStore_
std::tuple< std::shared_ptr< Ledger >, std::uint32_t, uint256 > loadLedgerHelper(std::string const &sqlSuffix, Application &app, bool acquire)
constexpr auto WalletDBName
DatabaseCon & getLedgerDB() override
void activateDeadlockDetector()
Turn on deadlock detection.
std::unique_ptr< InboundTransactions > m_inboundTransactions
std::vector< std::unique_ptr< Stoppable > > websocketServers_
Family * getShardFamily() override
ValidatorList & validators() override
Persistency layer for NodeObject.
CachedSLEs & cachedSLEs() override
NodeStore::Database & getNodeStore() override
std::pair< PublicKey, SecretKey > loadNodeIdentity(Application &app)
The cryptographic credentials identifying this server instance.
bool serverOkay(std::string &reason) override
std::shared_ptr< Ledger > loadByIndex(std::uint32_t ledgerIndex, Application &app, bool acquire)
RCLValidations mValidations
TaggedCache< uint256, AcceptedLedger > & getAcceptedLedgerCache() override
void stopped()
Called by derived classes to indicate that the stoppable has stopped.
HashRouter & getHashRouter() override
Stream trace() const
Severity stream access functions.
std::unique_ptr< ValidatorSite > validatorSites_
std::unique_ptr< DatabaseCon > mWalletDB
PathRequests & getPathRequests() override
OrderBookDB m_orderBookDB
void onStop() override
Override called when the stop notification is issued.
void onWrite(beast::PropertyStream::Map &stream) override
Subclass override.
InboundLedgers & getInboundLedgers() override
AccountIDCache const & accountIDCache() const override
Writable ledger view that accumulates state and tx changes.
static std::string shardDatabase()
bool trustedPublisher(PublicKey const &identity) const
Returns true if public key is a trusted publisher.
ClosureCounter< void, boost::system::error_code const & > waitHandlerCounter_
NetworkOPs & getOPs() override
std::unique_ptr< Overlay > make_Overlay(Application &app, Overlay::Setup const &setup, Stoppable &parent, ServerHandler &serverHandler, Resource::Manager &resourceManager, Resolver &resolver, boost::asio::io_service &io_service, BasicConfig const &config, beast::insight::Collector::ptr const &collector)
Creates the implementation of Overlay.
Provides the beast::insight::Collector service.
static std::string importNodeDatabase()
TaggedCache< uint256, AcceptedLedger > m_acceptedLedgerCache
class to create database, launch online delete thread, and related SQLite database
std::unique_ptr< LoadManager > make_LoadManager(Application &app, Stoppable &parent, beast::Journal journal)
ManifestCache & validatorManifests() override
DatabaseCon & getWalletDB() override
Retrieve the "wallet database".
CollectorManager & getCollectorManager() override
boost::asio::steady_timer sweepTimer_
std::unique_ptr< Cluster > cluster_
NodeStore::DatabaseShard * getShardStore() override
OpenLedger const & openLedger() const override
std::chrono::milliseconds getIOLatency() override
boost::optional< OpenLedger > openLedger_
std::unique_ptr< SHAMapStore > m_shaMapStore
boost::asio::io_service & getIOService() override
std::unique_ptr< RPC::ShardArchiveHandler > shardArchiveHandler_
constexpr auto kilobytes(T value) noexcept
A namespace for easy access to logging severity values.
Singleton class that maintains performance counters and optionally writes Json-formatted data to a di...
Holds the serialized result of parsing an input JSON object.
Keeps track of which ledgers haven't been fully saved.
const Charge feeReferenceRPC
static void initPathTable()
boost::filesystem::path dataDir
ApplicationImp(std::unique_ptr< Config > config, std::unique_ptr< Logs > logs, std::unique_ptr< TimeKeeper > timeKeeper)
void signalStop() override
Cluster & cluster() override
Stopwatch & stopwatch()
Returns an instance of a wall clock.
std::string to_string(ListDisposition disposition)
LedgerMaster & getLedgerMaster() override
Unserialize a JSON document into a Value.
static std::unique_ptr< CollectorManager > New(Section const ¶ms, beast::Journal journal)
static std::unique_ptr< ResolverAsio > New(boost::asio::io_service &, beast::Journal)
std::unique_ptr< NodeStore::Database > m_nodeStore
constexpr std::array< char const *, 5 > LgrDBInit
std::unique_ptr< perf::PerfLog > perfLog_
Caches the base58 representations of AccountIDs.
std::pair< PublicKey, SecretKey > nodeIdentity_
Validator keys and manifest as set in configuration file.
std::unique_ptr< DatabaseCon > mLedgerDB
std::unique_ptr< InboundLedgers > make_InboundLedgers(Application &app, InboundLedgers::clock_type &clock, Stoppable &parent, beast::insight::Collector::ptr const &collector)
Routing table for objects identified by hash.
void forceValidity(HashRouter &router, uint256 const &txid, Validity validity)
Sets the validity of a given transaction in the cache.
void onStart() override
Override called during start.
const ValidatorKeys validatorKeys_
std::unique_ptr< TimeKeeper > timeKeeper_
@ SYNCING
fallen slightly behind
std::condition_variable cv_
@ SigGoodOnly
Signature is good, but local checks fail.
void prepare()
Prepare all contained Stoppable objects.
RPC::ShardArchiveHandler * getShardArchiveHandler(bool tryRecovery) override
std::unique_ptr< InboundLedgers > m_inboundLedgers
std::unique_ptr< PeerReservationTable > peerReservations_
ServerHandler::Setup setup_ServerHandler(Config const &config, std::ostream &&log)
std::shared_ptr< Ledger > loadLedgerFromFile(std::string const &ledgerID)
bool checkSigs() const override
beast::Journal journal(std::string const &name) override
std::unique_ptr< NetworkOPs > make_NetworkOPs(Application &app, NetworkOPs::clock_type &clock, bool standalone, std::size_t minPeerCount, bool startvalid, JobQueue &job_queue, LedgerMaster &ledgerMaster, Stoppable &parent, ValidatorKeys const &validatorKeys, boost::asio::io_service &io_svc, beast::Journal journal, beast::insight::Collector::ptr const &collector)
boost::asio::steady_timer entropyTimer_
LedgerIndex getMaxDisallowedLedger() override
Ensure that a newly-started validator does not sign proposals older than the last ledger it persisted...
std::unique_ptr< HashRouter > hashRouter_
Application::MutexType & getMasterMutex() override
void stop(beast::Journal j)
Notify a root stoppable and children to stop, and block until stopped.
static std::uint32_t getDefaultRecoverLimit()
std::unique_ptr< LedgerMaster > m_ledgerMaster
bool isStopped() const
Returns true if the requested stop has completed.
Status doCommand(RPC::JsonContext &context, Json::Value &result)
Execute an RPC command and store the results in a Json::Value.
Overlay::Setup setup_Overlay(BasicConfig const &config)
perf::PerfLog & getPerfLog() override
std::unique_ptr< JobQueue > m_jobQueue
std::atomic< bool > checkSigs_
std::shared_ptr< Ledger > loadByHash(uint256 const &ledgerHash, Application &app, bool acquire)
static std::size_t numberOfThreads(Config const &config)
LockedSociSession checkoutDb()
SHAMapStore & getSHAMapStore() override
constexpr std::array< char const *, 1 > LgrDBPragma
void add(Source &source)
Add a child source.
AmendmentTable & getAmendmentTable() override
bool loadOldLedger(std::string const &ledgerID, bool replay, bool isFilename)
std::size_t size() const noexcept
T hardware_concurrency(T... args)
Caches SLEs by their digest.
Resource::Manager & getResourceManager() override
PeerReservationTable & peerReservations() override
ManifestCache & publisherManifests() override
void doStart(bool withTimers) override
std::unique_ptr< AmendmentTable > m_amendmentTable
Overlay & overlay() override
constexpr auto megabytes(T value) noexcept
PendingSaves & pendingSaves() override
std::unique_ptr< CollectorManager > m_collectorManager
static std::chrono::seconds getDefaultHoldTime()
void sample(Handler &&handler)
Initiate continuous i/o latency sampling.
TransactionMaster m_txMaster
A collection of historical shards.
Manages the current fee schedule.
bool set(T &target, std::string const &name, Section const §ion)
Set a value from a configuration Section If the named value is not found or doesn't parse as a T,...
void expire()
Discard expired entries.
bool listed(PublicKey const &identity) const
Returns true if public key is included on any lists.
constexpr unsigned int ApiMaximumSupportedVersion
ValidatorSite & validatorSites() override
bool SetHex(const char *psz, bool bStrict=false)
Parse a hex string into a base_uint The input can be:
std::unique_ptr< AmendmentTable > make_AmendmentTable(std::chrono::seconds majorityTime, Section const &supported, Section const &enabled, Section const &vetoed, beast::Journal journal)
std::pair< PublicKey, SecretKey > const & nodeIdentity() override
beast::insight::Event m_event
A metric for reporting event timing.
std::unique_ptr< Config > config_
std::string const & getVersionString()
Server version.
void setup(std::shared_ptr< ReadView const > const &ledger)
std::shared_ptr< Ledger > getLastFullLedger()
virtual time_point closeTime() const =0
Returns the close time, in network time.
bool configInvalid() const
io_latency_sampler m_io_latency_sampler
A generic endpoint for log messages.
bool isShutdown() override
void gotTXSet(std::shared_ptr< SHAMap > const &set, bool fromAcquire)
void startGenesisLedger()
boost::asio::signal_set m_signals
boost::optional< STObject > object
The STObject if the parse was successful.
Manages various times used by the server.
boost::optional< Wrapper< Closure > > wrap(Closure &&closure)
Wrap the passed closure with a reference counter.
TimeKeeper & timeKeeper() override
static std::unique_ptr< ShardArchiveHandler > makeShardArchiveHandler(Application &app, Stoppable &parent)
void operator()(Duration const &elapsed)
virtual void sweep()=0
Remove expired entries from the positive and negative caches.
Manages the lifetime of inbound ledgers.
Represents the open ledger.
void flush()
Flush all current validations.
A pool of threads to perform work.
void setMaxDisallowedLedger()
static std::unique_ptr< ShardArchiveHandler > tryMakeRecoveryHandler(Application &app, Stoppable &parent)
Tracks load and resource consumption.
std::unique_ptr< ShardFamily > shardFamily_
std::atomic< std::chrono::milliseconds > lastSample_
std::vector< std::string > const & supportedAmendments()
Amendments that this server supports, but doesn't enable by default.
std::unique_ptr< Overlay > overlay_
std::string const & getFullVersionString()
Full server version string.
OpenLedger & openLedger() override
PendingSaves pendingSaves_
void setJobQueue(JobQueue &jobQueue)
std::unique_ptr< ResolverAsio > m_resolver
Remembers manifests with the highest sequence number.
DatabaseCon::Setup setup_DatabaseCon(Config const &c, boost::optional< beast::Journal > j=boost::none)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
std::unique_ptr< Manager > make_Manager(beast::insight::Collector::ptr const &collector, beast::Journal journal)
NodeCache & getTempNodeCache() override
std::chrono::milliseconds get() const
void cancel()
Cancel all pending i/o.
Value removeMember(const char *key)
Remove and return the named member.
std::unique_ptr< GRPCServer > grpcServer_
void rawTxInsert(key_type const &key, std::shared_ptr< Serializer const > const &txn, std::shared_ptr< Serializer const > const &metaData) override
Add a transaction to the tx map.
JobQueue & getJobQueue() override
int fdRequired() const override
std::unique_ptr< SHAMapStore > make_SHAMapStore(Application &app, Stoppable &parent, NodeStore::Scheduler &scheduler, beast::Journal journal)
Source(std::string const &name)
Manages the set of connected peers.
OrderBookDB & getOrderBookDB() override
LoadManager & getLoadManager() override
bool lexicalCastChecked(Out &out, In in)
Intelligently convert from one type to another.
beast::io_latency_probe< std::chrono::steady_clock > m_probe
AccountIDCache accountIDCache_
NodeStoreScheduler m_nodeStoreScheduler
std::unique_ptr< LoadManager > m_loadManager
const create_genesis_t create_genesis
InboundTransactions & getInboundTransactions() override
bool parse(std::string const &document, Value &root)
Read a Value from a JSON document.
An endpoint that consumes resources.
std::unique_ptr< LoadFeeTrack > mFeeTrack
LoadFeeTrack & getFeeTrack() override
void addJson(Json::Value &json, LedgerFill const &fill)
Given a Ledger and options, fill a Json::Object or Json::Value with a description of the ledger.
constexpr std::array TxDBPragma
Handles the download and import of one or more shard archives.
Config & config() override
std::unique_ptr< ValidatorList > validators_
void join(char const *name, std::chrono::milliseconds wait, beast::Journal j)
Returns once all counted in-flight closures are destroyed.
io_latency_sampler(beast::insight::Event ev, beast::Journal journal, std::chrono::milliseconds interval, boost::asio::io_service &ios)
std::unique_ptr< ServerHandler > serverHandler_
std::unique_ptr< ManifestCache > validatorManifests_
std::unique_ptr< PathRequests > m_pathRequests
std::unique_ptr< NetworkOPs > m_networkOPs
Family & getNodeFamily() override
std::unique_ptr< TxQ > txQ_
constexpr std::array< char const *, 8 > TxDBInit
virtual std::unique_ptr< Database > make_Database(std::string const &name, Scheduler &scheduler, int readThreads, Stoppable &parent, Section const &backendParameters, beast::Journal journal)=0
Construct a NodeStore database.
static Manager & instance()
Returns the instance of the manager singleton.
constexpr std::array< char const *, 6 > WalletDBInit
Application::MutexType m_masterMutex
boost::asio::io_service & get_io_service()
std::atomic< LedgerIndex > maxDisallowedLedger_
std::unique_ptr< ManifestCache > publisherManifests_
The amendment table stores the list of enabled and potential amendments.
TransactionMaster & getMasterTransaction() override
std::unique_ptr< InboundTransactions > make_InboundTransactions(Application &app, Stoppable &parent, beast::insight::Collector::ptr const &collector, std::function< void(std::shared_ptr< SHAMap > const &, bool)> gotSet)
std::chrono::time_point< NetClock > time_point
bool isObjectOrNull() const
RCLValidations & getValidations() override
std::unique_ptr< Application > make_Application(std::unique_ptr< Config > config, std::unique_ptr< Logs > logs, std::unique_ptr< TimeKeeper > timeKeeper)
std::unique_ptr< ServerHandler > make_ServerHandler(Application &app, Stoppable &parent, boost::asio::io_service &io_service, JobQueue &jobQueue, NetworkOPs &networkOPs, Resource::Manager &resourceManager, CollectorManager &cm)
void notify(std::chrono::duration< Rep, Period > const &value) const
Push an event notification.
std::unique_ptr< Logs > logs_
Manages the acquisition and lifetime of transaction sets.
void onPrepare() override
Override called during preparation.
std::string asString() const
Returns the unquoted string value.
boost::optional< uint256 > getRegisteredFeature(std::string const &name)