rippled
Application.cpp
1 //------------------------------------------------------------------------------
2 /*
3  This file is part of rippled: https://github.com/ripple/rippled
4  Copyright (c) 2012, 2013 Ripple Labs Inc.
5 
6  Permission to use, copy, modify, and/or distribute this software for any
7  purpose with or without fee is hereby granted, provided that the above
8  copyright notice and this permission notice appear in all copies.
9 
10  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13  ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18 //==============================================================================
19 
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/LedgerCleaner.h>
24 #include <ripple/app/ledger/LedgerMaster.h>
25 #include <ripple/app/ledger/LedgerReplayer.h>
26 #include <ripple/app/ledger/LedgerToJson.h>
27 #include <ripple/app/ledger/OpenLedger.h>
28 #include <ripple/app/ledger/OrderBookDB.h>
29 #include <ripple/app/ledger/PendingSaves.h>
30 #include <ripple/app/ledger/TransactionMaster.h>
31 #include <ripple/app/main/Application.h>
32 #include <ripple/app/main/BasicApp.h>
33 #include <ripple/app/main/DBInit.h>
34 #include <ripple/app/main/GRPCServer.h>
35 #include <ripple/app/main/LoadManager.h>
36 #include <ripple/app/main/NodeIdentity.h>
37 #include <ripple/app/main/NodeStoreScheduler.h>
38 #include <ripple/app/main/Tuning.h>
39 #include <ripple/app/misc/AmendmentTable.h>
40 #include <ripple/app/misc/HashRouter.h>
41 #include <ripple/app/misc/LoadFeeTrack.h>
42 #include <ripple/app/misc/NetworkOPs.h>
43 #include <ripple/app/misc/SHAMapStore.h>
44 #include <ripple/app/misc/TxQ.h>
45 #include <ripple/app/misc/ValidatorKeys.h>
46 #include <ripple/app/misc/ValidatorSite.h>
47 #include <ripple/app/paths/PathRequests.h>
48 #include <ripple/app/rdb/Wallet.h>
49 #include <ripple/app/rdb/backend/PostgresDatabase.h>
50 #include <ripple/app/reporting/ReportingETL.h>
51 #include <ripple/app/tx/apply.h>
52 #include <ripple/basics/ByteUtilities.h>
53 #include <ripple/basics/PerfLog.h>
54 #include <ripple/basics/ResolverAsio.h>
55 #include <ripple/basics/safe_cast.h>
56 #include <ripple/beast/asio/io_latency_probe.h>
57 #include <ripple/beast/core/LexicalCast.h>
58 #include <ripple/core/DatabaseCon.h>
59 #include <ripple/json/json_reader.h>
60 #include <ripple/nodestore/DatabaseShard.h>
61 #include <ripple/nodestore/DummyScheduler.h>
62 #include <ripple/overlay/Cluster.h>
63 #include <ripple/overlay/PeerReservationTable.h>
64 #include <ripple/overlay/PeerSet.h>
65 #include <ripple/overlay/make_Overlay.h>
66 #include <ripple/protocol/BuildInfo.h>
67 #include <ripple/protocol/Feature.h>
68 #include <ripple/protocol/Protocol.h>
69 #include <ripple/protocol/STParsedJSON.h>
70 #include <ripple/resource/Fees.h>
71 #include <ripple/rpc/ShardArchiveHandler.h>
72 #include <ripple/rpc/impl/RPCHelpers.h>
73 #include <ripple/shamap/NodeFamily.h>
74 #include <ripple/shamap/ShardFamily.h>
75 
76 #include <boost/algorithm/string/predicate.hpp>
77 #include <boost/asio/steady_timer.hpp>
78 #include <boost/system/error_code.hpp>
79 
80 #include <date/date.h>
81 
82 #include <chrono>
83 #include <condition_variable>
84 #include <cstring>
85 #include <iostream>
86 #include <limits>
87 #include <mutex>
88 #include <optional>
89 #include <sstream>
90 #include <utility>
91 #include <variant>
92 
93 namespace ripple {
94 
95 // VFALCO TODO Move the function definitions into the class declaration
96 class ApplicationImp : public Application, public BasicApp
97 {
98 private:
100  {
101  private:
106 
107  public:
111  std::chrono::milliseconds interval,
112  boost::asio::io_service& ios)
113  : m_event(ev)
114  , m_journal(journal)
115  , m_probe(interval, ios)
116  , lastSample_{}
117  {
118  }
119 
120  void
122  {
123  m_probe.sample(std::ref(*this));
124  }
125 
126  template <class Duration>
127  void
128  operator()(Duration const& elapsed)
129  {
130  using namespace std::chrono;
131  auto const lastSample = ceil<milliseconds>(elapsed);
132 
133  lastSample_ = lastSample;
134 
135  if (lastSample >= 10ms)
136  m_event.notify(lastSample);
137  if (lastSample >= 500ms)
138  {
139  JLOG(m_journal.warn())
140  << "io_service latency = " << lastSample.count();
141  }
142  }
143 
145  get() const
146  {
147  return lastSample_.load();
148  }
149 
150  void
152  {
153  m_probe.cancel();
154  }
155 
156  void
158  {
160  }
161  };
162 
163 public:
167 
171 
172  // Required by the SHAMapStore
174 
182 
187 
189 
195  // VFALCO TODO Make OrderBookDB abstract
219  boost::asio::steady_timer sweepTimer_;
220  boost::asio::steady_timer entropyTimer_;
221 
225 
226  boost::asio::signal_set m_signals;
227 
228  // Once we get C++20, we could use `std::atomic_flag` for `isTimeToStop`
229  // and eliminate the need for the condition variable and the mutex.
233 
235 
237 
239 
242 
243  //--------------------------------------------------------------------------
244 
245  static std::size_t
247  {
248 #if RIPPLE_SINGLE_IO_SERVICE_THREAD
249  return 1;
250 #else
251 
252  if (config.IO_WORKERS > 0)
253  return config.IO_WORKERS;
254 
255  auto const cores = std::thread::hardware_concurrency();
256 
257  // Use a single thread when running on under-provisioned systems
258  // or if we are configured to use minimal resources.
259  if ((cores == 1) || ((config.NODE_SIZE == 0) && (cores == 2)))
260  return 1;
261 
262  // Otherwise, prefer two threads.
263  return 2;
264 #endif
265  }
266 
267  //--------------------------------------------------------------------------
268 
274  , config_(std::move(config))
275  , logs_(std::move(logs))
276  , timeKeeper_(std::move(timeKeeper))
277  , m_journal(logs_->journal("Application"))
278 
279  // PerfLog must be started before any other threads are launched.
280  , perfLog_(perf::make_PerfLog(
281  perf::setup_PerfLog(
282  config_->section("perf"),
283  config_->CONFIG_DIR),
284  *this,
285  logs_->journal("PerfLog"),
286  [this] { signalStop(); }))
287 
288  , m_txMaster(*this)
289 
291  config_->section(SECTION_INSIGHT),
292  logs_->journal("Collector")))
293 
294  , m_jobQueue(std::make_unique<JobQueue>(
295  [](std::unique_ptr<Config> const& config) {
296  if (config->standalone() && !config->reporting() &&
298  return 1;
299 
300  if (config->WORKERS)
301  return config->WORKERS;
302 
303  auto count =
304  static_cast<int>(std::thread::hardware_concurrency());
305 
306  // Be more aggressive about the number of threads to use
307  // for the job queue if the server is configured as "large"
308  // or "huge" if there are enough cores.
309  if (config->NODE_SIZE >= 4 && count >= 16)
310  count = 6 + std::min(count, 8);
311  else if (config->NODE_SIZE >= 3 && count >= 8)
312  count = 4 + std::min(count, 6);
313  else
314  count = 2 + std::min(count, 4);
315 
316  return count;
317  }(config_),
318  m_collectorManager->group("jobq"),
319  logs_->journal("JobQueue"),
320  *logs_,
321  *perfLog_))
322 
324 
326  *this,
328  logs_->journal("SHAMapStore")))
329 
330  , accountIDCache_(128000)
331 
332  , m_tempNodeCache(
333  "NodeCache",
334  16384,
336  stopwatch(),
337  logs_->journal("TaggedCache"))
338 
339  , cachedSLEs_(
340  "Cached SLEs",
341  0,
343  stopwatch(),
344  logs_->journal("CachedSLEs"))
345 
347 
349  m_collectorManager->collector(),
350  logs_->journal("Resource")))
351 
352  , m_nodeStore(m_shaMapStore->makeNodeStore(
353  config_->PREFETCH_WORKERS > 0 ? config_->PREFETCH_WORKERS : 4))
354 
356 
357  // The shard store is optional and make_ShardStore can return null.
359  *this,
361  4,
362  logs_->journal("ShardStore")))
363 
364  , m_orderBookDB(*this)
365 
366  , m_pathRequests(std::make_unique<PathRequests>(
367  *this,
368  logs_->journal("PathRequest"),
369  m_collectorManager->collector()))
370 
371  , m_ledgerMaster(std::make_unique<LedgerMaster>(
372  *this,
373  stopwatch(),
374  m_collectorManager->collector(),
375  logs_->journal("LedgerMaster")))
376 
377  , ledgerCleaner_(
378  make_LedgerCleaner(*this, logs_->journal("LedgerCleaner")))
379 
380  // VFALCO NOTE must come before NetworkOPs to prevent a crash due
381  // to dependencies in the destructor.
382  //
384  *this,
385  stopwatch(),
386  m_collectorManager->collector()))
387 
389  *this,
390  m_collectorManager->collector(),
391  [this](std::shared_ptr<SHAMap> const& set, bool fromAcquire) {
392  gotTXSet(set, fromAcquire);
393  }))
394 
395  , m_ledgerReplayer(std::make_unique<LedgerReplayer>(
396  *this,
398  make_PeerSetBuilder(*this)))
399 
401  "AcceptedLedger",
402  4,
404  stopwatch(),
405  logs_->journal("TaggedCache"))
406 
408  *this,
409  stopwatch(),
410  config_->standalone(),
411  config_->NETWORK_QUORUM,
412  config_->START_VALID,
413  *m_jobQueue,
416  get_io_service(),
417  logs_->journal("NetworkOPs"),
418  m_collectorManager->collector()))
419 
420  , cluster_(std::make_unique<Cluster>(logs_->journal("Overlay")))
421 
422  , peerReservations_(std::make_unique<PeerReservationTable>(
423  logs_->journal("PeerReservationTable")))
424 
426  std::make_unique<ManifestCache>(logs_->journal("ManifestCache")))
427 
429  std::make_unique<ManifestCache>(logs_->journal("ManifestCache")))
430 
431  , validators_(std::make_unique<ValidatorList>(
434  *timeKeeper_,
435  config_->legacy("database_path"),
436  logs_->journal("ValidatorList"),
437  config_->VALIDATION_QUORUM))
438 
439  , validatorSites_(std::make_unique<ValidatorSite>(*this))
440 
442  *this,
443  get_io_service(),
444  *m_jobQueue,
445  *m_networkOPs,
448 
449  , mFeeTrack(
450  std::make_unique<LoadFeeTrack>(logs_->journal("LoadManager")))
451 
452  , hashRouter_(std::make_unique<HashRouter>(
453  stopwatch(),
455 
456  , mValidations(
457  ValidationParms(),
458  stopwatch(),
459  *this,
460  logs_->journal("Validations"))
461 
462  , m_loadManager(make_LoadManager(*this, logs_->journal("LoadManager")))
463 
464  , txQ_(
465  std::make_unique<TxQ>(setup_TxQ(*config_), logs_->journal("TxQ")))
466 
468 
470 
472 
473  , checkSigs_(true)
474 
475  , m_resolver(
476  ResolverAsio::New(get_io_service(), logs_->journal("Resolver")))
477 
479  m_collectorManager->collector()->make_event("ios_latency"),
480  logs_->journal("Application"),
482  get_io_service())
483  , grpcServer_(std::make_unique<GRPCServer>(*this))
484  , reportingETL_(
485  config_->reporting() ? std::make_unique<ReportingETL>(*this)
486  : nullptr)
487  {
488  add(m_resourceManager.get());
489 
490  //
491  // VFALCO - READ THIS!
492  //
493  // Do not start threads, open sockets, or do any sort of "real work"
494  // inside the constructor. Put it in start instead. Or if you must,
495  // put it in setup (but everything in setup should be moved to start
496  // anyway.
497  //
498  // The reason is that the unit tests require an Application object to
499  // be created. But we don't actually start all the threads, sockets,
500  // and services when running the unit tests. Therefore anything which
501  // needs to be stopped will not get stopped correctly if it is
502  // started in this constructor.
503  //
504 
505  add(ledgerCleaner_.get());
506  }
507 
508  //--------------------------------------------------------------------------
509 
510  bool
511  setup() override;
512  void
513  start(bool withTimers) override;
514  void
515  run() override;
516  void
517  signalStop() override;
518  bool
519  checkSigs() const override;
520  void
521  checkSigs(bool) override;
522  bool
523  isStopping() const override;
524  int
525  fdRequired() const override;
526 
527  //--------------------------------------------------------------------------
528 
529  Logs&
530  logs() override
531  {
532  return *logs_;
533  }
534 
535  Config&
536  config() override
537  {
538  return *config_;
539  }
540 
543  {
544  return *m_collectorManager;
545  }
546 
547  Family&
548  getNodeFamily() override
549  {
550  return nodeFamily_;
551  }
552 
553  // The shard store is an optional feature. If the sever is configured for
554  // shards, this function will return a valid pointer, otherwise a nullptr.
555  Family*
556  getShardFamily() override
557  {
558  return shardFamily_.get();
559  }
560 
561  TimeKeeper&
562  timeKeeper() override
563  {
564  return *timeKeeper_;
565  }
566 
567  JobQueue&
568  getJobQueue() override
569  {
570  return *m_jobQueue;
571  }
572 
574  nodeIdentity() override
575  {
576  return nodeIdentity_;
577  }
578 
579  PublicKey const&
580  getValidationPublicKey() const override
581  {
582  return validatorKeys_.publicKey;
583  }
584 
585  NetworkOPs&
586  getOPs() override
587  {
588  return *m_networkOPs;
589  }
590 
591  boost::asio::io_service&
592  getIOService() override
593  {
594  return get_io_service();
595  }
596 
598  getIOLatency() override
599  {
600  return m_io_latency_sampler.get();
601  }
602 
603  LedgerMaster&
604  getLedgerMaster() override
605  {
606  return *m_ledgerMaster;
607  }
608 
610  getLedgerCleaner() override
611  {
612  return *ledgerCleaner_;
613  }
614 
616  getLedgerReplayer() override
617  {
618  return *m_ledgerReplayer;
619  }
620 
622  getInboundLedgers() override
623  {
624  return *m_inboundLedgers;
625  }
626 
629  {
630  return *m_inboundTransactions;
631  }
632 
635  {
636  return m_acceptedLedgerCache;
637  }
638 
639  void
640  gotTXSet(std::shared_ptr<SHAMap> const& set, bool fromAcquire)
641  {
642  if (set)
643  m_networkOPs->mapComplete(set, fromAcquire);
644  }
645 
648  {
649  return m_txMaster;
650  }
651 
653  getPerfLog() override
654  {
655  return *perfLog_;
656  }
657 
658  NodeCache&
659  getTempNodeCache() override
660  {
661  return m_tempNodeCache;
662  }
663 
665  getNodeStore() override
666  {
667  return *m_nodeStore;
668  }
669 
670  // The shard store is an optional feature. If the sever is configured for
671  // shards, this function will return a valid pointer, otherwise a nullptr.
673  getShardStore() override
674  {
675  return shardStore_.get();
676  }
677 
679  getShardArchiveHandler(bool tryRecovery) override
680  {
681  static std::mutex handlerMutex;
682  std::lock_guard lock(handlerMutex);
683 
684  // After constructing the handler, try to
685  // initialize it. Log on error; set the
686  // member variable on success.
687  auto initAndSet =
689  if (!handler)
690  return false;
691 
692  if (!handler->init())
693  {
694  JLOG(m_journal.error())
695  << "Failed to initialize ShardArchiveHandler.";
696 
697  return false;
698  }
699 
700  shardArchiveHandler_ = std::move(handler);
701  return true;
702  };
703 
704  // Need to resume based on state from a previous
705  // run.
706  if (tryRecovery)
707  {
708  if (shardArchiveHandler_ != nullptr)
709  {
710  JLOG(m_journal.error())
711  << "ShardArchiveHandler already created at startup.";
712 
713  return nullptr;
714  }
715 
716  auto handler =
718 
719  if (!initAndSet(std::move(handler)))
720  return nullptr;
721  }
722 
723  // Construct the ShardArchiveHandler
724  if (shardArchiveHandler_ == nullptr)
725  {
726  auto handler =
728 
729  if (!initAndSet(std::move(handler)))
730  return nullptr;
731  }
732 
733  return shardArchiveHandler_.get();
734  }
735 
737  getMasterMutex() override
738  {
739  return m_masterMutex;
740  }
741 
742  LoadManager&
743  getLoadManager() override
744  {
745  return *m_loadManager;
746  }
747 
750  {
751  return *m_resourceManager;
752  }
753 
754  OrderBookDB&
755  getOrderBookDB() override
756  {
757  return m_orderBookDB;
758  }
759 
760  PathRequests&
761  getPathRequests() override
762  {
763  return *m_pathRequests;
764  }
765 
766  CachedSLEs&
767  cachedSLEs() override
768  {
769  return cachedSLEs_;
770  }
771 
773  getAmendmentTable() override
774  {
775  return *m_amendmentTable;
776  }
777 
778  LoadFeeTrack&
779  getFeeTrack() override
780  {
781  return *mFeeTrack;
782  }
783 
784  HashRouter&
785  getHashRouter() override
786  {
787  return *hashRouter_;
788  }
789 
791  getValidations() override
792  {
793  return mValidations;
794  }
795 
797  validators() override
798  {
799  return *validators_;
800  }
801 
803  validatorSites() override
804  {
805  return *validatorSites_;
806  }
807 
810  {
811  return *validatorManifests_;
812  }
813 
816  {
817  return *publisherManifests_;
818  }
819 
820  Cluster&
821  cluster() override
822  {
823  return *cluster_;
824  }
825 
827  peerReservations() override
828  {
829  return *peerReservations_;
830  }
831 
832  SHAMapStore&
833  getSHAMapStore() override
834  {
835  return *m_shaMapStore;
836  }
837 
838  PendingSaves&
839  pendingSaves() override
840  {
841  return pendingSaves_;
842  }
843 
844  AccountIDCache const&
845  accountIDCache() const override
846  {
847  return accountIDCache_;
848  }
849 
850  OpenLedger&
851  openLedger() override
852  {
853  if (config_->reporting())
854  Throw<ReportingShouldProxy>();
855  return *openLedger_;
856  }
857 
858  OpenLedger const&
859  openLedger() const override
860  {
861  if (config_->reporting())
862  Throw<ReportingShouldProxy>();
863  return *openLedger_;
864  }
865 
866  Overlay&
867  overlay() override
868  {
869  assert(overlay_);
870  return *overlay_;
871  }
872 
873  TxQ&
874  getTxQ() override
875  {
876  assert(txQ_.get() != nullptr);
877  return *txQ_;
878  }
879 
882  {
883  assert(mRelationalDatabase.get() != nullptr);
884  return *mRelationalDatabase;
885  }
886 
887  DatabaseCon&
888  getWalletDB() override
889  {
890  assert(mWalletDB.get() != nullptr);
891  return *mWalletDB;
892  }
893 
894  ReportingETL&
895  getReportingETL() override
896  {
897  assert(reportingETL_.get() != nullptr);
898  return *reportingETL_;
899  }
900 
901  bool
902  serverOkay(std::string& reason) override;
903 
905  journal(std::string const& name) override;
906 
907  //--------------------------------------------------------------------------
908 
909  bool
911  {
912  assert(mWalletDB.get() == nullptr);
913 
914  try
915  {
918 
919  // wallet database
921  setup.useGlobalPragma = false;
922 
924  }
925  catch (std::exception const& e)
926  {
927  JLOG(m_journal.fatal())
928  << "Failed to initialize SQL databases: " << e.what();
929  return false;
930  }
931 
932  return true;
933  }
934 
935  bool
937  {
938  if (config_->doImport)
939  {
940  auto j = logs_->journal("NodeObject");
941  NodeStore::DummyScheduler dummyScheduler;
944  megabytes(config_->getValueFor(
945  SizedItem::burstSize, std::nullopt)),
946  dummyScheduler,
947  0,
949  j);
950 
951  JLOG(j.warn()) << "Starting node import from '" << source->getName()
952  << "' to '" << m_nodeStore->getName() << "'.";
953 
954  using namespace std::chrono;
955  auto const start = steady_clock::now();
956 
957  m_nodeStore->importDatabase(*source);
958 
959  auto const elapsed =
960  duration_cast<seconds>(steady_clock::now() - start);
961  JLOG(j.warn()) << "Node import from '" << source->getName()
962  << "' took " << elapsed.count() << " seconds.";
963  }
964 
965  return true;
966  }
967 
968  //--------------------------------------------------------------------------
969  //
970  // PropertyStream
971  //
972 
973  void
975  {
976  }
977 
978  //--------------------------------------------------------------------------
979 
980  void
982  {
983  // Only start the timer if waitHandlerCounter_ is not yet joined.
984  if (auto optionalCountedHandler = waitHandlerCounter_.wrap(
985  [this](boost::system::error_code const& e) {
986  if (e.value() == boost::system::errc::success)
987  {
988  m_jobQueue->addJob(
989  jtSWEEP, "sweep", [this]() { doSweep(); });
990  }
991  // Recover as best we can if an unexpected error occurs.
992  if (e.value() != boost::system::errc::success &&
993  e.value() != boost::asio::error::operation_aborted)
994  {
995  // Try again later and hope for the best.
996  JLOG(m_journal.error())
997  << "Sweep timer got error '" << e.message()
998  << "'. Restarting timer.";
999  setSweepTimer();
1000  }
1001  }))
1002  {
1003  using namespace std::chrono;
1004  sweepTimer_.expires_from_now(
1005  seconds{config_->SWEEP_INTERVAL.value_or(
1006  config_->getValueFor(SizedItem::sweepInterval))});
1007  sweepTimer_.async_wait(std::move(*optionalCountedHandler));
1008  }
1009  }
1010 
1011  void
1013  {
1014  // Only start the timer if waitHandlerCounter_ is not yet joined.
1015  if (auto optionalCountedHandler = waitHandlerCounter_.wrap(
1016  [this](boost::system::error_code const& e) {
1017  if (e.value() == boost::system::errc::success)
1018  {
1019  crypto_prng().mix_entropy();
1020  setEntropyTimer();
1021  }
1022  // Recover as best we can if an unexpected error occurs.
1023  if (e.value() != boost::system::errc::success &&
1024  e.value() != boost::asio::error::operation_aborted)
1025  {
1026  // Try again later and hope for the best.
1027  JLOG(m_journal.error())
1028  << "Entropy timer got error '" << e.message()
1029  << "'. Restarting timer.";
1030  setEntropyTimer();
1031  }
1032  }))
1033  {
1034  using namespace std::chrono_literals;
1035  entropyTimer_.expires_from_now(5min);
1036  entropyTimer_.async_wait(std::move(*optionalCountedHandler));
1037  }
1038  }
1039 
1040  void
1042  {
1043  if (!config_->standalone() &&
1044  !getRelationalDatabase().transactionDbHasSpace(*config_))
1045  {
1046  signalStop();
1047  }
1048 
1049  // VFALCO NOTE Does the order of calls matter?
1050  // VFALCO TODO fix the dependency inversion using an observer,
1051  // have listeners register for "onSweep ()" notification.
1052 
1053  nodeFamily_.sweep();
1054  if (shardFamily_)
1055  shardFamily_->sweep();
1057  getNodeStore().sweep();
1058  if (shardStore_)
1059  shardStore_->sweep();
1060  getLedgerMaster().sweep();
1061  getTempNodeCache().sweep();
1065  m_acceptedLedgerCache.sweep();
1066  cachedSLEs_.sweep();
1067 
1068 #ifdef RIPPLED_REPORTING
1069  if (auto pg = dynamic_cast<PostgresDatabase*>(&*mRelationalDatabase))
1070  pg->sweep();
1071 #endif
1072 
1073  // Set timer to do another sweep later.
1074  setSweepTimer();
1075  }
1076 
1077  LedgerIndex
1079  {
1080  return maxDisallowedLedger_;
1081  }
1082 
1083 private:
1084  // For a newly-started validator, this is the greatest persisted ledger
1085  // and new validations must be greater than this.
1087 
1088  bool
1089  nodeToShards();
1090 
1091  void
1093 
1096 
1098  loadLedgerFromFile(std::string const& ledgerID);
1099 
1100  bool
1101  loadOldLedger(std::string const& ledgerID, bool replay, bool isFilename);
1102 
1103  void
1105 };
1106 
1107 //------------------------------------------------------------------------------
1108 
1109 // TODO Break this up into smaller, more digestible initialization segments.
1110 bool
1112 {
1113  // We want to intercept CTRL-C and the standard termination signal SIGTERM
1114  // and terminate the process. This handler will NEVER be invoked twice.
1115  //
1116  // Note that async_wait is "one-shot": for each call, the handler will be
1117  // invoked exactly once, either when one of the registered signals in the
1118  // signal set occurs or the signal set is cancelled. Subsequent signals are
1119  // effectively ignored (technically, they are queued up, waiting for a call
1120  // to async_wait).
1121  m_signals.add(SIGINT);
1122  m_signals.add(SIGTERM);
1123  m_signals.async_wait(
1124  [this](boost::system::error_code const& ec, int signum) {
1125  // Indicates the signal handler has been aborted; do nothing
1126  if (ec == boost::asio::error::operation_aborted)
1127  return;
1128 
1129  JLOG(m_journal.info()) << "Received signal " << signum;
1130 
1131  if (signum == SIGTERM || signum == SIGINT)
1132  signalStop();
1133  });
1134 
1135  auto debug_log = config_->getDebugLogFile();
1136 
1137  if (!debug_log.empty())
1138  {
1139  // Let debug messages go to the file but only WARNING or higher to
1140  // regular output (unless verbose)
1141 
1142  if (!logs_->open(debug_log))
1143  std::cerr << "Can't open log file " << debug_log << '\n';
1144 
1145  using namespace beast::severities;
1146  if (logs_->threshold() > kDebug)
1147  logs_->threshold(kDebug);
1148  }
1149  JLOG(m_journal.info()) << "process starting: "
1151 
1152  if (numberOfThreads(*config_) < 2)
1153  {
1154  JLOG(m_journal.warn()) << "Limited to a single I/O service thread by "
1155  "system configuration.";
1156  }
1157 
1158  // Optionally turn off logging to console.
1159  logs_->silent(config_->silent());
1160 
1161  if (!config_->standalone())
1162  timeKeeper_->run(config_->SNTP_SERVERS);
1163 
1165  return false;
1166 
1167  if (shardStore_)
1168  {
1169  shardFamily_ =
1170  std::make_unique<ShardFamily>(*this, *m_collectorManager);
1171 
1172  if (!shardStore_->init())
1173  return false;
1174  }
1175 
1176  if (!peerReservations_->load(getWalletDB()))
1177  {
1178  JLOG(m_journal.fatal()) << "Cannot find peer reservations!";
1179  return false;
1180  }
1181 
1184 
1185  // Configure the amendments the server supports
1186  {
1187  auto const supported = []() {
1188  auto const& amendments = detail::supportedAmendments();
1190  supported.reserve(amendments.size());
1191  for (auto const& [a, vote] : amendments)
1192  {
1193  auto const f = ripple::getRegisteredFeature(a);
1194  assert(f);
1195  if (f)
1196  supported.emplace_back(a, *f, vote);
1197  }
1198  return supported;
1199  }();
1200  Section const& downVoted = config_->section(SECTION_VETO_AMENDMENTS);
1201 
1202  Section const& upVoted = config_->section(SECTION_AMENDMENTS);
1203 
1205  *this,
1206  config().AMENDMENT_MAJORITY_TIME,
1207  supported,
1208  upVoted,
1209  downVoted,
1210  logs_->journal("Amendments"));
1211  }
1212 
1214 
1215  auto const startUp = config_->START_UP;
1216  JLOG(m_journal.debug()) << "startUp: " << startUp;
1217  if (!config_->reporting())
1218  {
1219  if (startUp == Config::FRESH)
1220  {
1221  JLOG(m_journal.info()) << "Starting new Ledger";
1222 
1224  }
1225  else if (
1226  startUp == Config::LOAD || startUp == Config::LOAD_FILE ||
1227  startUp == Config::REPLAY)
1228  {
1229  JLOG(m_journal.info()) << "Loading specified Ledger";
1230 
1231  if (!loadOldLedger(
1232  config_->START_LEDGER,
1233  startUp == Config::REPLAY,
1234  startUp == Config::LOAD_FILE))
1235  {
1236  JLOG(m_journal.error())
1237  << "The specified ledger could not be loaded.";
1238  if (config_->FAST_LOAD)
1239  {
1240  // Fall back to syncing from the network, such as
1241  // when there's no existing data.
1243  }
1244  else
1245  {
1246  return false;
1247  }
1248  }
1249  }
1250  else if (startUp == Config::NETWORK)
1251  {
1252  // This should probably become the default once we have a stable
1253  // network.
1254  if (!config_->standalone())
1255  m_networkOPs->setNeedNetworkLedger();
1256 
1258  }
1259  else
1260  {
1262  }
1263  }
1264 
1265  if (!config().reporting())
1266  m_orderBookDB.setup(getLedgerMaster().getCurrentLedger());
1267 
1268  nodeIdentity_ = getNodeIdentity(*this);
1269 
1270  if (!cluster_->load(config().section(SECTION_CLUSTER_NODES)))
1271  {
1272  JLOG(m_journal.fatal()) << "Invalid entry in cluster configuration.";
1273  return false;
1274  }
1275 
1276  if (!config().reporting())
1277  {
1278  {
1280  return false;
1281 
1282  if (!validatorManifests_->load(
1283  getWalletDB(),
1284  "ValidatorManifests",
1286  config()
1287  .section(SECTION_VALIDATOR_KEY_REVOCATION)
1288  .values()))
1289  {
1290  JLOG(m_journal.fatal())
1291  << "Invalid configured validator manifest.";
1292  return false;
1293  }
1294 
1295  publisherManifests_->load(getWalletDB(), "PublisherManifests");
1296 
1297  // Setup trusted validators
1298  if (!validators_->load(
1300  config().section(SECTION_VALIDATORS).values(),
1301  config().section(SECTION_VALIDATOR_LIST_KEYS).values()))
1302  {
1303  JLOG(m_journal.fatal())
1304  << "Invalid entry in validator configuration.";
1305  return false;
1306  }
1307  }
1308 
1309  if (!validatorSites_->load(
1310  config().section(SECTION_VALIDATOR_LIST_SITES).values()))
1311  {
1312  JLOG(m_journal.fatal())
1313  << "Invalid entry in [" << SECTION_VALIDATOR_LIST_SITES << "]";
1314  return false;
1315  }
1316  }
1317  //----------------------------------------------------------------------
1318  //
1319  // Server
1320  //
1321  //----------------------------------------------------------------------
1322 
1323  // VFALCO NOTE Unfortunately, in stand-alone mode some code still
1324  // foolishly calls overlay(). When this is fixed we can
1325  // move the instantiation inside a conditional:
1326  //
1327  // if (!config_.standalone())
1328  if (!config_->reporting())
1329  {
1331  *this,
1333  *serverHandler_,
1335  *m_resolver,
1336  get_io_service(),
1337  *config_,
1338  m_collectorManager->collector());
1339  add(*overlay_); // add to PropertyStream
1340  }
1341 
1342  if (!config_->standalone())
1343  {
1344  // NodeStore import into the ShardStore requires the SQLite database
1345  if (config_->nodeToShard && !nodeToShards())
1346  return false;
1347  }
1348 
1349  // start first consensus round
1350  if (!config_->reporting() &&
1351  !m_networkOPs->beginConsensus(
1352  m_ledgerMaster->getClosedLedger()->info().hash))
1353  {
1354  JLOG(m_journal.fatal()) << "Unable to start consensus";
1355  return false;
1356  }
1357 
1358  {
1359  try
1360  {
1361  auto setup = setup_ServerHandler(
1363  setup.makeContexts();
1364  serverHandler_->setup(setup, m_journal);
1365  }
1366  catch (std::exception const& e)
1367  {
1368  if (auto stream = m_journal.fatal())
1369  {
1370  stream << "Unable to setup server handler";
1371  if (std::strlen(e.what()) > 0)
1372  stream << ": " << e.what();
1373  }
1374  return false;
1375  }
1376  }
1377 
1378  // Begin connecting to network.
1379  if (!config_->standalone())
1380  {
1381  // Should this message be here, conceptually? In theory this sort
1382  // of message, if displayed, should be displayed from PeerFinder.
1383  if (config_->PEER_PRIVATE && config_->IPS_FIXED.empty())
1384  {
1385  JLOG(m_journal.warn())
1386  << "No outbound peer connections will be made";
1387  }
1388 
1389  // VFALCO NOTE the state timer resets the deadlock detector.
1390  //
1391  m_networkOPs->setStateTimer();
1392  }
1393  else
1394  {
1395  JLOG(m_journal.warn()) << "Running in standalone mode";
1396 
1397  m_networkOPs->setStandAlone();
1398  }
1399 
1400  if (config_->canSign())
1401  {
1402  JLOG(m_journal.warn()) << "*** The server is configured to allow the "
1403  "'sign' and 'sign_for'";
1404  JLOG(m_journal.warn()) << "*** commands. These commands have security "
1405  "implications and have";
1406  JLOG(m_journal.warn()) << "*** been deprecated. They will be removed "
1407  "in a future release of";
1408  JLOG(m_journal.warn()) << "*** rippled.";
1409  JLOG(m_journal.warn()) << "*** If you do not use them to sign "
1410  "transactions please edit your";
1411  JLOG(m_journal.warn())
1412  << "*** configuration file and remove the [enable_signing] stanza.";
1413  JLOG(m_journal.warn()) << "*** If you do use them to sign transactions "
1414  "please migrate to a";
1415  JLOG(m_journal.warn())
1416  << "*** standalone signing solution as soon as possible.";
1417  }
1418 
1419  //
1420  // Execute start up rpc commands.
1421  //
1422  for (auto cmd : config_->section(SECTION_RPC_STARTUP).lines())
1423  {
1424  Json::Reader jrReader;
1425  Json::Value jvCommand;
1426 
1427  if (!jrReader.parse(cmd, jvCommand))
1428  {
1429  JLOG(m_journal.fatal()) << "Couldn't parse entry in ["
1430  << SECTION_RPC_STARTUP << "]: '" << cmd;
1431  }
1432 
1433  if (!config_->quiet())
1434  {
1435  JLOG(m_journal.fatal())
1436  << "Startup RPC: " << jvCommand << std::endl;
1437  }
1438 
1441  RPC::JsonContext context{
1442  {journal("RPCHandler"),
1443  *this,
1444  loadType,
1445  getOPs(),
1446  getLedgerMaster(),
1447  c,
1448  Role::ADMIN,
1449  {},
1450  {},
1452  jvCommand};
1453 
1454  Json::Value jvResult;
1455  RPC::doCommand(context, jvResult);
1456 
1457  if (!config_->quiet())
1458  {
1459  JLOG(m_journal.fatal()) << "Result: " << jvResult << std::endl;
1460  }
1461  }
1462 
1463  RPC::ShardArchiveHandler* shardArchiveHandler = nullptr;
1464  if (shardStore_)
1465  {
1466  try
1467  {
1468  // Create a ShardArchiveHandler if recovery
1469  // is needed (there's a state database left
1470  // over from a previous run).
1471  auto handler = getShardArchiveHandler(true);
1472 
1473  // Recovery is needed.
1474  if (handler)
1475  shardArchiveHandler = handler;
1476  }
1477  catch (std::exception const& e)
1478  {
1479  JLOG(m_journal.fatal())
1480  << "Exception when starting ShardArchiveHandler from "
1481  "state database: "
1482  << e.what();
1483 
1484  return false;
1485  }
1486  }
1487 
1488  if (shardArchiveHandler && !shardArchiveHandler->start())
1489  {
1490  JLOG(m_journal.fatal()) << "Failed to start ShardArchiveHandler.";
1491 
1492  return false;
1493  }
1494 
1495  validatorSites_->start();
1496 
1497  if (reportingETL_)
1498  reportingETL_->start();
1499 
1500  return true;
1501 }
1502 
1503 void
1504 ApplicationImp::start(bool withTimers)
1505 {
1506  JLOG(m_journal.info()) << "Application starting. Version is "
1508 
1509  if (withTimers)
1510  {
1511  setSweepTimer();
1512  setEntropyTimer();
1513  }
1514 
1516  m_resolver->start();
1517  m_loadManager->start();
1518  m_shaMapStore->start();
1519  if (overlay_)
1520  overlay_->start();
1521  grpcServer_->start();
1522  ledgerCleaner_->start();
1523  perfLog_->start();
1524 }
1525 
1526 void
1528 {
1529  if (!config_->standalone())
1530  {
1531  // VFALCO NOTE This seems unnecessary. If we properly refactor the load
1532  // manager then the deadlock detector can just always be
1533  // "armed"
1534  //
1536  }
1537 
1538  {
1540  stoppingCondition_.wait(lk, [this] { return isTimeToStop.load(); });
1541  }
1542 
1543  JLOG(m_journal.debug()) << "Application stopping";
1544 
1546 
1547  // VFALCO Enormous hack, we have to force the probe to cancel
1548  // before we stop the io_service queue or else it never
1549  // unblocks in its destructor. The fix is to make all
1550  // io_objects gracefully handle exit so that we can
1551  // naturally return from io_service::run() instead of
1552  // forcing a call to io_service::stop()
1554 
1555  m_resolver->stop_async();
1556 
1557  // NIKB This is a hack - we need to wait for the resolver to
1558  // stop. before we stop the io_server_queue or weird
1559  // things will happen.
1560  m_resolver->stop();
1561 
1562  {
1563  boost::system::error_code ec;
1564  sweepTimer_.cancel(ec);
1565  if (ec)
1566  {
1567  JLOG(m_journal.error())
1568  << "Application: sweepTimer cancel error: " << ec.message();
1569  }
1570 
1571  ec.clear();
1572  entropyTimer_.cancel(ec);
1573  if (ec)
1574  {
1575  JLOG(m_journal.error())
1576  << "Application: entropyTimer cancel error: " << ec.message();
1577  }
1578  }
1579 
1580  // Make sure that any waitHandlers pending in our timers are done
1581  // before we declare ourselves stopped.
1582  using namespace std::chrono_literals;
1583 
1584  waitHandlerCounter_.join("Application", 1s, m_journal);
1585 
1586  mValidations.flush();
1587 
1588  validatorSites_->stop();
1589 
1590  // TODO Store manifests in manifests.sqlite instead of wallet.db
1591  validatorManifests_->save(
1592  getWalletDB(), "ValidatorManifests", [this](PublicKey const& pubKey) {
1593  return validators().listed(pubKey);
1594  });
1595 
1596  publisherManifests_->save(
1597  getWalletDB(), "PublisherManifests", [this](PublicKey const& pubKey) {
1598  return validators().trustedPublisher(pubKey);
1599  });
1600 
1601  // The order of these stop calls is delicate.
1602  // Re-ordering them risks undefined behavior.
1603  m_loadManager->stop();
1604  m_shaMapStore->stop();
1605  m_jobQueue->stop();
1607  shardArchiveHandler_->stop();
1608  if (overlay_)
1609  overlay_->stop();
1610  if (shardStore_)
1611  shardStore_->stop();
1612  grpcServer_->stop();
1613  m_networkOPs->stop();
1614  serverHandler_->stop();
1615  m_ledgerReplayer->stop();
1616  m_inboundTransactions->stop();
1617  m_inboundLedgers->stop();
1618  ledgerCleaner_->stop();
1619  if (reportingETL_)
1620  reportingETL_->stop();
1621  if (auto pg = dynamic_cast<PostgresDatabase*>(&*mRelationalDatabase))
1622  pg->stop();
1623  m_nodeStore->stop();
1624  perfLog_->stop();
1625 
1626  JLOG(m_journal.info()) << "Done.";
1627 }
1628 
1629 void
1631 {
1632  if (!isTimeToStop.exchange(true))
1634 }
1635 
1636 bool
1638 {
1639  return checkSigs_;
1640 }
1641 
1642 void
1644 {
1645  checkSigs_ = check;
1646 }
1647 
1648 bool
1650 {
1651  return isTimeToStop.load();
1652 }
1653 
1654 int
1656 {
1657  // Standard handles, config file, misc I/O etc:
1658  int needed = 128;
1659 
1660  // 2x the configured peer limit for peer connections:
1661  if (overlay_)
1662  needed += 2 * overlay_->limit();
1663 
1664  // the number of fds needed by the backend (internally
1665  // doubled if online delete is enabled).
1666  needed += std::max(5, m_shaMapStore->fdRequired());
1667 
1668  if (shardStore_)
1669  needed += shardStore_->fdRequired();
1670 
1671  // One fd per incoming connection a port can accept, or
1672  // if no limit is set, assume it'll handle 256 clients.
1673  for (auto const& p : serverHandler_->setup().ports)
1674  needed += std::max(256, p.limit);
1675 
1676  // The minimum number of file descriptors we need is 1024:
1677  return std::max(1024, needed);
1678 }
1679 
1680 //------------------------------------------------------------------------------
1681 
1682 void
1684 {
1685  std::vector<uint256> initialAmendments =
1686  (config_->START_UP == Config::FRESH) ? m_amendmentTable->getDesired()
1688 
1689  std::shared_ptr<Ledger> const genesis = std::make_shared<Ledger>(
1690  create_genesis, *config_, initialAmendments, nodeFamily_);
1691  m_ledgerMaster->storeLedger(genesis);
1692 
1693  auto const next =
1694  std::make_shared<Ledger>(*genesis, timeKeeper().closeTime());
1695  next->updateSkipList();
1696  next->setImmutable(*config_);
1697  openLedger_.emplace(next, cachedSLEs_, logs_->journal("OpenLedger"));
1698  m_ledgerMaster->storeLedger(next);
1699  m_ledgerMaster->switchLCL(next);
1700 }
1701 
1704 {
1705  auto j = journal("Ledger");
1706 
1707  try
1708  {
1709  auto const [ledger, seq, hash] = getLatestLedger(*this);
1710 
1711  if (!ledger)
1712  return ledger;
1713 
1714  ledger->setImmutable(*config_);
1715 
1716  if (getLedgerMaster().haveLedger(seq))
1717  ledger->setValidated();
1718 
1719  if (ledger->info().hash == hash)
1720  {
1721  JLOG(j.trace()) << "Loaded ledger: " << hash;
1722  return ledger;
1723  }
1724 
1725  if (auto stream = j.error())
1726  {
1727  stream << "Failed on ledger";
1728  Json::Value p;
1729  addJson(p, {*ledger, nullptr, LedgerFill::full});
1730  stream << p;
1731  }
1732 
1733  return {};
1734  }
1735  catch (SHAMapMissingNode const& mn)
1736  {
1737  JLOG(j.warn()) << "Ledger in database: " << mn.what();
1738  return {};
1739  }
1740 }
1741 
1744 {
1745  try
1746  {
1747  std::ifstream ledgerFile(name, std::ios::in);
1748 
1749  if (!ledgerFile)
1750  {
1751  JLOG(m_journal.fatal()) << "Unable to open file '" << name << "'";
1752  return nullptr;
1753  }
1754 
1755  Json::Reader reader;
1756  Json::Value jLedger;
1757 
1758  if (!reader.parse(ledgerFile, jLedger))
1759  {
1760  JLOG(m_journal.fatal()) << "Unable to parse ledger JSON";
1761  return nullptr;
1762  }
1763 
1764  std::reference_wrapper<Json::Value> ledger(jLedger);
1765 
1766  // accept a wrapped ledger
1767  if (ledger.get().isMember("result"))
1768  ledger = ledger.get()["result"];
1769 
1770  if (ledger.get().isMember("ledger"))
1771  ledger = ledger.get()["ledger"];
1772 
1773  std::uint32_t seq = 1;
1774  auto closeTime = timeKeeper().closeTime();
1775  using namespace std::chrono_literals;
1776  auto closeTimeResolution = 30s;
1777  bool closeTimeEstimated = false;
1778  std::uint64_t totalDrops = 0;
1779 
1780  if (ledger.get().isMember("accountState"))
1781  {
1782  if (ledger.get().isMember(jss::ledger_index))
1783  {
1784  seq = ledger.get()[jss::ledger_index].asUInt();
1785  }
1786 
1787  if (ledger.get().isMember("close_time"))
1788  {
1789  using tp = NetClock::time_point;
1790  using d = tp::duration;
1791  closeTime = tp{d{ledger.get()["close_time"].asUInt()}};
1792  }
1793  if (ledger.get().isMember("close_time_resolution"))
1794  {
1795  using namespace std::chrono;
1796  closeTimeResolution =
1797  seconds{ledger.get()["close_time_resolution"].asUInt()};
1798  }
1799  if (ledger.get().isMember("close_time_estimated"))
1800  {
1801  closeTimeEstimated =
1802  ledger.get()["close_time_estimated"].asBool();
1803  }
1804  if (ledger.get().isMember("total_coins"))
1805  {
1806  totalDrops = beast::lexicalCastThrow<std::uint64_t>(
1807  ledger.get()["total_coins"].asString());
1808  }
1809 
1810  ledger = ledger.get()["accountState"];
1811  }
1812 
1813  if (!ledger.get().isArrayOrNull())
1814  {
1815  JLOG(m_journal.fatal()) << "State nodes must be an array";
1816  return nullptr;
1817  }
1818 
1819  auto loadLedger =
1820  std::make_shared<Ledger>(seq, closeTime, *config_, nodeFamily_);
1821  loadLedger->setTotalDrops(totalDrops);
1822 
1823  for (Json::UInt index = 0; index < ledger.get().size(); ++index)
1824  {
1825  Json::Value& entry = ledger.get()[index];
1826 
1827  if (!entry.isObjectOrNull())
1828  {
1829  JLOG(m_journal.fatal()) << "Invalid entry in ledger";
1830  return nullptr;
1831  }
1832 
1833  uint256 uIndex;
1834 
1835  if (!uIndex.parseHex(entry[jss::index].asString()))
1836  {
1837  JLOG(m_journal.fatal()) << "Invalid entry in ledger";
1838  return nullptr;
1839  }
1840 
1841  entry.removeMember(jss::index);
1842 
1843  STParsedJSONObject stp("sle", ledger.get()[index]);
1844 
1845  if (!stp.object || uIndex.isZero())
1846  {
1847  JLOG(m_journal.fatal()) << "Invalid entry in ledger";
1848  return nullptr;
1849  }
1850 
1851  // VFALCO TODO This is the only place that
1852  // constructor is used, try to remove it
1853  STLedgerEntry sle(*stp.object, uIndex);
1854 
1855  if (!loadLedger->addSLE(sle))
1856  {
1857  JLOG(m_journal.fatal())
1858  << "Couldn't add serialized ledger: " << uIndex;
1859  return nullptr;
1860  }
1861  }
1862 
1863  loadLedger->stateMap().flushDirty(hotACCOUNT_NODE);
1864 
1865  loadLedger->setAccepted(
1866  closeTime, closeTimeResolution, !closeTimeEstimated, *config_);
1867 
1868  return loadLedger;
1869  }
1870  catch (std::exception const& x)
1871  {
1872  JLOG(m_journal.fatal()) << "Ledger contains invalid data: " << x.what();
1873  return nullptr;
1874  }
1875 }
1876 
1877 bool
1879  std::string const& ledgerID,
1880  bool replay,
1881  bool isFileName)
1882 {
1883  try
1884  {
1885  std::shared_ptr<Ledger const> loadLedger, replayLedger;
1886 
1887  if (isFileName)
1888  {
1889  if (!ledgerID.empty())
1890  loadLedger = loadLedgerFromFile(ledgerID);
1891  }
1892  else if (ledgerID.length() == 64)
1893  {
1894  uint256 hash;
1895 
1896  if (hash.parseHex(ledgerID))
1897  {
1898  loadLedger = loadByHash(hash, *this);
1899 
1900  if (!loadLedger)
1901  {
1902  // Try to build the ledger from the back end
1903  auto il = std::make_shared<InboundLedger>(
1904  *this,
1905  hash,
1906  0,
1908  stopwatch(),
1909  make_DummyPeerSet(*this));
1910  if (il->checkLocal())
1911  loadLedger = il->getLedger();
1912  }
1913  }
1914  }
1915  else if (ledgerID.empty() || boost::iequals(ledgerID, "latest"))
1916  {
1917  loadLedger = getLastFullLedger();
1918  }
1919  else
1920  {
1921  // assume by sequence
1922  std::uint32_t index;
1923 
1924  if (beast::lexicalCastChecked(index, ledgerID))
1925  loadLedger = loadByIndex(index, *this);
1926  }
1927 
1928  if (!loadLedger)
1929  return false;
1930 
1931  if (replay)
1932  {
1933  // Replay a ledger close with same prior ledger and transactions
1934 
1935  // this ledger holds the transactions we want to replay
1936  replayLedger = loadLedger;
1937 
1938  JLOG(m_journal.info()) << "Loading parent ledger";
1939 
1940  loadLedger = loadByHash(replayLedger->info().parentHash, *this);
1941  if (!loadLedger)
1942  {
1943  JLOG(m_journal.info())
1944  << "Loading parent ledger from node store";
1945 
1946  // Try to build the ledger from the back end
1947  auto il = std::make_shared<InboundLedger>(
1948  *this,
1949  replayLedger->info().parentHash,
1950  0,
1952  stopwatch(),
1953  make_DummyPeerSet(*this));
1954 
1955  if (il->checkLocal())
1956  loadLedger = il->getLedger();
1957 
1958  if (!loadLedger)
1959  {
1960  JLOG(m_journal.fatal()) << "Replay ledger missing/damaged";
1961  assert(false);
1962  return false;
1963  }
1964  }
1965  }
1966  using namespace std::chrono_literals;
1967  using namespace date;
1968  static constexpr NetClock::time_point ledgerWarnTimePoint{
1969  sys_days{January / 1 / 2018} - sys_days{January / 1 / 2000}};
1970  if (loadLedger->info().closeTime < ledgerWarnTimePoint)
1971  {
1972  JLOG(m_journal.fatal())
1973  << "\n\n*** WARNING ***\n"
1974  "You are replaying a ledger from before "
1975  << to_string(ledgerWarnTimePoint)
1976  << " UTC.\n"
1977  "This replay will not handle your ledger as it was "
1978  "originally "
1979  "handled.\nConsider running an earlier version of rippled "
1980  "to "
1981  "get the older rules.\n*** CONTINUING ***\n";
1982  }
1983 
1984  JLOG(m_journal.info()) << "Loading ledger " << loadLedger->info().hash
1985  << " seq:" << loadLedger->info().seq;
1986 
1987  if (loadLedger->info().accountHash.isZero())
1988  {
1989  JLOG(m_journal.fatal()) << "Ledger is empty.";
1990  assert(false);
1991  return false;
1992  }
1993 
1994  if (!loadLedger->walkLedger(journal("Ledger"), true))
1995  {
1996  JLOG(m_journal.fatal()) << "Ledger is missing nodes.";
1997  assert(false);
1998  return false;
1999  }
2000 
2001  if (!loadLedger->assertSensible(journal("Ledger")))
2002  {
2003  JLOG(m_journal.fatal()) << "Ledger is not sensible.";
2004  assert(false);
2005  return false;
2006  }
2007 
2008  m_ledgerMaster->setLedgerRangePresent(
2009  loadLedger->info().seq, loadLedger->info().seq);
2010 
2011  m_ledgerMaster->switchLCL(loadLedger);
2012  loadLedger->setValidated();
2013  m_ledgerMaster->setFullLedger(loadLedger, true, false);
2014  openLedger_.emplace(
2015  loadLedger, cachedSLEs_, logs_->journal("OpenLedger"));
2016 
2017  if (replay)
2018  {
2019  // inject transaction(s) from the replayLedger into our open ledger
2020  // and build replay structure
2021  auto replayData =
2022  std::make_unique<LedgerReplay>(loadLedger, replayLedger);
2023 
2024  for (auto const& [_, tx] : replayData->orderedTxns())
2025  {
2026  (void)_;
2027  auto txID = tx->getTransactionID();
2028 
2029  auto s = std::make_shared<Serializer>();
2030  tx->add(*s);
2031 
2033 
2034  openLedger_->modify(
2035  [&txID, &s](OpenView& view, beast::Journal j) {
2036  view.rawTxInsert(txID, std::move(s), nullptr);
2037  return true;
2038  });
2039  }
2040 
2041  m_ledgerMaster->takeReplay(std::move(replayData));
2042  }
2043  }
2044  catch (SHAMapMissingNode const& mn)
2045  {
2046  JLOG(m_journal.fatal())
2047  << "While loading specified ledger: " << mn.what();
2048  return false;
2049  }
2050  catch (boost::bad_lexical_cast&)
2051  {
2052  JLOG(m_journal.fatal())
2053  << "Ledger specified '" << ledgerID << "' is not valid";
2054  return false;
2055  }
2056 
2057  return true;
2058 }
2059 
2060 bool
2062 {
2063  if (!config().ELB_SUPPORT)
2064  return true;
2065 
2066  if (isStopping())
2067  {
2068  reason = "Server is shutting down";
2069  return false;
2070  }
2071 
2072  if (getOPs().isNeedNetworkLedger())
2073  {
2074  reason = "Not synchronized with network yet";
2075  return false;
2076  }
2077 
2078  if (getOPs().isAmendmentBlocked())
2079  {
2080  reason = "Server version too old";
2081  return false;
2082  }
2083 
2084  if (getOPs().isUNLBlocked())
2085  {
2086  reason = "No valid validator list available";
2087  return false;
2088  }
2089 
2090  if (getOPs().getOperatingMode() < OperatingMode::SYNCING)
2091  {
2092  reason = "Not synchronized with network";
2093  return false;
2094  }
2095 
2096  if (!getLedgerMaster().isCaughtUp(reason))
2097  return false;
2098 
2099  if (getFeeTrack().isLoadedLocal())
2100  {
2101  reason = "Too much load";
2102  return false;
2103  }
2104 
2105  return true;
2106 }
2107 
2110 {
2111  return logs_->journal(name);
2112 }
2113 
2114 bool
2116 {
2117  assert(overlay_);
2118  assert(!config_->standalone());
2119 
2120  if (config_->section(ConfigSection::shardDatabase()).empty())
2121  {
2122  JLOG(m_journal.fatal())
2123  << "The [shard_db] configuration setting must be set";
2124  return false;
2125  }
2126  if (!shardStore_)
2127  {
2128  JLOG(m_journal.fatal()) << "Invalid [shard_db] configuration";
2129  return false;
2130  }
2131  shardStore_->importDatabase(getNodeStore());
2132  return true;
2133 }
2134 
2135 void
2137 {
2138  auto seq = getRelationalDatabase().getMaxLedgerSeq();
2139  if (seq)
2140  maxDisallowedLedger_ = *seq;
2141 
2142  JLOG(m_journal.trace())
2143  << "Max persisted ledger is " << maxDisallowedLedger_;
2144 }
2145 
2146 //------------------------------------------------------------------------------
2147 
2148 Application::Application() : beast::PropertyStream::Source("app")
2149 {
2150 }
2151 
2152 //------------------------------------------------------------------------------
2153 
2156  std::unique_ptr<Config> config,
2157  std::unique_ptr<Logs> logs,
2158  std::unique_ptr<TimeKeeper> timeKeeper)
2159 {
2160  return std::make_unique<ApplicationImp>(
2161  std::move(config), std::move(logs), std::move(timeKeeper));
2162 }
2163 
2164 } // namespace ripple
ripple::NodeStoreScheduler
A NodeStore::Scheduler which uses the JobQueue.
Definition: NodeStoreScheduler.h:30
beast::PropertyStream::Source::name
std::string const & name() const
Returns the name of this source.
Definition: beast_PropertyStream.cpp:190
ripple::ApplicationImp::m_resourceManager
std::unique_ptr< Resource::Manager > m_resourceManager
Definition: Application.cpp:188
ripple::ValidatorKeys::publicKey
PublicKey publicKey
Definition: ValidatorKeys.h:40
beast::Journal::fatal
Stream fatal() const
Definition: Journal.h:339
ripple::setup_TxQ
TxQ::Setup setup_TxQ(Config const &config)
Build a TxQ::Setup object from application configuration.
Definition: TxQ.cpp:1855
ripple::ApplicationImp::getReportingETL
ReportingETL & getReportingETL() override
Definition: Application.cpp:895
ripple::NodeStore::DummyScheduler
Simple NodeStore Scheduler that just peforms the tasks synchronously.
Definition: DummyScheduler.h:29
ripple::ApplicationImp::getValidationPublicKey
PublicKey const & getValidationPublicKey() const override
Definition: Application.cpp:580
ripple::ApplicationImp::m_tempNodeCache
NodeCache m_tempNodeCache
Definition: Application.cpp:183
ripple::Section
Holds a collection of configuration values.
Definition: BasicConfig.h:42
ripple::NetworkOPs
Provides server functionality for clients.
Definition: NetworkOPs.h:86
ripple::ApplicationImp::openLedger_
std::optional< OpenLedger > openLedger_
Definition: Application.cpp:181
ripple::getNodeIdentity
std::pair< PublicKey, SecretKey > getNodeIdentity(Application &app)
The cryptographic credentials identifying this server instance.
Definition: NodeIdentity.cpp:32
ripple::RelationalDatabase::init
static std::unique_ptr< RelationalDatabase > init(Application &app, Config const &config, JobQueue &jobQueue)
init Creates and returns an appropriate RelationalDatabase instance based on configuration.
Definition: RelationalDatabase.cpp:34
ripple::ApplicationImp::m_ledgerReplayer
std::unique_ptr< LedgerReplayer > m_ledgerReplayer
Definition: Application.cpp:202
ripple::ApplicationImp::shardStore_
std::unique_ptr< NodeStore::DatabaseShard > shardStore_
Definition: Application.cpp:192
ripple::make_DummyPeerSet
std::unique_ptr< PeerSet > make_DummyPeerSet(Application &app)
Make a dummy PeerSet that does not do anything.
Definition: PeerSet.cpp:187
ripple::RelationalDatabase::getMaxLedgerSeq
virtual std::optional< LedgerIndex > getMaxLedgerSeq()=0
getMaxLedgerSeq Returns the maximum ledger sequence in the Ledgers table.
ripple::Application
Definition: Application.h:115
sstream
ripple::RPC::JsonContext
Definition: Context.h:53
ripple::ApplicationImp::ledgerCleaner_
std::unique_ptr< LedgerCleaner > ledgerCleaner_
Definition: Application.cpp:199
ripple::LoadManager::activateDeadlockDetector
void activateDeadlockDetector()
Turn on deadlock detection.
Definition: LoadManager.cpp:55
ripple::ApplicationImp::m_inboundTransactions
std::unique_ptr< InboundTransactions > m_inboundTransactions
Definition: Application.cpp:201
ripple::NodeStore::make_ShardStore
std::unique_ptr< DatabaseShard > make_ShardStore(Application &app, Scheduler &scheduler, int readThreads, beast::Journal j)
Definition: DatabaseShardImp.cpp:2236
ripple::NodeFamily::sweep
void sweep() override
Definition: NodeFamily.cpp:49
ripple::ApplicationImp::getShardFamily
Family * getShardFamily() override
Definition: Application.cpp:556
ripple::LoadManager
Manages load sources.
Definition: LoadManager.h:45
ripple::ApplicationImp::validators
ValidatorList & validators() override
Definition: Application.cpp:797
ripple::TaggedCache::sweep
void sweep()
Definition: TaggedCache.h:200
std::strlen
T strlen(T... args)
ripple::STLedgerEntry
Definition: STLedgerEntry.h:30
ripple::NodeStore::Database
Persistency layer for NodeObject.
Definition: Database.h:51
ripple::RPC::ShardArchiveHandler::makeShardArchiveHandler
static std::unique_ptr< ShardArchiveHandler > makeShardArchiveHandler(Application &app)
Definition: ShardArchiveHandler.cpp:49
std::string
STL class.
ripple::ApplicationImp::cachedSLEs
CachedSLEs & cachedSLEs() override
Definition: Application.cpp:767
std::shared_ptr
STL class.
ripple::ApplicationImp::getNodeStore
NodeStore::Database & getNodeStore() override
Definition: Application.cpp:665
ripple::RPC::ShardArchiveHandler::start
bool start()
Starts downloading and importing archives.
Definition: ShardArchiveHandler.cpp:235
ripple::TaggedCache< SHAMapHash, Blob >
ripple::ApplicationImp::getRelationalDatabase
RelationalDatabase & getRelationalDatabase() override
Definition: Application.cpp:881
ripple::ApplicationImp::serverOkay
bool serverOkay(std::string &reason) override
Definition: Application.cpp:2061
ripple::loadByIndex
std::shared_ptr< Ledger > loadByIndex(std::uint32_t ledgerIndex, Application &app, bool acquire)
Definition: Ledger.cpp:1065
ripple::ApplicationImp::mRelationalDatabase
std::unique_ptr< RelationalDatabase > mRelationalDatabase
Definition: Application.cpp:222
utility
ripple::LedgerMaster::sweep
void sweep()
Definition: LedgerMaster.cpp:1870
ripple::ApplicationImp::mValidations
RCLValidations mValidations
Definition: Application.cpp:215
ripple::TransactionMaster::sweep
void sweep(void)
Definition: TransactionMaster.cpp:156
std::exception
STL class.
ripple::ApplicationImp::getAcceptedLedgerCache
TaggedCache< uint256, AcceptedLedger > & getAcceptedLedgerCache() override
Definition: Application.cpp:634
ripple::make_Overlay
std::unique_ptr< Overlay > make_Overlay(Application &app, Overlay::Setup const &setup, 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.
Definition: OverlayImpl.cpp:1642
cstring
ripple::ApplicationImp::getHashRouter
HashRouter & getHashRouter() override
Definition: Application.cpp:785
beast::Journal::trace
Stream trace() const
Severity stream access functions.
Definition: Journal.h:309
beast::PropertyStream::Map
Definition: PropertyStream.h:236
ripple::ApplicationImp::validatorSites_
std::unique_ptr< ValidatorSite > validatorSites_
Definition: Application.cpp:210
ripple::ApplicationImp::mWalletDB
std::unique_ptr< DatabaseCon > mWalletDB
Definition: Application.cpp:223
ripple::ApplicationImp::getPathRequests
PathRequests & getPathRequests() override
Definition: Application.cpp:761
ripple::ApplicationImp::m_orderBookDB
OrderBookDB m_orderBookDB
Definition: Application.cpp:196
ripple::make_LoadManager
std::unique_ptr< LoadManager > make_LoadManager(Application &app, beast::Journal journal)
Definition: LoadManager.cpp:197
ripple::TransactionMaster
Definition: TransactionMaster.h:36
ripple::ValidatorSite
Definition: ValidatorSite.h:69
std::pair
ripple::ApplicationImp::onWrite
void onWrite(beast::PropertyStream::Map &stream) override
Subclass override.
Definition: Application.cpp:974
ripple::LedgerMaster
Definition: LedgerMaster.h:70
ripple::ApplicationImp::getInboundLedgers
InboundLedgers & getInboundLedgers() override
Definition: Application.cpp:622
ripple::ApplicationImp::accountIDCache
AccountIDCache const & accountIDCache() const override
Definition: Application.cpp:845
ripple::OpenView
Writable ledger view that accumulates state and tx changes.
Definition: OpenView.h:55
ripple::ApplicationImp::io_latency_sampler::cancel_async
void cancel_async()
Definition: Application.cpp:157
Json::UInt
unsigned int UInt
Definition: json_forwards.h:27
ripple::hotACCOUNT_NODE
@ hotACCOUNT_NODE
Definition: NodeObject.h:35
ripple::setup_DatabaseCon
DatabaseCon::Setup setup_DatabaseCon(Config const &c, std::optional< beast::Journal > j=std::nullopt)
Definition: DatabaseCon.cpp:106
ripple::ApplicationImp::getLedgerReplayer
LedgerReplayer & getLedgerReplayer() override
Definition: Application.cpp:616
ripple::InboundLedger::Reason::GENERIC
@ GENERIC
std::vector
STL class.
ripple::ConfigSection::shardDatabase
static std::string shardDatabase()
Definition: ConfigSections.h:38
std::string::length
T length(T... args)
ripple::ValidatorList::trustedPublisher
bool trustedPublisher(PublicKey const &identity) const
Returns true if public key is a trusted publisher.
Definition: ValidatorList.cpp:1404
ripple::ApplicationImp::waitHandlerCounter_
ClosureCounter< void, boost::system::error_code const & > waitHandlerCounter_
Definition: Application.cpp:218
ripple::ApplicationImp::getOPs
NetworkOPs & getOPs() override
Definition: Application.cpp:586
ripple::ApplicationImp::run
void run() override
Definition: Application.cpp:1527
ripple::make_InboundLedgers
std::unique_ptr< InboundLedgers > make_InboundLedgers(Application &app, InboundLedgers::clock_type &clock, beast::insight::Collector::ptr const &collector)
Definition: InboundLedgers.cpp:434
ripple::CollectorManager
Provides the beast::insight::Collector service.
Definition: CollectorManager.h:29
ripple::ConfigSection::importNodeDatabase
static std::string importNodeDatabase()
Definition: ConfigSections.h:43
std::chrono::milliseconds
ripple::Config::NODE_SIZE
std::size_t NODE_SIZE
Definition: Config.h:197
ripple::ApplicationImp::isTimeToStop
std::atomic< bool > isTimeToStop
Definition: Application.cpp:232
ripple::ApplicationImp::m_acceptedLedgerCache
TaggedCache< uint256, AcceptedLedger > m_acceptedLedgerCache
Definition: Application.cpp:203
ripple::ApplicationImp::setup
bool setup() override
Definition: Application.cpp:1111
ripple::SHAMapStore
class to create database, launch online delete thread, and related SQLite database
Definition: SHAMapStore.h:36
ripple::ApplicationImp::validatorManifests
ManifestCache & validatorManifests() override
Definition: Application.cpp:809
ripple::ApplicationImp::getWalletDB
DatabaseCon & getWalletDB() override
Retrieve the "wallet database".
Definition: Application.cpp:888
ripple::getLatestLedger
std::tuple< std::shared_ptr< Ledger >, std::uint32_t, uint256 > getLatestLedger(Application &app)
Definition: Ledger.cpp:1055
ripple::ApplicationImp::getCollectorManager
CollectorManager & getCollectorManager() override
Definition: Application.cpp:542
ripple::ApplicationImp::sweepTimer_
boost::asio::steady_timer sweepTimer_
Definition: Application.cpp:219
ripple::ApplicationImp::cluster_
std::unique_ptr< Cluster > cluster_
Definition: Application.cpp:205
ripple::ApplicationImp::getShardStore
NodeStore::DatabaseShard * getShardStore() override
Definition: Application.cpp:673
ripple::ApplicationImp::openLedger
OpenLedger const & openLedger() const override
Definition: Application.cpp:859
ripple::ApplicationImp::getIOLatency
std::chrono::milliseconds getIOLatency() override
Definition: Application.cpp:598
ripple::ApplicationImp::m_shaMapStore
std::unique_ptr< SHAMapStore > m_shaMapStore
Definition: Application.cpp:178
ripple::make_CollectorManager
std::unique_ptr< CollectorManager > make_CollectorManager(Section const &params, beast::Journal journal)
Definition: CollectorManager.cpp:72
ripple::Config::LOAD
@ LOAD
Definition: Config.h:132
beast::Journal::warn
Stream warn() const
Definition: Journal.h:327
std::recursive_mutex
STL class.
std::reference_wrapper::get
T get(T... args)
ripple::ApplicationImp::getIOService
boost::asio::io_service & getIOService() override
Definition: Application.cpp:592
ripple::ApplicationImp::shardArchiveHandler_
std::unique_ptr< RPC::ShardArchiveHandler > shardArchiveHandler_
Definition: Application.cpp:194
std::lock_guard
STL class.
beast::severities
A namespace for easy access to logging severity values.
Definition: Journal.h:29
ripple::perf::PerfLog
Singleton class that maintains performance counters and optionally writes Json-formatted data to a di...
Definition: PerfLog.h:48
ripple::STParsedJSONObject
Holds the serialized result of parsing an input JSON object.
Definition: STParsedJSON.h:31
ripple::PendingSaves
Keeps track of which ledgers haven't been fully saved.
Definition: PendingSaves.h:36
ripple::Resource::feeReferenceRPC
const Charge feeReferenceRPC
ripple::make_LedgerCleaner
std::unique_ptr< LedgerCleaner > make_LedgerCleaner(Application &app, beast::Journal journal)
Definition: LedgerCleaner.cpp:455
ripple::Pathfinder::initPathTable
static void initPathTable()
Definition: Pathfinder.cpp:1300
std::cerr
ripple::ApplicationImp::ApplicationImp
ApplicationImp(std::unique_ptr< Config > config, std::unique_ptr< Logs > logs, std::unique_ptr< TimeKeeper > timeKeeper)
Definition: Application.cpp:269
ripple::ApplicationImp::signalStop
void signalStop() override
Definition: Application.cpp:1630
ripple::ApplicationImp::cluster
Cluster & cluster() override
Definition: Application.cpp:821
ripple::stopwatch
Stopwatch & stopwatch()
Returns an instance of a wall clock.
Definition: chrono.h:88
ripple::make_NetworkOPs
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, ValidatorKeys const &validatorKeys, boost::asio::io_service &io_svc, beast::Journal journal, beast::insight::Collector::ptr const &collector)
Definition: NetworkOPs.cpp:4562
ripple::make_InboundTransactions
std::unique_ptr< InboundTransactions > make_InboundTransactions(Application &app, beast::insight::Collector::ptr const &collector, std::function< void(std::shared_ptr< SHAMap > const &, bool)> gotSet)
Definition: InboundTransactions.cpp:269
ripple::ApplicationImp::getLedgerMaster
LedgerMaster & getLedgerMaster() override
Definition: Application.cpp:604
Json::Reader
Unserialize a JSON document into a Value.
Definition: json_reader.h:36
ripple::NodeFamily
Definition: NodeFamily.h:30
ripple::STParsedJSONObject::object
std::optional< STObject > object
The STObject if the parse was successful.
Definition: STParsedJSON.h:50
ripple::ResolverAsio::New
static std::unique_ptr< ResolverAsio > New(boost::asio::io_service &, beast::Journal)
Definition: ResolverAsio.cpp:406
iostream
ripple::ApplicationImp::m_nodeStore
std::unique_ptr< NodeStore::Database > m_nodeStore
Definition: Application.cpp:190
ripple::ApplicationImp::initRelationalDatabase
bool initRelationalDatabase()
Definition: Application.cpp:910
ripple::ApplicationImp::perfLog_
std::unique_ptr< perf::PerfLog > perfLog_
Definition: Application.cpp:169
ripple::AccountIDCache
Caches the base58 representations of AccountIDs.
Definition: AccountID.h:118
ripple::ApplicationImp::nodeIdentity_
std::pair< PublicKey, SecretKey > nodeIdentity_
Definition: Application.cpp:185
ripple::InboundLedgers::sweep
virtual void sweep()=0
ripple::ValidatorKeys
Validator keys and manifest as set in configuration file.
Definition: ValidatorKeys.h:36
ripple::HashRouter
Routing table for objects identified by hash.
Definition: HashRouter.h:53
ripple::forceValidity
void forceValidity(HashRouter &router, uint256 const &txid, Validity validity)
Sets the validity of a given transaction in the cache.
Definition: apply.cpp:89
ripple::ApplicationImp::validatorKeys_
const ValidatorKeys validatorKeys_
Definition: Application.cpp:186
ripple::ApplicationImp::timeKeeper_
std::unique_ptr< TimeKeeper > timeKeeper_
Definition: Application.cpp:166
ripple::OperatingMode::SYNCING
@ SYNCING
fallen slightly behind
ripple::Config::IO_WORKERS
int IO_WORKERS
Definition: Config.h:219
ripple::SHAMapMissingNode
Definition: SHAMapMissingNode.h:55
ripple::Validity::SigGoodOnly
@ SigGoodOnly
Signature is good, but local checks fail.
ripple::ApplicationImp::getShardArchiveHandler
RPC::ShardArchiveHandler * getShardArchiveHandler(bool tryRecovery) override
Definition: Application.cpp:679
ripple::ApplicationImp::m_inboundLedgers
std::unique_ptr< InboundLedgers > m_inboundLedgers
Definition: Application.cpp:200
ripple::ApplicationImp::peerReservations_
std::unique_ptr< PeerReservationTable > peerReservations_
Definition: Application.cpp:206
ripple::setup_ServerHandler
ServerHandler::Setup setup_ServerHandler(Config const &config, std::ostream &&log)
Definition: ServerHandlerImp.cpp:1211
ripple::ApplicationImp::loadLedgerFromFile
std::shared_ptr< Ledger > loadLedgerFromFile(std::string const &ledgerID)
Definition: Application.cpp:1743
ripple::ApplicationImp::checkSigs
bool checkSigs() const override
Definition: Application.cpp:1637
ripple::ApplicationImp::journal
beast::Journal journal(std::string const &name) override
Definition: Application.cpp:2109
ripple::base_uint< 256 >
ripple::ApplicationImp::entropyTimer_
boost::asio::steady_timer entropyTimer_
Definition: Application.cpp:220
ripple::ApplicationImp::getMaxDisallowedLedger
LedgerIndex getMaxDisallowedLedger() override
Ensure that a newly-started validator does not sign proposals older than the last ledger it persisted...
Definition: Application.cpp:1078
ripple::ApplicationImp::nodeToShards
bool nodeToShards()
Definition: Application.cpp:2115
ripple::ApplicationImp::hashRouter_
std::unique_ptr< HashRouter > hashRouter_
Definition: Application.cpp:214
ripple::ApplicationImp::getMasterMutex
Application::MutexType & getMasterMutex() override
Definition: Application.cpp:737
ripple::ApplicationImp::m_ledgerMaster
std::unique_ptr< LedgerMaster > m_ledgerMaster
Definition: Application.cpp:198
ripple::RPC::doCommand
Status doCommand(RPC::JsonContext &context, Json::Value &result)
Execute an RPC command and store the results in a Json::Value.
Definition: RPCHandler.cpp:250
ripple::setup_Overlay
Overlay::Setup setup_Overlay(BasicConfig const &config)
Definition: OverlayImpl.cpp:1537
ripple::ApplicationImp::logs
Logs & logs() override
Definition: Application.cpp:530
ripple::Config::reporting
bool reporting() const
Definition: Config.h:316
ripple::ApplicationImp::getPerfLog
perf::PerfLog & getPerfLog() override
Definition: Application.cpp:653
ripple::ApplicationImp::m_jobQueue
std::unique_ptr< JobQueue > m_jobQueue
Definition: Application.cpp:176
ripple::ApplicationImp::checkSigs_
std::atomic< bool > checkSigs_
Definition: Application.cpp:234
std::reference_wrapper
ripple::make_ServerHandler
std::unique_ptr< ServerHandler > make_ServerHandler(Application &app, boost::asio::io_service &io_service, JobQueue &jobQueue, NetworkOPs &networkOPs, Resource::Manager &resourceManager, CollectorManager &cm)
Definition: ServerHandlerImp.cpp:1223
ripple::loadByHash
std::shared_ptr< Ledger > loadByHash(uint256 const &ledgerHash, Application &app, bool acquire)
Definition: Ledger.cpp:1078
ripple::TxQ
Transaction Queue.
Definition: TxQ.h:57
ripple::Config::FORCE_MULTI_THREAD
bool FORCE_MULTI_THREAD
Definition: Config.h:223
ripple::ApplicationImp::numberOfThreads
static std::size_t numberOfThreads(Config const &config)
Definition: Application.cpp:246
ripple::base_uint::isZero
bool isZero() const
Definition: base_uint.h:531
ripple::ApplicationImp::getSHAMapStore
SHAMapStore & getSHAMapStore() override
Definition: Application.cpp:833
ripple::Role::ADMIN
@ ADMIN
ripple::detail::supportedAmendments
std::map< std::string, DefaultVote > const & supportedAmendments()
Amendments that this server supports and the default voting behavior.
Definition: Feature.cpp:314
beast::PropertyStream::Source::add
void add(Source &source)
Add a child source.
Definition: beast_PropertyStream.cpp:196
ripple::ApplicationImp::getAmendmentTable
AmendmentTable & getAmendmentTable() override
Definition: Application.cpp:773
ripple::ApplicationImp::loadOldLedger
bool loadOldLedger(std::string const &ledgerID, bool replay, bool isFilename)
Definition: Application.cpp:1878
ripple::PublicKey
A public key.
Definition: PublicKey.h:59
std::atomic::load
T load(T... args)
ripple::Config
Definition: Config.h:68
ripple::ApplicationImp::io_latency_sampler::cancel
void cancel()
Definition: Application.cpp:151
ripple::PublicKey::size
std::size_t size() const noexcept
Definition: PublicKey.h:87
ripple::Cluster
Definition: Cluster.h:38
std::thread::hardware_concurrency
T hardware_concurrency(T... args)
ripple::ValidatorList
Definition: ValidatorList.h:172
chrono
ripple::ApplicationImp::getResourceManager
Resource::Manager & getResourceManager() override
Definition: Application.cpp:749
ripple::ApplicationImp::peerReservations
PeerReservationTable & peerReservations() override
Definition: Application.cpp:827
ripple::ApplicationImp::publisherManifests
ManifestCache & publisherManifests() override
Definition: Application.cpp:815
ripple::ApplicationImp::m_amendmentTable
std::unique_ptr< AmendmentTable > m_amendmentTable
Definition: Application.cpp:212
ripple::Config::NETWORK
@ NETWORK
Definition: Config.h:132
ripple::ApplicationImp::overlay
Overlay & overlay() override
Definition: Application.cpp:867
ripple::megabytes
constexpr auto megabytes(T value) noexcept
Definition: ByteUtilities.h:34
ripple::ApplicationImp::pendingSaves
PendingSaves & pendingSaves() override
Definition: Application.cpp:839
ripple::ApplicationImp::m_collectorManager
std::unique_ptr< CollectorManager > m_collectorManager
Definition: Application.cpp:175
ripple::Config::standalone
bool standalone() const
Definition: Config.h:311
ripple::ApplicationImp::nodeFamily_
NodeFamily nodeFamily_
Definition: Application.cpp:191
ripple::HashRouter::getDefaultHoldTime
static std::chrono::seconds getDefaultHoldTime()
Definition: HashRouter.h:139
ripple::LedgerFill::full
@ full
Definition: LedgerToJson.h:49
std::unique_lock
STL class.
beast::io_latency_probe::sample
void sample(Handler &&handler)
Initiate continuous i/o latency sampling.
Definition: io_latency_probe.h:119
ripple::ApplicationImp::m_txMaster
TransactionMaster m_txMaster
Definition: Application.cpp:173
ripple::NodeStore::DatabaseShard
A collection of historical shards.
Definition: DatabaseShard.h:37
ripple::LoadFeeTrack
Manages the current fee schedule.
Definition: LoadFeeTrack.h:44
ripple::set
bool set(T &target, std::string const &name, Section const &section)
Set a value from a configuration Section If the named value is not found or doesn't parse as a T,...
Definition: BasicConfig.h:313
ripple::ValidatorList::listed
bool listed(PublicKey const &identity) const
Returns true if public key is included on any lists.
Definition: ValidatorList.cpp:1349
ripple::ApplicationImp::validatorSites
ValidatorSite & validatorSites() override
Definition: Application.cpp:803
ripple::ApplicationImp::nodeIdentity
std::pair< PublicKey, SecretKey > const & nodeIdentity() override
Definition: Application.cpp:574
beast::Journal::error
Stream error() const
Definition: Journal.h:333
beast::Journal::info
Stream info() const
Definition: Journal.h:321
ripple::ApplicationImp::io_latency_sampler::m_event
beast::insight::Event m_event
Definition: Application.cpp:102
std::chrono::time_point
beast::insight::Event
A metric for reporting event timing.
Definition: Event.h:40
ripple::ApplicationImp::config_
std::unique_ptr< Config > config_
Definition: Application.cpp:164
ripple::BuildInfo::getVersionString
std::string const & getVersionString()
Server version.
Definition: BuildInfo.cpp:65
ripple::OrderBookDB::setup
void setup(std::shared_ptr< ReadView const > const &ledger)
Definition: OrderBookDB.cpp:37
beast::basic_logstream
Definition: Journal.h:428
ripple::ReportingETL
This class is responsible for continuously extracting data from a p2p node, and writing that data to ...
Definition: ReportingETL.h:70
ripple::ApplicationImp::getLastFullLedger
std::shared_ptr< Ledger > getLastFullLedger()
Definition: Application.cpp:1703
ripple::TimeKeeper::closeTime
virtual time_point closeTime() const =0
Returns the close time, in network time.
ripple::Family
Definition: Family.h:32
ripple::ValidatorKeys::configInvalid
bool configInvalid() const
Definition: ValidatorKeys.h:49
ripple::ClosureCounter
The role of a ClosureCounter is to assist in shutdown by letting callers wait for the completion of c...
Definition: ClosureCounter.h:54
ripple::ApplicationImp::m_io_latency_sampler
io_latency_sampler m_io_latency_sampler
Definition: Application.cpp:238
beast::Journal
A generic endpoint for log messages.
Definition: Journal.h:58
ripple::SizedItem::burstSize
@ burstSize
std::uint32_t
ripple::Config::WORKERS
int WORKERS
Definition: Config.h:218
std::condition_variable::wait
T wait(T... args)
ripple::ApplicationImp::gotTXSet
void gotTXSet(std::shared_ptr< SHAMap > const &set, bool fromAcquire)
Definition: Application.cpp:640
std::atomic< std::chrono::milliseconds >
ripple::ApplicationImp::startGenesisLedger
void startGenesisLedger()
Definition: Application.cpp:1683
ripple::ApplicationImp::m_signals
boost::asio::signal_set m_signals
Definition: Application.cpp:226
ripple::TimeKeeper
Manages various times used by the server.
Definition: TimeKeeper.h:32
ripple::ApplicationImp::timeKeeper
TimeKeeper & timeKeeper() override
Definition: Application.cpp:562
beast::io_latency_probe< std::chrono::steady_clock >
ripple::OrderBookDB
Definition: OrderBookDB.h:30
ripple::ApplicationImp::io_latency_sampler::operator()
void operator()(Duration const &elapsed)
Definition: Application.cpp:128
ripple::NodeStore::Database::sweep
virtual void sweep()=0
Remove expired entries from the positive and negative caches.
ripple::InboundLedgers
Manages the lifetime of inbound ledgers.
Definition: InboundLedgers.h:33
ripple::OpenLedger
Represents the open ledger.
Definition: OpenLedger.h:49
ripple::Validations::flush
void flush()
Flush all current validations.
Definition: Validations.h:1100
ripple::JobQueue
A pool of threads to perform work.
Definition: JobQueue.h:55
ripple::Application::Application
Application()
Definition: Application.cpp:2148
std::min
T min(T... args)
ripple::ApplicationImp::setMaxDisallowedLedger
void setMaxDisallowedLedger()
Definition: Application.cpp:2136
ripple::Resource::Manager
Tracks load and resource consumption.
Definition: ResourceManager.h:36
ripple::ApplicationImp::shardFamily_
std::unique_ptr< ShardFamily > shardFamily_
Definition: Application.cpp:193
ripple::ApplicationImp::io_latency_sampler::lastSample_
std::atomic< std::chrono::milliseconds > lastSample_
Definition: Application.cpp:105
ripple::ApplicationImp::setSweepTimer
void setSweepTimer()
Definition: Application.cpp:981
ripple::ApplicationImp::overlay_
std::unique_ptr< Overlay > overlay_
Definition: Application.cpp:224
ripple::BuildInfo::getFullVersionString
std::string const & getFullVersionString()
Full server version string.
Definition: BuildInfo.cpp:78
ripple::ApplicationImp::openLedger
OpenLedger & openLedger() override
Definition: Application.cpp:851
ripple::ApplicationImp::pendingSaves_
PendingSaves pendingSaves_
Definition: Application.cpp:179
ripple::ApplicationImp::m_resolver
std::unique_ptr< ResolverAsio > m_resolver
Definition: Application.cpp:236
ripple::ApplicationImp::getTxQ
TxQ & getTxQ() override
Definition: Application.cpp:874
ripple::PeerReservationTable
Definition: PeerReservationTable.h:79
ripple::ManifestCache
Remembers manifests with the highest sequence number.
Definition: Manifest.h:225
ripple::LedgerReplayer::sweep
void sweep()
Remove completed tasks.
Definition: LedgerReplayer.cpp:219
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::Config::FRESH
@ FRESH
Definition: Config.h:132
ripple::Resource::make_Manager
std::unique_ptr< Manager > make_Manager(beast::insight::Collector::ptr const &collector, beast::Journal journal)
Definition: ResourceManager.cpp:175
std::atomic::exchange
T exchange(T... args)
ripple::ApplicationImp::getTempNodeCache
NodeCache & getTempNodeCache() override
Definition: Application.cpp:659
ripple::ApplicationImp::io_latency_sampler::get
std::chrono::milliseconds get() const
Definition: Application.cpp:145
beast::io_latency_probe::cancel
void cancel()
Cancel all pending i/o.
Definition: io_latency_probe.h:84
Json::Value::removeMember
Value removeMember(const char *key)
Remove and return the named member.
Definition: json_value.cpp:907
ripple::ApplicationImp::grpcServer_
std::unique_ptr< GRPCServer > grpcServer_
Definition: Application.cpp:240
std::endl
T endl(T... args)
ripple::ApplicationImp::stoppingCondition_
std::condition_variable stoppingCondition_
Definition: Application.cpp:230
ripple::OpenView::rawTxInsert
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.
Definition: OpenView.cpp:261
ripple::RPC::ShardArchiveHandler::tryMakeRecoveryHandler
static std::unique_ptr< ShardArchiveHandler > tryMakeRecoveryHandler(Application &app)
Definition: ShardArchiveHandler.cpp:55
ripple::ApplicationImp::getJobQueue
JobQueue & getJobQueue() override
Definition: Application.cpp:568
ripple::ApplicationImp::fdRequired
int fdRequired() const override
Definition: Application.cpp:1655
ripple::ApplicationImp::doSweep
void doSweep()
Definition: Application.cpp:1041
beast::PropertyStream::Source::Source
Source(std::string const &name)
Definition: beast_PropertyStream.cpp:176
ripple::Overlay
Manages the set of connected peers.
Definition: Overlay.h:51
ripple::ApplicationImp::io_latency_sampler
Definition: Application.cpp:99
limits
ripple::ApplicationImp::getOrderBookDB
OrderBookDB & getOrderBookDB() override
Definition: Application.cpp:755
ripple::ApplicationImp
Definition: Application.cpp:96
ripple::ApplicationImp::getLoadManager
LoadManager & getLoadManager() override
Definition: Application.cpp:743
beast::lexicalCastChecked
bool lexicalCastChecked(Out &out, In in)
Intelligently convert from one type to another.
Definition: LexicalCast.h:266
ripple::make_PeerSetBuilder
std::unique_ptr< PeerSetBuilder > make_PeerSetBuilder(Application &app)
Definition: PeerSet.cpp:144
ripple::ApplicationImp::io_latency_sampler::m_probe
beast::io_latency_probe< std::chrono::steady_clock > m_probe
Definition: Application.cpp:104
ripple::ApplicationImp::isStopping
bool isStopping() const override
Definition: Application.cpp:1649
ripple::ApplicationImp::accountIDCache_
AccountIDCache accountIDCache_
Definition: Application.cpp:180
std
STL namespace.
ripple::ApplicationImp::m_nodeStoreScheduler
NodeStoreScheduler m_nodeStoreScheduler
Definition: Application.cpp:177
ripple::ApplicationImp::m_loadManager
std::unique_ptr< LoadManager > m_loadManager
Definition: Application.cpp:216
ripple::create_genesis
const create_genesis_t create_genesis
Definition: Ledger.cpp:62
ripple::Config::REPLAY
@ REPLAY
Definition: Config.h:132
ripple::ApplicationImp::getInboundTransactions
InboundTransactions & getInboundTransactions() override
Definition: Application.cpp:628
ripple::makeWalletDB
std::unique_ptr< DatabaseCon > makeWalletDB(DatabaseCon::Setup const &setup)
makeWalletDB Opens the wallet database and returns it.
Definition: Wallet.cpp:26
ripple::PostgresDatabase
Definition: PostgresDatabase.h:27
Json::Reader::parse
bool parse(std::string const &document, Value &root)
Read a Value from a JSON document.
Definition: json_reader.cpp:74
condition_variable
ripple::Resource::Consumer
An endpoint that consumes resources.
Definition: Consumer.h:34
ripple::Resource::Charge
A consumption charge.
Definition: Charge.h:30
ripple::SizedItem::sweepInterval
@ sweepInterval
ripple::DatabaseCon
Definition: DatabaseCon.h:81
ripple::RPC::apiMaximumSupportedVersion
constexpr unsigned int apiMaximumSupportedVersion
Definition: RPCHelpers.h:244
ripple::ApplicationImp::mFeeTrack
std::unique_ptr< LoadFeeTrack > mFeeTrack
Definition: Application.cpp:213
ripple::ApplicationImp::getFeeTrack
LoadFeeTrack & getFeeTrack() override
Definition: Application.cpp:779
ripple::addJson
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.
Definition: LedgerToJson.cpp:281
ripple::RPC::ShardArchiveHandler
Handles the download and import of one or more shard archives.
Definition: ShardArchiveHandler.h:42
ripple::LedgerReplayer
Manages the lifetime of ledger replay tasks.
Definition: LedgerReplayer.h:72
beast::severities::kDebug
@ kDebug
Definition: Journal.h:35
ripple::ApplicationImp::io_latency_sampler::m_journal
beast::Journal m_journal
Definition: Application.cpp:103
ripple::ApplicationImp::config
Config & config() override
Definition: Application.cpp:536
ripple::ApplicationImp::validators_
std::unique_ptr< ValidatorList > validators_
Definition: Application.cpp:209
std::string::empty
T empty(T... args)
ripple::ApplicationImp::getLedgerCleaner
LedgerCleaner & getLedgerCleaner() override
Definition: Application.cpp:610
ripple::ApplicationImp::m_journal
beast::Journal m_journal
Definition: Application.cpp:168
ripple::Validations< RCLValidationsAdaptor >
ripple::ClosureCounter::join
void join(char const *name, std::chrono::milliseconds wait, beast::Journal j)
Returns once all counted in-flight closures are destroyed.
Definition: ClosureCounter.h:166
optional
beast::io_latency_probe::cancel_async
void cancel_async()
Definition: io_latency_probe.h:91
mutex
ripple::ApplicationImp::stoppingMutex_
std::mutex stoppingMutex_
Definition: Application.cpp:231
ripple::ApplicationImp::io_latency_sampler::io_latency_sampler
io_latency_sampler(beast::insight::Event ev, beast::Journal journal, std::chrono::milliseconds interval, boost::asio::io_service &ios)
Definition: Application.cpp:108
beast::Journal::debug
Stream debug() const
Definition: Journal.h:315
ripple::ApplicationImp::serverHandler_
std::unique_ptr< ServerHandler > serverHandler_
Definition: Application.cpp:211
std::size_t
ripple::to_string
std::string to_string(Manifest const &m)
Format the specified manifest to a string for debugging purposes.
Definition: app/misc/impl/Manifest.cpp:41
ripple::make_AmendmentTable
std::unique_ptr< AmendmentTable > make_AmendmentTable(Application &app, std::chrono::seconds majorityTime, std::vector< AmendmentTable::FeatureInfo > const &supported, Section const &enabled, Section const &vetoed, beast::Journal journal)
Definition: AmendmentTable.cpp:789
ripple::ApplicationImp::validatorManifests_
std::unique_ptr< ManifestCache > validatorManifests_
Definition: Application.cpp:207
BasicApp
Definition: BasicApp.h:29
ripple::ApplicationImp::m_pathRequests
std::unique_ptr< PathRequests > m_pathRequests
Definition: Application.cpp:197
ripple::ApplicationImp::m_networkOPs
std::unique_ptr< NetworkOPs > m_networkOPs
Definition: Application.cpp:204
ripple::ApplicationImp::getNodeFamily
Family & getNodeFamily() override
Definition: Application.cpp:548
ripple::PathRequests
Definition: PathRequests.h:33
ripple::ApplicationImp::txQ_
std::unique_ptr< TxQ > txQ_
Definition: Application.cpp:217
ripple::ApplicationImp::cachedSLEs_
CachedSLEs cachedSLEs_
Definition: Application.cpp:184
std::max
T max(T... args)
ripple::base_uint::parseHex
constexpr bool parseHex(std::string_view sv)
Parse a hex string into a base_uint.
Definition: base_uint.h:495
ripple::Validations::expire
void expire(beast::Journal &j)
Expire old validation sets.
Definition: Validations.h:725
ripple::NodeStore::Manager::instance
static Manager & instance()
Returns the instance of the manager singleton.
Definition: ManagerImp.cpp:120
ripple::ApplicationImp::m_masterMutex
Application::MutexType m_masterMutex
Definition: Application.cpp:170
ripple::NodeStore::Manager::make_Database
virtual std::unique_ptr< Database > make_Database(std::size_t burstSize, Scheduler &scheduler, int readThreads, Section const &backendParameters, beast::Journal journal)=0
Construct a NodeStore database.
ripple::getRegisteredFeature
std::optional< uint256 > getRegisteredFeature(std::string const &name)
Definition: Feature.cpp:336
ripple::LedgerCleaner
Check the ledger/transaction databases to make sure they have continuity.
Definition: LedgerCleaner.h:32
BasicApp::get_io_service
boost::asio::io_service & get_io_service()
Definition: BasicApp.h:41
ripple::ApplicationImp::initNodeStore
bool initNodeStore()
Definition: Application.cpp:936
ripple::ApplicationImp::maxDisallowedLedger_
std::atomic< LedgerIndex > maxDisallowedLedger_
Definition: Application.cpp:1086
ripple::make_SHAMapStore
std::unique_ptr< SHAMapStore > make_SHAMapStore(Application &app, NodeStore::Scheduler &scheduler, beast::Journal journal)
Definition: SHAMapStoreImp.cpp:728
ripple::RelationalDatabase
Definition: RelationalDatabase.h:48
ripple::ApplicationImp::publisherManifests_
std::unique_ptr< ManifestCache > publisherManifests_
Definition: Application.cpp:208
ripple::AmendmentTable
The amendment table stores the list of enabled and potential amendments.
Definition: AmendmentTable.h:37
ripple::ApplicationImp::getMasterTransaction
TransactionMaster & getMasterTransaction() override
Definition: Application.cpp:647
std::unique_ptr
STL class.
ripple::NetClock::time_point
std::chrono::time_point< NetClock > time_point
Definition: chrono.h:56
ripple::Config::LOAD_FILE
@ LOAD_FILE
Definition: Config.h:132
ripple::ApplicationImp::io_latency_sampler::start
void start()
Definition: Application.cpp:121
std::condition_variable::notify_all
T notify_all(T... args)
ripple::ApplicationImp::reportingETL_
std::unique_ptr< ReportingETL > reportingETL_
Definition: Application.cpp:241
Json::Value::isObjectOrNull
bool isObjectOrNull() const
Definition: json_value.cpp:1033
ripple::ApplicationImp::getValidations
RCLValidations & getValidations() override
Definition: Application.cpp:791
ripple::ApplicationImp::setEntropyTimer
void setEntropyTimer()
Definition: Application.cpp:1012
ripple::make_Application
std::unique_ptr< Application > make_Application(std::unique_ptr< Config > config, std::unique_ptr< Logs > logs, std::unique_ptr< TimeKeeper > timeKeeper)
Definition: Application.cpp:2155
ripple::ValidatorKeys::manifest
std::string manifest
Definition: ValidatorKeys.h:43
std::ref
T ref(T... args)
std::exception::what
T what(T... args)
ripple::ApplicationImp::start
void start(bool withTimers) override
Definition: Application.cpp:1504
Json::Value
Represents a JSON value.
Definition: json_value.h:145
beast::insight::Event::notify
void notify(std::chrono::duration< Rep, Period > const &value) const
Push an event notification.
Definition: Event.h:64
ripple::ApplicationImp::logs_
std::unique_ptr< Logs > logs_
Definition: Application.cpp:165
ripple::InboundTransactions
Manages the acquisition and lifetime of transaction sets.
Definition: InboundTransactions.h:35
variant
Json::Value::asString
std::string asString() const
Returns the unquoted string value.
Definition: json_value.cpp:469
ripple::ClosureCounter::wrap
std::optional< Substitute< Closure > > wrap(Closure &&closure)
Wrap the passed closure with a reference counter.
Definition: ClosureCounter.h:192
std::ifstream
STL class.
beast
Definition: base_uint.h:677
std::chrono