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/main/Tuning.h>
37 #include <ripple/app/misc/AmendmentTable.h>
38 #include <ripple/app/misc/HashRouter.h>
39 #include <ripple/app/misc/LoadFeeTrack.h>
40 #include <ripple/app/misc/NetworkOPs.h>
41 #include <ripple/app/misc/SHAMapStore.h>
42 #include <ripple/app/misc/TxQ.h>
43 #include <ripple/app/misc/ValidatorKeys.h>
44 #include <ripple/app/misc/ValidatorSite.h>
45 #include <ripple/app/paths/PathRequests.h>
46 #include <ripple/app/reporting/ReportingETL.h>
47 #include <ripple/app/tx/apply.h>
48 #include <ripple/basics/ByteUtilities.h>
49 #include <ripple/basics/PerfLog.h>
50 #include <ripple/basics/ResolverAsio.h>
51 #include <ripple/basics/safe_cast.h>
52 #include <ripple/beast/asio/io_latency_probe.h>
53 #include <ripple/beast/core/LexicalCast.h>
54 #include <ripple/core/DatabaseCon.h>
55 #include <ripple/core/Pg.h>
56 #include <ripple/core/Stoppable.h>
57 #include <ripple/json/json_reader.h>
58 #include <ripple/nodestore/DatabaseShard.h>
59 #include <ripple/nodestore/DummyScheduler.h>
60 #include <ripple/overlay/Cluster.h>
61 #include <ripple/overlay/PeerReservationTable.h>
62 #include <ripple/overlay/make_Overlay.h>
63 #include <ripple/protocol/BuildInfo.h>
64 #include <ripple/protocol/Feature.h>
65 #include <ripple/protocol/Protocol.h>
66 #include <ripple/protocol/STParsedJSON.h>
67 #include <ripple/resource/Fees.h>
68 #include <ripple/rpc/ShardArchiveHandler.h>
69 #include <ripple/rpc/impl/RPCHelpers.h>
70 #include <ripple/shamap/NodeFamily.h>
71 #include <ripple/shamap/ShardFamily.h>
73 #include <boost/algorithm/string/predicate.hpp>
74 #include <boost/asio/steady_timer.hpp>
75 #include <boost/system/error_code.hpp>
104 boost::asio::io_service& ios)
118 template <
class Duration>
123 auto const lastSample = date::ceil<milliseconds>(elapsed);
127 if (lastSample >= 10ms)
129 if (lastSample >= 500ms)
132 <<
"io_service latency = " << lastSample.count();
167 #ifdef RIPPLED_REPORTING
244 #if RIPPLE_SINGLE_IO_SERVICE_THREAD
282 #ifdef RIPPLED_REPORTING
284 config_->reporting() ? make_PgPool(
285 config_->section(
"ledger_tx_tables"),
287 logs_->journal(
"PgPool"))
296 logs_->journal(
"SHAMapStore")))
305 logs_->journal(
"TaggedCache"))
308 config_->section(SECTION_INSIGHT),
309 logs_->journal(
"Collector")))
315 logs_->journal(
"Resource")))
323 logs_->journal(
"JobQueue"),
337 logs_->journal(
"ShardStore")))
343 logs_->journal(
"PathRequest"),
351 logs_->journal(
"LedgerMaster")))
367 gotTXSet(set, fromAcquire);
375 logs_->journal(
"TaggedCache"))
388 logs_->journal(
"NetworkOPs"),
391 ,
cluster_(std::make_unique<Cluster>(
logs_->journal(
"Overlay")))
394 logs_->journal(
"PeerReservationTable")))
397 std::make_unique<ManifestCache>(
logs_->journal(
"ManifestCache")))
400 std::make_unique<ManifestCache>(
logs_->journal(
"ManifestCache")))
406 config_->legacy(
"database_path"),
407 logs_->journal(
"ValidatorList"),
422 std::make_unique<LoadFeeTrack>(
logs_->journal(
"LoadManager")))
433 logs_->journal(
"Validations"))
456 logs_->journal(
"Application"),
490 doStart(
bool withTimers)
override;
568 boost::asio::io_service&
657 if (!handler->init())
660 <<
"Failed to initialize ShardArchiveHandler.";
676 <<
"ShardArchiveHandler already created at startup.";
684 if (!initAndSet(std::move(handler)))
694 if (!initAndSet(std::move(handler)))
819 Throw<ReportingShouldProxy>();
827 Throw<ReportingShouldProxy>();
841 assert(
txQ_.get() !=
nullptr);
848 assert(
mTxnDB.get() !=
nullptr);
858 #ifdef RIPPLED_REPORTING
892 assert(
mTxnDB.get() ==
nullptr);
904 mTxnDB = std::make_unique<DatabaseCon>(
911 mTxnDB->getSession() << boost::str(
912 boost::format(
"PRAGMA cache_size=-%d;") %
923 (
mTxnDB->getSession().prepare
924 << (
"PRAGMA table_info(AccountTransactions);"),
929 soci::into(dflt_value, ind),
938 <<
"AccountTransactions database "
939 "should not have a primary key";
947 mLedgerDB = std::make_unique<DatabaseCon>(
954 boost::format(
"PRAGMA cache_size=-%d;") %
957 else if (!
config_->reportingReadOnly())
959 #ifdef RIPPLED_REPORTING
965 setup.useGlobalPragma =
false;
966 mWalletDB = std::make_unique<DatabaseCon>(
975 <<
"Failed to initialize SQL databases: " << e.
what();
987 auto j =
logs_->journal(
"NodeObject");
1001 JLOG(j.warn()) <<
"Starting node import from '" << source->getName()
1005 auto const start = steady_clock::now();
1009 auto const elapsed =
1010 duration_cast<seconds>(steady_clock::now() -
start);
1011 JLOG(j.warn()) <<
"Node import from '" << source->getName()
1012 <<
"' took " << elapsed.count() <<
" seconds.";
1020 seconds{config_->getValueFor(SizedItem::ledgerAge)});
1033 JLOG(
m_journal.
info()) <<
"Application starting. Version is "
1036 using namespace std::chrono_literals;
1072 boost::system::error_code ec;
1077 <<
"Application: sweepTimer cancel error: " << ec.message();
1085 <<
"Application: entropyTimer cancel error: "
1091 using namespace std::chrono_literals;
1101 "ValidatorManifests",
1108 "PublisherManifests",
1133 [
this](boost::system::error_code
const& e) {
1134 if ((e.value() == boost::system::errc::success) &&
1135 (!m_jobQueue->isStopped()))
1138 jtSWEEP,
"sweep", [this](Job&) { doSweep(); });
1141 if (e.value() != boost::system::errc::success &&
1142 e.value() != boost::asio::error::operation_aborted)
1145 JLOG(m_journal.error())
1146 <<
"Sweep timer got error '" << e.message()
1147 <<
"'. Restarting timer.";
1155 sweepTimer_.async_wait(std::move(*optionalCountedHandler));
1164 [
this](boost::system::error_code
const& e) {
1165 if (e.value() == boost::system::errc::success)
1167 crypto_prng().mix_entropy();
1171 if (e.value() != boost::system::errc::success &&
1172 e.value() != boost::asio::error::operation_aborted)
1175 JLOG(m_journal.error())
1176 <<
"Entropy timer got error '" << e.message()
1177 <<
"'. Restarting timer.";
1182 using namespace std::chrono_literals;
1184 entropyTimer_.async_wait(std::move(*optionalCountedHandler));
1193 boost::filesystem::space_info space =
1194 boost::filesystem::space(
config_->legacy(
"database_path"));
1199 <<
"Remaining free disk space is less than 512MB";
1207 boost::system::error_code ec;
1208 boost::optional<std::uint64_t> dbSize =
1209 boost::filesystem::file_size(dbPath, ec);
1213 <<
"Error checking transaction db file size: "
1218 auto db =
mTxnDB->checkoutDb();
1219 static auto const pageSize = [&] {
1221 *db <<
"PRAGMA page_size;", soci::into(ps);
1224 static auto const maxPages = [&] {
1226 *db <<
"PRAGMA max_page_count;", soci::into(mp);
1230 *db <<
"PRAGMA page_count;", soci::into(pageCount);
1233 safe_cast<std::uint64_t>(freePages) * pageSize;
1235 <<
"Transaction DB pathname: " << dbPath.string()
1236 <<
"; file size: " << dbSize.value_or(-1) <<
" bytes"
1237 <<
"; SQLite page size: " << pageSize <<
" bytes"
1238 <<
"; Free pages: " << freePages
1239 <<
"; Free space: " << freeSpace <<
" bytes; "
1240 <<
"Note that this does not take into account available "
1247 <<
"Free SQLite space for transaction db is less than "
1248 "512MB. To fix this, rippled must be executed with "
1250 "vacuum parameter before restarting. "
1251 "Note that this activity can take multiple days, "
1252 "depending on database size.";
1276 #ifdef RIPPLED_REPORTING
1277 if (
config().reporting())
1278 pgPool_->idleSweeper();
1332 [
this](boost::system::error_code
const& ec,
int signum) {
1334 if (ec == boost::asio::error::operation_aborted)
1339 if (signum == SIGTERM || signum == SIGINT)
1343 assert(
mTxnDB ==
nullptr);
1345 auto debug_log =
config_->getDebugLogFile();
1347 if (!debug_log.empty())
1352 if (!
logs_->open(debug_log))
1353 std::cerr <<
"Can't open log file " << debug_log <<
'\n';
1364 JLOG(
m_journal.
warn()) <<
"Limited to a single I/O service thread by "
1365 "system configuration.";
1403 for (
auto const&
name : sa)
1410 Section supportedAmendments(
"Supported Amendments");
1411 supportedAmendments.append(saHashes);
1413 Section enabledAmendments =
config_->section(SECTION_AMENDMENTS);
1417 config().AMENDMENT_MAJORITY_TIME,
1418 supportedAmendments,
1420 config_->section(SECTION_VETO_AMENDMENTS),
1421 logs_->journal(
"Amendments"));
1426 auto const startUp =
config_->START_UP;
1447 <<
"The specified ledger could not be loaded.";
1466 if (!
config().reporting())
1473 JLOG(
m_journal.
fatal()) <<
"Invalid entry in cluster configuration.";
1477 if (!
config().reporting())
1485 "ValidatorManifests",
1488 .section(SECTION_VALIDATOR_KEY_REVOCATION)
1492 <<
"Invalid configured validator manifest.";
1501 config().section(SECTION_VALIDATORS).values(),
1502 config().section(SECTION_VALIDATOR_LIST_KEYS).values()))
1505 <<
"Invalid entry in validator configuration.";
1511 config().section(SECTION_VALIDATOR_LIST_SITES).values()))
1514 <<
"Invalid entry in [" << SECTION_VALIDATOR_LIST_SITES <<
"]";
1565 setup.makeContexts();
1572 stream <<
"Unable to setup server handler";
1574 stream <<
": " << e.
what();
1588 <<
"No outbound peer connections will be made";
1604 JLOG(
m_journal.
warn()) <<
"*** The server is configured to allow the "
1605 "'sign' and 'sign_for'";
1606 JLOG(
m_journal.
warn()) <<
"*** commands. These commands have security "
1607 "implications and have";
1608 JLOG(
m_journal.
warn()) <<
"*** been deprecated. They will be removed "
1609 "in a future release of";
1611 JLOG(
m_journal.
warn()) <<
"*** If you do not use them to sign "
1612 "transactions please edit your";
1614 <<
"*** configuration file and remove the [enable_signing] stanza.";
1615 JLOG(
m_journal.
warn()) <<
"*** If you do use them to sign transactions "
1616 "please migrate to a";
1618 <<
"*** standalone signing solution as soon as possible.";
1624 for (
auto cmd :
config_->section(SECTION_RPC_STARTUP).lines())
1629 if (!jrReader.
parse(cmd, jvCommand))
1632 << SECTION_RPC_STARTUP <<
"]: '" << cmd;
1638 <<
"Startup RPC: " << jvCommand <<
std::endl;
1677 shardArchiveHandler = handler;
1682 <<
"Exception when starting ShardArchiveHandler from "
1690 if (shardArchiveHandler && !shardArchiveHandler->
start())
1692 JLOG(
m_journal.
fatal()) <<
"Failed to start ShardArchiveHandler.";
1811 std::make_shared<Ledger>(*genesis,
timeKeeper().closeTime());
1812 next->updateSkipList();
1831 ledger->setImmutable(*
config_);
1834 ledger->setValidated();
1836 if (ledger->info().hash == hash)
1838 JLOG(j.trace()) <<
"Loaded ledger: " << hash;
1842 if (
auto stream = j.error())
1844 stream <<
"Failed on ledger";
1854 JLOG(j.warn()) <<
"Ledger in database: " << mn.
what();
1875 if (!reader.
parse(ledgerFile, jLedger))
1884 if (ledger.
get().isMember(
"result"))
1885 ledger = ledger.
get()[
"result"];
1887 if (ledger.
get().isMember(
"ledger"))
1888 ledger = ledger.
get()[
"ledger"];
1892 using namespace std::chrono_literals;
1893 auto closeTimeResolution = 30s;
1894 bool closeTimeEstimated =
false;
1897 if (ledger.
get().isMember(
"accountState"))
1899 if (ledger.
get().isMember(jss::ledger_index))
1901 seq = ledger.
get()[jss::ledger_index].asUInt();
1904 if (ledger.
get().isMember(
"close_time"))
1907 using d = tp::duration;
1908 closeTime = tp{d{ledger.
get()[
"close_time"].asUInt()}};
1910 if (ledger.
get().isMember(
"close_time_resolution"))
1913 closeTimeResolution =
1914 seconds{ledger.
get()[
"close_time_resolution"].asUInt()};
1916 if (ledger.
get().isMember(
"close_time_estimated"))
1918 closeTimeEstimated =
1919 ledger.
get()[
"close_time_estimated"].asBool();
1921 if (ledger.
get().isMember(
"total_coins"))
1923 totalDrops = beast::lexicalCastThrow<std::uint64_t>(
1924 ledger.
get()[
"total_coins"].asString());
1927 ledger = ledger.
get()[
"accountState"];
1930 if (!ledger.
get().isArrayOrNull())
1938 loadLedger->setTotalDrops(totalDrops);
1940 for (
Json::UInt index = 0; index < ledger.
get().size(); ++index)
1972 if (!loadLedger->addSLE(sle))
1975 <<
"Couldn't add serialized ledger: " << uIndex;
1982 loadLedger->setAccepted(
1983 closeTime, closeTimeResolution, !closeTimeEstimated, *
config_);
2006 if (!ledgerID.
empty())
2009 else if (ledgerID.
length() == 64)
2020 auto il = std::make_shared<InboundLedger>(
2026 if (il->checkLocal())
2027 loadLedger = il->getLedger();
2031 else if (ledgerID.
empty() || boost::iequals(ledgerID,
"latest"))
2052 replayLedger = loadLedger;
2056 loadLedger =
loadByHash(replayLedger->info().parentHash, *
this);
2060 <<
"Loading parent ledger from node store";
2063 auto il = std::make_shared<InboundLedger>(
2065 replayLedger->info().parentHash,
2070 if (il->checkLocal())
2071 loadLedger = il->getLedger();
2081 using namespace std::chrono_literals;
2082 using namespace date;
2084 sys_days{January / 1 / 2018} - sys_days{January / 1 / 2000}};
2085 if (loadLedger->info().closeTime < ledgerWarnTimePoint)
2088 <<
"\n\n*** WARNING ***\n"
2089 "You are replaying a ledger from before "
2092 "This replay will not handle your ledger as it was "
2094 "handled.\nConsider running an earlier version of rippled "
2096 "get the older rules.\n*** CONTINUING ***\n";
2099 JLOG(
m_journal.
info()) <<
"Loading ledger " << loadLedger->info().hash
2100 <<
" seq:" << loadLedger->info().seq;
2102 if (loadLedger->info().accountHash.isZero())
2109 if (!loadLedger->walkLedger(
journal(
"Ledger")))
2116 if (!loadLedger->assertSensible(
journal(
"Ledger")))
2124 loadLedger->info().seq, loadLedger->info().seq);
2127 loadLedger->setValidated();
2137 std::make_unique<LedgerReplay>(loadLedger, replayLedger);
2139 for (
auto const& [_, tx] : replayData->orderedTxns())
2142 auto txID = tx->getTransactionID();
2144 auto s = std::make_shared<Serializer>();
2162 <<
"While loading specified ledger: " << mn.
what();
2165 catch (boost::bad_lexical_cast&)
2168 <<
"Ledger specified '" << ledgerID <<
"' is not valid";
2178 if (!
config().ELB_SUPPORT)
2183 reason =
"Server is shutting down";
2187 if (
getOPs().isNeedNetworkLedger())
2189 reason =
"Not synchronized with network yet";
2193 if (
getOPs().isAmendmentBlocked())
2195 reason =
"Server version too old";
2199 if (
getOPs().isUNLBlocked())
2201 reason =
"No valid validator list available";
2207 reason =
"Not synchronized with network";
2216 reason =
"Too much load";
2233 assert(!
config_->standalone());
2238 <<
"The [shard_db] configuration setting must be set";
2253 if (
config().reporting())
2255 #ifdef RIPPLED_REPORTING
2256 auto seq = PgQuery(pgPool_)(
"SELECT max_ledger()");
2257 if (seq && !seq.isNull())
2263 boost::optional<LedgerIndex> seq;
2266 *db <<
"SELECT MAX(LedgerSeq) FROM Ledgers;", soci::into(seq);
2290 return std::make_unique<ApplicationImp>(
2291 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.
ReportingETL & getReportingETL() override
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_
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
bool start()
Starts downloading and importing archives.
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
virtual std::unique_ptr< Database > make_Database(std::string const &name, std::size_t burstSize, Scheduler &scheduler, int readThreads, Stoppable &parent, Section const &backendParameters, beast::Journal journal)=0
Construct a NodeStore database.
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".
std::tuple< std::shared_ptr< Ledger >, std::uint32_t, uint256 > getLatestLedger(Application &app)
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.
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
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.
std::unique_ptr< AmendmentTable > make_AmendmentTable(Application &app, std::chrono::seconds majorityTime, Section const &supported, Section const &enabled, Section const &vetoed, beast::Journal journal)
void setup(std::shared_ptr< ReadView const > const &ledger)
This class is responsible for continuously extracting data from a p2p node, and writing that data to ...
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
bool parseHex(std::string_view sv)
Parse a hex string into a base_uint.
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
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
std::unique_ptr< ReportingETL > reportingETL_
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.
std::string asString() const
Returns the unquoted string value.
boost::optional< uint256 > getRegisteredFeature(std::string const &name)