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