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