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