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/LoadManager.h>
33 #include <ripple/app/main/NodeIdentity.h>
34 #include <ripple/app/main/NodeStoreScheduler.h>
35 #include <ripple/app/main/Tuning.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/Sustain.h>
50 #include <ripple/basics/safe_cast.h>
51 #include <ripple/beast/asio/io_latency_probe.h>
52 #include <ripple/beast/core/LexicalCast.h>
53 #include <ripple/core/DatabaseCon.h>
54 #include <ripple/core/Stoppable.h>
55 #include <ripple/json/json_reader.h>
56 #include <ripple/nodestore/DatabaseShard.h>
57 #include <ripple/nodestore/DummyScheduler.h>
58 #include <ripple/overlay/Cluster.h>
59 #include <ripple/overlay/PeerReservationTable.h>
60 #include <ripple/overlay/make_Overlay.h>
61 #include <ripple/protocol/BuildInfo.h>
62 #include <ripple/protocol/Feature.h>
63 #include <ripple/protocol/Protocol.h>
64 #include <ripple/protocol/STParsedJSON.h>
65 #include <ripple/resource/Fees.h>
66 #include <ripple/rpc/ShardArchiveHandler.h>
67 #include <ripple/rpc/impl/RPCHelpers.h>
69 #include <ripple/app/main/GRPCServer.h>
70 #include <boost/algorithm/string/predicate.hpp>
71 #include <boost/asio/steady_timer.hpp>
72 #include <boost/system/error_code.hpp>
111 JLOG(j.error()) <<
"Missing node in " <<
to_string(hash);
134 std::chrono::minutes{1},
136 app.journal(
"TaggedCache"))
140 collectorManager.collector(),
145 ,
j_(app.journal(
"SHAMap"))
202 JLOG(j.error()) <<
"Missing node in " << seq;
271 boost::asio::io_service& ios)
285 template <
class Duration>
290 auto const lastSample = date::ceil<milliseconds>(elapsed);
294 if (lastSample >= 10ms)
296 if (lastSample >= 500ms)
299 <<
"io_service latency = " << lastSample.count();
406 #if RIPPLE_SINGLE_IO_SERVICE_THREAD
451 logs_->journal(
"SHAMapStore")))
460 logs_->journal(
"TaggedCache"))
463 config_->section(SECTION_INSIGHT),
464 logs_->journal(
"Collector")))
470 logs_->journal(
"Resource")))
478 logs_->journal(
"JobQueue"),
492 logs_->journal(
"ShardStore")))
498 logs_->journal(
"PathRequest"),
506 logs_->journal(
"LedgerMaster")))
523 gotTXSet(set, fromAcquire);
531 logs_->journal(
"TaggedCache"))
544 logs_->journal(
"NetworkOPs"),
547 ,
cluster_(std::make_unique<Cluster>(
logs_->journal(
"Overlay")))
550 logs_->journal(
"PeerReservationTable")))
553 std::make_unique<ManifestCache>(
logs_->journal(
"ManifestCache")))
556 std::make_unique<ManifestCache>(
logs_->journal(
"ManifestCache")))
562 config_->legacy(
"database_path"),
563 logs_->journal(
"ValidatorList"),
578 std::make_unique<LoadFeeTrack>(
logs_->journal(
"LoadManager")))
589 logs_->journal(
"Validations"))
611 logs_->journal(
"Application"),
644 doStart(
bool withTimers)
override;
720 boost::asio::io_service&
929 assert(
txQ_.get() !=
nullptr);
936 assert(
mTxnDB.get() !=
nullptr);
963 assert(
mTxnDB.get() ==
nullptr);
972 mTxnDB = std::make_unique<DatabaseCon>(
974 mTxnDB->getSession() << boost::str(
975 boost::format(
"PRAGMA cache_size=-%d;") %
988 (
mTxnDB->getSession().prepare
989 << (
"PRAGMA table_info(AccountTransactions);"),
994 soci::into(dflt_value, ind),
1003 <<
"AccountTransactions database "
1004 "should not have a primary key";
1011 mLedgerDB = std::make_unique<DatabaseCon>(
1014 boost::format(
"PRAGMA cache_size=-%d;") %
1019 mWalletDB = std::make_unique<DatabaseCon>(
1028 <<
"Failed to initialize SQLite databases: " << e.
what();
1040 auto j =
logs_->journal(
"NodeObject");
1052 JLOG(j.warn()) <<
"Starting node import from '" << source->getName()
1056 auto const start = steady_clock::now();
1060 auto const elapsed =
1061 duration_cast<seconds>(steady_clock::now() -
start);
1062 JLOG(j.warn()) <<
"Node import from '" << source->getName()
1063 <<
"' took " << elapsed.count() <<
" seconds.";
1070 seconds{config_->getValueFor(SizedItem::nodeCacheAge)});
1074 seconds{config_->getValueFor(SizedItem::ledgerAge)});
1085 signalled(
const boost::system::error_code& ec,
int signal_number)
1087 if (ec == boost::asio::error::operation_aborted)
1095 <<
" with error: " << ec.message();
1117 JLOG(
m_journal.
info()) <<
"Application starting. Version is "
1120 using namespace std::chrono_literals;
1156 boost::system::error_code ec;
1161 <<
"Application: sweepTimer cancel error: " << ec.message();
1169 <<
"Application: entropyTimer cancel error: "
1175 using namespace std::chrono_literals;
1185 "ValidatorManifests",
1192 "PublisherManifests",
1217 [
this](boost::system::error_code
const& e) {
1218 if ((e.value() == boost::system::errc::success) &&
1219 (!m_jobQueue->isStopped()))
1222 jtSWEEP,
"sweep", [this](Job&) { doSweep(); });
1225 if (e.value() != boost::system::errc::success &&
1226 e.value() != boost::asio::error::operation_aborted)
1229 JLOG(m_journal.error())
1230 <<
"Sweep timer got error '" << e.message()
1231 <<
"'. Restarting timer.";
1239 sweepTimer_.async_wait(std::move(*optionalCountedHandler));
1248 [
this](boost::system::error_code
const& e) {
1249 if (e.value() == boost::system::errc::success)
1251 crypto_prng().mix_entropy();
1255 if (e.value() != boost::system::errc::success &&
1256 e.value() != boost::asio::error::operation_aborted)
1259 JLOG(m_journal.error())
1260 <<
"Entropy timer got error '" << e.message()
1261 <<
"'. Restarting timer.";
1266 using namespace std::chrono_literals;
1268 entropyTimer_.async_wait(std::move(*optionalCountedHandler));
1277 boost::filesystem::space_info space =
1278 boost::filesystem::space(
config_->legacy(
"database_path"));
1283 <<
"Remaining free disk space is less than 512MB";
1289 boost::system::error_code ec;
1290 boost::optional<std::uint64_t> dbSize =
1291 boost::filesystem::file_size(dbPath, ec);
1295 <<
"Error checking transaction db file size: "
1300 auto db =
mTxnDB->checkoutDb();
1301 static auto const pageSize = [&] {
1303 *db <<
"PRAGMA page_size;", soci::into(ps);
1306 static auto const maxPages = [&] {
1308 *db <<
"PRAGMA max_page_count;", soci::into(mp);
1312 *db <<
"PRAGMA page_count;", soci::into(pageCount);
1315 safe_cast<std::uint64_t>(freePages) * pageSize;
1317 <<
"Transaction DB pathname: " << dbPath.string()
1318 <<
"; file size: " << dbSize.value_or(-1) <<
" bytes"
1319 <<
"; SQLite page size: " << pageSize <<
" bytes"
1320 <<
"; Free pages: " << freePages
1321 <<
"; Free space: " << freeSpace <<
" bytes; "
1322 <<
"Note that this does not take into account available disk "
1328 <<
"Free SQLite space for transaction db is less than "
1329 "512MB. To fix this, rippled must be executed with the "
1330 "vacuum <sqlitetmpdir> parameter before restarting. "
1331 "Note that this activity can take multiple days, "
1332 "depending on database size.";
1408 std::placeholders::_1,
1409 std::placeholders::_2));
1411 assert(
mTxnDB ==
nullptr);
1413 auto debug_log =
config_->getDebugLogFile();
1415 if (!debug_log.empty())
1420 if (!
logs_->open(debug_log))
1421 std::cerr <<
"Can't open log file " << debug_log <<
'\n';
1432 JLOG(
m_journal.
warn()) <<
"Limited to a single I/O service thread by "
1433 "system configuration.";
1477 for (
auto const&
name : sa)
1484 Section supportedAmendments(
"Supported Amendments");
1485 supportedAmendments.append(saHashes);
1487 Section enabledAmendments =
config_->section(SECTION_AMENDMENTS);
1492 supportedAmendments,
1494 config_->section(SECTION_VETO_AMENDMENTS),
1495 logs_->journal(
"Amendments"));
1500 auto const startUp =
config_->START_UP;
1519 <<
"The specified ledger could not be loaded.";
1543 JLOG(
m_journal.
fatal()) <<
"Invalid entry in cluster configuration.";
1553 "ValidatorManifests",
1555 config().section(SECTION_VALIDATOR_KEY_REVOCATION).values()))
1557 JLOG(
m_journal.
fatal()) <<
"Invalid configured validator manifest.";
1566 config().section(SECTION_VALIDATORS).values(),
1567 config().section(SECTION_VALIDATOR_LIST_KEYS).values()))
1570 <<
"Invalid entry in validator configuration.";
1576 config().section(SECTION_VALIDATOR_LIST_SITES).values()))
1579 <<
"Invalid entry in [" << SECTION_VALIDATOR_LIST_SITES <<
"]";
1631 setup.makeContexts();
1638 stream <<
"Unable to setup server handler";
1640 stream <<
": " << e.
what();
1654 <<
"No outbound peer connections will be made";
1670 JLOG(
m_journal.
warn()) <<
"*** The server is configured to allow the "
1671 "'sign' and 'sign_for'";
1672 JLOG(
m_journal.
warn()) <<
"*** commands. These commands have security "
1673 "implications and have";
1674 JLOG(
m_journal.
warn()) <<
"*** been deprecated. They will be removed "
1675 "in a future release of";
1677 JLOG(
m_journal.
warn()) <<
"*** If you do not use them to sign "
1678 "transactions please edit your";
1680 <<
"*** configuration file and remove the [enable_signing] stanza.";
1681 JLOG(
m_journal.
warn()) <<
"*** If you do use them to sign transactions "
1682 "please migrate to a";
1684 <<
"*** standalone signing solution as soon as possible.";
1690 for (
auto cmd :
config_->section(SECTION_RPC_STARTUP).lines())
1695 if (!jrReader.
parse(cmd, jvCommand))
1698 << SECTION_RPC_STARTUP <<
"]: '" << cmd;
1704 <<
"Startup RPC: " << jvCommand <<
std::endl;
1731 using namespace boost::filesystem;
1739 if (exists(stateDb) && is_regular_file(stateDb) &&
1747 if (!handler->initFromDB())
1750 <<
"Failed to initialize ShardArchiveHandler.";
1755 if (!handler->start())
1758 <<
"Failed to start ShardArchiveHandler.";
1767 <<
"Exception when starting ShardArchiveHandler from "
1847 needed +=
static_cast<int>(0.5 + (1.5 *
overlay_->limit()));
1879 std::make_shared<Ledger>(*genesis,
timeKeeper().closeTime());
1880 next->updateSkipList();
1894 auto const [ledger, seq, hash] =
1900 ledger->setImmutable(*
config_);
1903 ledger->setValidated();
1905 if (ledger->info().hash == hash)
1907 JLOG(j.trace()) <<
"Loaded ledger: " << hash;
1911 if (
auto stream = j.error())
1913 stream <<
"Failed on ledger";
1923 JLOG(j.warn()) <<
"Ledger in database: " << mn.
what();
1944 if (!reader.
parse(ledgerFile, jLedger))
1953 if (ledger.
get().isMember(
"result"))
1954 ledger = ledger.
get()[
"result"];
1956 if (ledger.
get().isMember(
"ledger"))
1957 ledger = ledger.
get()[
"ledger"];
1961 using namespace std::chrono_literals;
1962 auto closeTimeResolution = 30s;
1963 bool closeTimeEstimated =
false;
1966 if (ledger.
get().isMember(
"accountState"))
1968 if (ledger.
get().isMember(jss::ledger_index))
1970 seq = ledger.
get()[jss::ledger_index].asUInt();
1973 if (ledger.
get().isMember(
"close_time"))
1976 using d = tp::duration;
1977 closeTime = tp{d{ledger.
get()[
"close_time"].asUInt()}};
1979 if (ledger.
get().isMember(
"close_time_resolution"))
1982 closeTimeResolution =
1983 seconds{ledger.
get()[
"close_time_resolution"].asUInt()};
1985 if (ledger.
get().isMember(
"close_time_estimated"))
1987 closeTimeEstimated =
1988 ledger.
get()[
"close_time_estimated"].asBool();
1990 if (ledger.
get().isMember(
"total_coins"))
1992 totalDrops = beast::lexicalCastThrow<std::uint64_t>(
1993 ledger.
get()[
"total_coins"].asString());
1996 ledger = ledger.
get()[
"accountState"];
1999 if (!ledger.
get().isArrayOrNull())
2006 std::make_shared<Ledger>(seq, closeTime, *
config_,
family());
2007 loadLedger->setTotalDrops(totalDrops);
2009 for (
Json::UInt index = 0; index < ledger.
get().size(); ++index)
2041 if (!loadLedger->addSLE(sle))
2044 <<
"Couldn't add serialized ledger: " << uIndex;
2049 loadLedger->stateMap().flushDirty(
2052 loadLedger->setAccepted(
2053 closeTime, closeTimeResolution, !closeTimeEstimated, *
config_);
2076 if (!ledgerID.
empty())
2079 else if (ledgerID.
length() == 64)
2083 if (hash.
SetHex(ledgerID))
2090 auto il = std::make_shared<InboundLedger>(
2096 if (il->checkLocal())
2097 loadLedger = il->getLedger();
2101 else if (ledgerID.
empty() || boost::iequals(ledgerID,
"latest"))
2122 replayLedger = loadLedger;
2126 loadLedger =
loadByHash(replayLedger->info().parentHash, *
this);
2130 <<
"Loading parent ledger from node store";
2133 auto il = std::make_shared<InboundLedger>(
2135 replayLedger->info().parentHash,
2140 if (il->checkLocal())
2141 loadLedger = il->getLedger();
2151 using namespace std::chrono_literals;
2152 using namespace date;
2154 sys_days{January / 1 / 2018} - sys_days{January / 1 / 2000}};
2155 if (loadLedger->info().closeTime < ledgerWarnTimePoint)
2158 <<
"\n\n*** WARNING ***\n"
2159 "You are replaying a ledger from before "
2162 "This replay will not handle your ledger as it was "
2164 "handled.\nConsider running an earlier version of rippled "
2166 "get the older rules.\n*** CONTINUING ***\n";
2169 JLOG(
m_journal.
info()) <<
"Loading ledger " << loadLedger->info().hash
2170 <<
" seq:" << loadLedger->info().seq;
2172 if (loadLedger->info().accountHash.isZero())
2179 if (!loadLedger->walkLedger(
journal(
"Ledger")))
2186 if (!loadLedger->assertSane(
journal(
"Ledger")))
2194 loadLedger->info().seq, loadLedger->info().seq);
2197 loadLedger->setValidated();
2207 std::make_unique<LedgerReplay>(loadLedger, replayLedger);
2209 for (
auto const& [_, tx] : replayData->orderedTxns())
2212 auto txID = tx->getTransactionID();
2214 auto s = std::make_shared<Serializer>();
2232 <<
"While loading specified ledger: " << mn.
what();
2235 catch (boost::bad_lexical_cast&)
2238 <<
"Ledger specified '" << ledgerID <<
"' is not valid";
2248 if (!
config().ELB_SUPPORT)
2253 reason =
"Server is shutting down";
2257 if (
getOPs().isNeedNetworkLedger())
2259 reason =
"Not synchronized with network yet";
2265 reason =
"Not synchronized with network";
2274 reason =
"Too much load";
2278 if (
getOPs().isAmendmentBlocked())
2280 reason =
"Server version too old";
2297 assert(!
config_->standalone());
2302 <<
"The [shard_db] configuration setting must be set";
2318 assert(!
config_->standalone());
2323 <<
"The [shard_db] configuration setting must be set";
2338 boost::optional<LedgerIndex> seq;
2341 *db <<
"SELECT MAX(LedgerSeq) FROM Ledgers;", soci::into(seq);
2364 return std::make_unique<ApplicationImp>(
2365 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.
AppFamily(AppFamily const &)=delete
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)
static boost::filesystem::path getDownloadDirectory(Config const &config)
constexpr auto WalletDBName
void missing_node(uint256 const &hash, std::uint32_t seq) override
TreeNodeCache & treecache() override
DatabaseCon & getLedgerDB() override
void activateDeadlockDetector()
Turn on deadlock detection.
std::unique_ptr< InboundTransactions > m_inboundTransactions
std::vector< std::unique_ptr< Stoppable > > websocketServers_
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< detail::AppFamily > shardFamily_
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.
void missing_node(std::uint32_t seq) override
static pointer recoverInstance(Application &app, Stoppable &parent)
static std::string shardDatabase()
std::unique_ptr< AmendmentTable > make_AmendmentTable(std::chrono::seconds majorityTime, int majorityFraction, Section const &supported, Section const &enabled, Section const &vetoed, beast::Journal journal)
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
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.
constexpr std::chrono::seconds fullBelowExpiration
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)
Family & family() override
static std::unique_ptr< ResolverAsio > New(boost::asio::io_service &, beast::Journal)
detail::AppFamily family_
NodeStore::Database & db_
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
AppFamily(Application &app, NodeStore::Database &db, CollectorManager &collectorManager)
std::unique_ptr< InboundLedgers > make_InboundLedgers(Application &app, InboundLedgers::clock_type &clock, Stoppable &parent, beast::insight::Collector::ptr const &collector)
FullBelowCache & fullbelow() override
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.
virtual InboundLedgers & getInboundLedgers()=0
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.
AppFamily & operator=(AppFamily const &)=delete
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_
DatabaseCon::Setup setup_DatabaseCon(Config const &c)
std::shared_ptr< Ledger > loadByHash(uint256 const &ledgerHash, Application &app, bool acquire)
static std::size_t numberOfThreads(Config const &config)
LockedSociSession checkoutDb()
constexpr std::array< char const *, 3 > LgrDBPragma
SHAMapStore & getSHAMapStore() override
void add(Source &source)
Add a child source.
AmendmentTable & getAmendmentTable() override
bool loadOldLedger(std::string const &ledgerID, bool replay, bool isFilename)
virtual LedgerMaster & getLedgerMaster()=0
virtual std::shared_ptr< Ledger const > acquire(uint256 const &hash, std::uint32_t seq, InboundLedger::Reason)=0
void sweep()
Remove expired cache items.
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.
TreeNodeCache const & treecache() const override
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.
std::unique_ptr< InboundTransactions > make_InboundTransactions(Application &app, InboundLedgers::clock_type &clock, Stoppable &parent, beast::insight::Collector::ptr const &collector, std::function< void(std::shared_ptr< SHAMap > const &, bool)> gotSet)
FullBelowCache fullbelow_
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::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
void operator()(Duration const &elapsed)
virtual void sweep()=0
Remove expired entries from the positive and negative caches.
std::unique_ptr< TxQ > make_TxQ(TxQ::Setup const &setup, beast::Journal j)
TxQ object factory.
Manages the lifetime of inbound ledgers.
Represents the open ledger.
virtual TreeNodeCache & treecache()=0
void flush()
Flush all current validations.
constexpr std::size_t fullBelowTargetSize
A pool of threads to perform work.
FullBelowCache const & fullbelow() const override
void setMaxDisallowedLedger()
NodeStore::Database & db() override
Tracks load and resource consumption.
Family * shardFamily() override
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.
static constexpr auto stateDBName
OpenLedger & openLedger() override
PendingSaves pendingSaves_
void setJobQueue(JobQueue &jobQueue)
std::unique_ptr< ResolverAsio > m_resolver
Remembers manifests with the highest sequence number.
void setTargetAge(clock_type::duration s)
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)
virtual beast::Journal journal(std::string const &name)=0
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)
void setTargetSize(int s)
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::Journal const & journal() override
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.
void acquire(uint256 const &hash, std::uint32_t seq)
std::unique_ptr< LoadFeeTrack > mFeeTrack
static const int MAJORITY_FRACTION(204)
std::string StopSustain()
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.
void signalled(const boost::system::error_code &ec, int signal_number)
static bool hasInstance()
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_
virtual FullBelowCache & fullbelow()=0
std::unique_ptr< ManifestCache > validatorManifests_
std::unique_ptr< PathRequests > m_pathRequests
std::unique_ptr< NetworkOPs > m_networkOPs
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_
uint256 getHashBySeq(std::uint32_t index)
Get a ledger's hash by sequence number using the cache.
std::unique_ptr< ManifestCache > publisherManifests_
The amendment table stores the list of enabled and potential amendments.
TransactionMaster & getMasterTransaction() override
constexpr std::array< char const *, 5 > TxDBPragma
std::chrono::time_point< NetClock > time_point
bool isShardBacked() const override
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)
NodeStore::Database const & db() const override
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)