xrpld
Loading...
Searching...
No Matches
xrpld/core/detail/Config.cpp
1#include <xrpld/core/Config.h>
2
3#include <xrpl/basics/FileUtilities.h>
4#include <xrpl/basics/Log.h>
5#include <xrpl/basics/StringUtilities.h>
6#include <xrpl/basics/chrono.h>
7#include <xrpl/basics/contract.h>
8#include <xrpl/beast/core/LexicalCast.h>
9#include <xrpl/beast/utility/Journal.h>
10#include <xrpl/beast/utility/instrumentation.h>
11#include <xrpl/config/BasicConfig.h>
12#include <xrpl/config/Constants.h>
13#include <xrpl/net/HTTPClient.h>
14#include <xrpl/protocol/Feature.h>
15#include <xrpl/protocol/Fees.h>
16#include <xrpl/protocol/SystemParameters.h>
17#include <xrpl/rdb/DBInit.h>
18#include <xrpl/rdb/DatabaseCon.h>
19
20#include <boost/algorithm/string/classification.hpp>
21#include <boost/algorithm/string/predicate.hpp>
22#include <boost/algorithm/string/replace.hpp>
23#include <boost/algorithm/string/split.hpp>
24#include <boost/algorithm/string/trim.hpp>
25#include <boost/multiprecision/detail/endian.hpp>
26#include <boost/predef.h>
27#include <boost/regex.hpp> // IWYU pragma: keep
28#include <boost/regex/v5/regex.hpp>
29#include <boost/regex/v5/regex_match.hpp>
30
31#include <algorithm>
32#include <array>
33#include <chrono>
34#include <cstdint>
35#include <cstdlib>
36#include <filesystem>
37#include <format>
38#include <iostream>
39#include <iterator>
40#include <limits>
41#include <memory>
42#include <optional>
43#include <regex>
44#include <sstream>
45#include <stdexcept>
46#include <string>
47#include <string_view>
48#include <system_error>
49#include <thread>
50#include <type_traits>
51#include <utility>
52#include <vector>
53
54#if BOOST_OS_WINDOWS
55#include <sysinfoapi.h>
56
57namespace xrpl::detail {
58
59[[nodiscard]] std::uint64_t
60getMemorySize()
61{
62 if (MEMORYSTATUSEX msx{sizeof(MEMORYSTATUSEX)}; GlobalMemoryStatusEx(&msx))
63 return static_cast<std::uint64_t>(msx.ullTotalPhys);
64
65 return 0;
66}
67
68} // namespace xrpl::detail
69
70#endif
71
72#if BOOST_OS_LINUX
73#include <sys/sysinfo.h> // IWYU pragma: keep
74
75namespace xrpl::detail {
76
77[[nodiscard]] std::uint64_t
78getMemorySize()
79{
80 if (struct sysinfo si{}; sysinfo(&si) == 0)
81 return static_cast<std::uint64_t>(si.totalram) * si.mem_unit;
82
83 return 0;
84}
85
86} // namespace xrpl::detail
87
88#endif
89
90#if BOOST_OS_MACOS
91#include <sys/sysctl.h>
92
93namespace xrpl::detail {
94
95[[nodiscard]] std::uint64_t
96getMemorySize()
97{
98 int mib[] = {CTL_HW, HW_MEMSIZE};
99 std::int64_t ram = 0;
100 size_t size = sizeof(ram);
101
102 if (sysctl(mib, 2, &ram, &size, nullptr, 0) == 0)
103 return static_cast<std::uint64_t>(ram);
104
105 return 0;
106}
107
108} // namespace xrpl::detail
109
110#endif
111
112namespace xrpl {
113
114// clang-format off
115// The configurable node sizes are "tiny", "small", "medium", "large", "huge"
116inline constexpr std::array<std::pair<SizedItem, std::array<int, 5>>, 13>
118{{
119 // FIXME: We should document each of these items, explaining exactly
120 // what they control and whether there exists an explicit
121 // config option that can be used to override the default.
122
123 // tiny small medium large huge
124 {SizedItem::SweepInterval, {{ 10, 30, 60, 90, 120 }}},
125 {SizedItem::TreeCacheSize, {{ 262144, 524288, 2097152, 4194304, 8388608 }}},
126 {SizedItem::TreeCacheAge, {{ 30, 60, 90, 120, 900 }}},
127 {SizedItem::LedgerSize, {{ 32, 32, 64, 256, 384 }}},
128 {SizedItem::LedgerAge, {{ 30, 60, 180, 300, 600 }}},
129 {SizedItem::LedgerFetch, {{ 2, 3, 4, 5, 8 }}},
130 {SizedItem::HashNodeDbCache, {{ 4, 12, 24, 64, 128 }}},
131 {SizedItem::TxnDbCache, {{ 4, 12, 24, 64, 128 }}},
132 {SizedItem::LgrDbCache, {{ 4, 8, 16, 32, 128 }}},
133 {SizedItem::OpenFinalLimit, {{ 8, 16, 32, 64, 128 }}},
134 {SizedItem::BurstSize, {{ 4, 8, 16, 32, 48 }}},
135 {SizedItem::RamSizeGb, {{ 6, 8, 12, 24, 0 }}},
136 {SizedItem::AccountIdCacheSize, {{ 20047, 50053, 77081, 150061, 300007 }}},
137},};
138// clang-format on
139
140// Ensure that the order of entries in the table corresponds to the
141// order of entries in the enum:
142static_assert(
143 [] constexpr -> bool {
145
146 for (auto const& i : kSizedItems)
147 {
148 if (static_cast<std::underlying_type_t<SizedItem>>(i.first) != idx)
149 return false;
150
151 ++idx;
152 }
153
154 return true;
155 }(),
156 "Mismatch between sized item enum & array indices");
157
158//
159// TODO: Check permissions on config file before using it.
160//
161
162#define SECTION_DEFAULT_NAME ""
163
165parseIniFile(std::string const& strInput, bool const bTrim)
166{
167 std::string strData(strInput);
169 IniFileSections secResult;
170
171 // Convert DOS format to unix.
172 boost::algorithm::replace_all(strData, "\r\n", "\n");
173
174 // Convert MacOS format to unix.
175 boost::algorithm::replace_all(strData, "\r", "\n");
176
177 boost::algorithm::split(vLines, strData, boost::algorithm::is_any_of("\n"));
178
179 // Set the default Section name.
180 std::string strSection = SECTION_DEFAULT_NAME; // NOLINT(readability-redundant-string-init)
181
182 // Initialize the default Section.
183 secResult[strSection] = IniFileSections::mapped_type();
184
185 // Parse each line.
186 for (auto& strValue : vLines)
187 {
188 if (bTrim)
189 strValue = trimWhitespace(strValue);
190
191 if (strValue.empty() || strValue[0] == '#')
192 {
193 // Blank line or comment, do nothing.
194 }
195 else if (strValue[0] == '[' && strValue[strValue.length() - 1] == ']')
196 {
197 // New Section.
198 strSection = strValue.substr(1, strValue.length() - 2);
199 secResult.emplace(strSection, IniFileSections::mapped_type{});
200 }
201 else
202 {
203 // Another line for Section.
204 if (!strValue.empty())
205 secResult[strSection].push_back(strValue);
206 }
207 }
208
209 return secResult;
210}
211
212IniFileSections::mapped_type*
213getIniFileSection(IniFileSections& secSource, std::string const& strSection)
214{
215 if (auto const it = secSource.find(strSection); it != secSource.end())
216 return &it->second;
217
218 return nullptr;
219}
220
221bool
223 IniFileSections& secSource,
224 std::string const& strSection,
225 std::string& strValue,
227{
228 auto const pmtEntries = getIniFileSection(secSource, strSection);
229
230 if ((pmtEntries != nullptr) && pmtEntries->size() == 1)
231 {
232 strValue = (*pmtEntries)[0];
233 return true;
234 }
235
236 // A repeated section hides the value the operator intended. An empty
237 // section (for example, a header above a commented-out value) keeps the
238 // default.
239 if ((pmtEntries != nullptr) && pmtEntries->size() > 1)
240 {
242 std::format("[{}] requires exactly one value, not {}", strSection, pmtEntries->size()));
243 }
244
245 if (pmtEntries != nullptr)
246 {
247 JLOG(j.warn()) << "Section '" << strSection << "': requires 1 line not "
248 << pmtEntries->size() << " lines.";
249 }
250
251 return false;
252}
253
254//------------------------------------------------------------------------------
255//
256// Config
257//
258//------------------------------------------------------------------------------
259
260[[nodiscard]] static std::string
261getEnvVar(char const* name)
262{
263 std::string value;
264
265 if (auto const v = std::getenv(name); v != nullptr)
266 value = v;
267
268 return value;
269}
270
271namespace {
272
276struct Candidate
277{
278 std::filesystem::path configDir;
279 std::filesystem::path dataDir;
280};
281
290[[nodiscard]] std::vector<Candidate>
291configCandidates()
292{
293 std::vector<Candidate> candidates;
294
295 // The current working directory, with the databases in a subdirectory.
296 auto const cwd = std::filesystem::current_path();
297 candidates.emplace_back(cwd, cwd / Config::kDatabaseDirName);
298
299 // The XDG config and data directories, which only apply when the home
300 // directory is set. See
301 // http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html.
302 if (std::filesystem::path const home = getEnvVar("HOME"); !home.empty())
303 {
304 std::filesystem::path xdgConfigHome = getEnvVar("XDG_CONFIG_HOME");
305 if (xdgConfigHome.empty())
306 {
307 // $XDG_CONFIG_HOME was not set, use default based on $HOME.
308 xdgConfigHome = home / ".config";
309 }
310 std::filesystem::path xdgDataHome = getEnvVar("XDG_DATA_HOME");
311 if (xdgDataHome.empty())
312 {
313 // $XDG_DATA_HOME was not set, use default based on $HOME.
314 xdgDataHome = home / ".local" / "share";
315 }
316 candidates.emplace_back(xdgConfigHome / systemName(), xdgDataHome / systemName());
317 }
318
319 // The system config directory, as a last resort.
320 candidates.emplace_back(
321 std::filesystem::path("/etc") / systemName(),
322 std::filesystem::path("/var/lib") / systemName());
323
324 return candidates;
325}
326
327} // namespace
328
330 : j_(beast::Journal::getNullSink()), ramSize_(detail::getMemorySize() / (1024 * 1024 * 1024))
331{
332}
333
334void
335Config::setupControl(bool bQuiet, bool bSilent, bool bStandalone)
336{
337 XRPL_ASSERT(nodeSize == 0, "xrpl::Config::setupControl : node size not set");
338
339 quiet_ = bQuiet || bSilent;
340 silent_ = bSilent;
341 runStandalone_ = bStandalone;
342
343 // We try to autodetect the appropriate node size by checking available
344 // RAM and CPU resources. We default to "tiny" for standalone mode.
345 if (!bStandalone)
346 {
347 // First, check against 'minimum' RAM requirements per node size:
348 auto const& threshold =
350
351 auto ns = std::ranges::find_if(threshold.second, [this](std::size_t limit) {
352 return (limit == 0) || (ramSize_ < limit);
353 });
354
355 XRPL_ASSERT(ns != threshold.second.end(), "xrpl::Config::setupControl : valid node size");
356
357 if (ns != threshold.second.end())
358 nodeSize = std::distance(threshold.second.begin(), ns);
359
360 // Adjust the size based on the number of hardware threads of
361 // execution available to us:
362 if (auto const hc = std::thread::hardware_concurrency(); hc != 0)
364 }
365
366 XRPL_ASSERT(nodeSize <= 4, "xrpl::Config::setupControl : node size is set");
367}
368
369void
370Config::setup(std::string const& strConf, bool bQuiet, bool bSilent, bool bStandalone)
371{
372 setupControl(bQuiet, bSilent, bStandalone);
373
374 // Determine the config and data directories.
375 // If the config file is found in the current working
376 // directory, use the current working directory as the
377 // config directory and that with "db" as the data
378 // directory.
379 std::filesystem::path dataDir;
380
381 if (!strConf.empty())
382 {
383 // --conf=<path> : everything is relative that file.
384 configFile_ = strConf;
386 configDir.remove_filename();
387 dataDir = configDir / kDatabaseDirName;
388 }
389 else
390 {
391 auto const candidates = configCandidates();
392
393 // Take the first candidate holding a config file under either name.
394 // When none does, the last candidate's values stand.
395 for (auto const& candidate : candidates)
396 {
397 configDir = candidate.configDir;
398 dataDir = candidate.dataDir;
399
400 bool found = false;
401 for (std::string_view const fileName : {kConfigFileName, kConfigLegacyName})
402 {
403 configFile_ = configDir / fileName;
405 {
406 found = true;
407 break;
408 }
409 }
410
411 if (found)
412 break;
413 }
414 }
415
416 // Update default values
417 load();
418 {
419 // load() may have set a new value for the dataDir
421 if (!dbPath.empty())
422 {
423 dataDir = std::filesystem::path(dbPath);
424 }
425 else if (runStandalone_)
426 {
427 dataDir.clear();
428 }
429 }
430
431 if (!dataDir.empty())
432 {
435
436 if (ec)
437 Throw<std::runtime_error>(std::format("Can not create {}", dataDir.string()));
438
440 }
441
443
444 if (runStandalone_)
445 ledgerHistory = 0;
446
447 Section const ledgerTxTablesSection = section(Sections::kLedgerTxTables);
448 getIfExists(ledgerTxTablesSection, Keys::kUseTxTables, useTxTables_);
449
450 Section const& nodeDbSection{section(Sections::kNodeDatabase)};
451 getIfExists(nodeDbSection, Keys::kFastLoad, fastLoad);
452}
453
454// 0 ports are allowed for unit tests, but still not allowed to be present in
455// config file
456static void
457checkZeroPorts(Config const& config)
458{
459 if (!config.exists(Sections::kServer))
460 return;
461
462 for (auto const& name : config.section(Sections::kServer).values())
463 {
464 if (!config.exists(name))
465 return;
466
467 auto const& section = config[name];
468 auto const optResult = section.get(Keys::kPort);
469 if (optResult)
470 {
471 auto const port = beast::lexicalCast<std::uint16_t>(*optResult);
472 if (port == 0u)
473 {
475 ss << "Invalid value '" << *optResult << "' for key 'port' in [" << name << "]";
477 }
478 }
479 }
480}
481
482void
484{
485 // NOTE: this writes to cerr because we want cout to be reserved
486 // for the writing of the json response (so that stdout can be part of a
487 // pipeline, for instance)
488 if (!quiet_)
489 std::cerr << "Loading: " << configFile_ << "\n";
490
492 auto const fileContents = getFileContents(ec, configFile_);
493
494 if (ec)
495 {
496 std::cerr << "Failed to read '" << configFile_ << "'." << ec.value() << ": " << ec.message()
497 << std::endl;
498 return;
499 }
500
501 loadFromString(fileContents);
502 checkZeroPorts(*this);
503}
504
505void
507{
508 IniFileSections secConfig = parseIniFile(fileContents, true);
509
510 build(secConfig);
511
512 if (auto s = getIniFileSection(secConfig, Sections::kIps))
513 ips = *s;
514
515 if (auto s = getIniFileSection(secConfig, Sections::kIpsFixed))
516 ipsFixed = *s;
517
518 // if the user has specified ip:port then replace : with a space.
519 {
520 auto const replaceColons = [](std::vector<std::string>& strVec) {
521 static std::regex const kE(":([0-9]+)$");
522 for (auto& line : strVec)
523 {
524 // skip anything that might be an ipv6 address
525 if (std::count(line.begin(), line.end(), ':') != 1)
526 continue;
527
528 std::string const result = std::regex_replace(line, kE, " $1");
529 // sanity check the result of the replace, should be same length
530 // as input
531 if (result.size() == line.size())
532 line = result;
533 }
534 };
535
536 replaceColons(ipsFixed);
537 replaceColons(ips);
538 }
539
540 {
541 std::string dbPath;
542 if (getSingleSection(secConfig, Sections::kDatabasePath, dbPath, j_))
543 {
544 std::filesystem::path const p(dbPath);
546 }
547 }
548
549 std::string strTemp;
550
551 if (getSingleSection(secConfig, Sections::kNetworkId, strTemp, j_))
552 {
553 if (strTemp == "main")
554 {
555 networkId = 0;
556 }
557 else if (strTemp == "testnet")
558 {
559 networkId = 1;
560 }
561 else if (strTemp == "devnet")
562 {
563 networkId = 2;
564 }
565 else
566 {
568 }
569 }
570
571 if (getSingleSection(secConfig, Sections::kPeerPrivate, strTemp, j_))
573
574 if (getSingleSection(secConfig, Sections::kPeersMax, strTemp, j_))
575 {
577 }
578 else
579 {
580 std::optional<std::size_t> peersInMaxOpt{};
581 if (getSingleSection(secConfig, Sections::kPeersInMax, strTemp, j_))
582 {
583 peersInMaxOpt = beast::lexicalCastThrow<std::size_t>(strTemp);
584 if (*peersInMaxOpt > 1000)
585 {
587 "Invalid value specified in [{}] section; the value must be less or equal than "
588 "1000",
590 }
591 }
592
593 std::optional<std::size_t> peersOutMaxOpt{};
594 if (getSingleSection(secConfig, Sections::kPeersOutMax, strTemp, j_))
595 {
596 peersOutMaxOpt = beast::lexicalCastThrow<std::size_t>(strTemp);
597 if (*peersOutMaxOpt < 10 || *peersOutMaxOpt > 1000)
598 {
600 "Invalid value specified in [{}] section; the value must be in range 10-1000",
602 }
603 }
604
605 // if one section is configured then the other must be configured too
606 if ((peersInMaxOpt && !peersOutMaxOpt) || (peersOutMaxOpt && !peersInMaxOpt))
607 {
609 "Both sections [{}] and [{}] must be configured",
612 }
613
614 if (peersInMaxOpt && peersOutMaxOpt)
615 {
616 peersInMax = *peersInMaxOpt;
617 peersOutMax = *peersOutMaxOpt;
618 }
619 }
620
621 if (getSingleSection(secConfig, Sections::kNodeSize, strTemp, j_))
622 {
623 if (boost::iequals(strTemp, "tiny"))
624 {
625 nodeSize = 0;
626 }
627 else if (boost::iequals(strTemp, "small"))
628 {
629 nodeSize = 1;
630 }
631 else if (boost::iequals(strTemp, "medium"))
632 {
633 nodeSize = 2;
634 }
635 else if (boost::iequals(strTemp, "large"))
636 {
637 nodeSize = 3;
638 }
639 else if (boost::iequals(strTemp, "huge"))
640 {
641 nodeSize = 4;
642 }
643 else
644 {
646 }
647 }
648
649 if (getSingleSection(secConfig, Sections::kSigningSupport, strTemp, j_))
651
652 if (getSingleSection(secConfig, Sections::kElbSupport, strTemp, j_))
654
657
658 if (getSingleSection(secConfig, Sections::kSslVerify, strTemp, j_))
660
661 if (getSingleSection(secConfig, Sections::kRelayValidations, strTemp, j_))
662 {
663 if (boost::iequals(strTemp, "all"))
664 {
666 }
667 else if (boost::iequals(strTemp, "trusted"))
668 {
670 }
671 else if (boost::iequals(strTemp, "drop_untrusted"))
672 {
674 }
675 else
676 {
678 "Invalid value specified in [{}] section", Sections::kRelayValidations));
679 }
680 }
681
682 if (getSingleSection(secConfig, Sections::kRelayProposals, strTemp, j_))
683 {
684 if (boost::iequals(strTemp, "all"))
685 {
687 }
688 else if (boost::iequals(strTemp, "trusted"))
689 {
691 }
692 else if (boost::iequals(strTemp, "drop_untrusted"))
693 {
695 }
696 else
697 {
699 std::format("Invalid value specified in [{}] section", Sections::kRelayProposals));
700 }
701 }
702
704 {
706 "Cannot have both [{}] and [{}] config sections",
709 }
710
711 if (getSingleSection(secConfig, Sections::kNetworkQuorum, strTemp, j_))
713
716
718 /* [fee_default] is documented in the example config files as useful for
719 * things like offline transaction signing. Until that's completely
720 * deprecated, allow it to override the [voting] section. */
721 if (getSingleSection(secConfig, Sections::kFeeDefault, strTemp, j_))
722 fees.referenceFee = beast::lexicalCastThrow<std::uint64_t>(strTemp);
723
724 if (getSingleSection(secConfig, Sections::kLedgerHistory, strTemp, j_))
725 {
726 if (boost::iequals(strTemp, "full"))
727 {
729 }
730 else if (boost::iequals(strTemp, "none"))
731 {
732 ledgerHistory = 0;
733 }
734 else
735 {
737 }
738 }
739
740 if (getSingleSection(secConfig, Sections::kFetchDepth, strTemp, j_))
741 {
742 if (boost::iequals(strTemp, "none"))
743 {
744 fetchDepth = 0;
745 }
746 else if (boost::iequals(strTemp, "full"))
747 {
748 fetchDepth = std::numeric_limits<decltype(fetchDepth)>::max();
749 }
750 else
751 {
753 }
754
756 }
757
758 // By default, validators don't have pathfinding enabled, unless it is
759 // explicitly requested by the server's admin.
761 pathSearchMax = 0;
762
763 if (getSingleSection(secConfig, Sections::kPathSearchOld, strTemp, j_))
765 if (getSingleSection(secConfig, Sections::kPathSearch, strTemp, j_))
767 if (getSingleSection(secConfig, Sections::kPathSearchFast, strTemp, j_))
769 if (getSingleSection(secConfig, Sections::kPathSearchMax, strTemp, j_))
771
772 if (getSingleSection(secConfig, Sections::kDebugLogfile, strTemp, j_))
773 debugLogfile_ = strTemp;
774
775 if (getSingleSection(secConfig, Sections::kSweepInterval, strTemp, j_))
776 {
778
780 {
782 "Invalid {}: must be between 10 and 600 inclusive", Sections::kSweepInterval));
783 }
784 }
785
786 if (getSingleSection(secConfig, Sections::kWorkers, strTemp, j_))
787 {
789
791 {
793 "Invalid {}: must be between 1 and 1024 inclusive.", Sections::kWorkers));
794 }
795 }
796
797 if (getSingleSection(secConfig, Sections::kIoWorkers, strTemp, j_))
798 {
800
802 {
804 "Invalid {}: must be between 1 and 1024 inclusive.", Sections::kIoWorkers));
805 }
806 }
807
808 if (getSingleSection(secConfig, Sections::kPrefetchWorkers, strTemp, j_))
809 {
811
813 {
815 "Invalid {}: must be between 1 and 1024 inclusive.", Sections::kPrefetchWorkers));
816 }
817 }
818
819 if (getSingleSection(secConfig, Sections::kCompression, strTemp, j_))
821
822 if (getSingleSection(secConfig, Sections::kLedgerReplay, strTemp, j_))
824
826 {
827 auto const sec = section(Sections::kReduceRelay);
828
832 // vp_enable config option is deprecated by vp_base_squelch_enable //
833 // This option is kept for backwards compatibility. When squelching //
834 // is the default algorithm, it must be replaced with: //
835 // VP_REDUCE_RELAY_BASE_SQUELCH_ENABLE = //
836 // sec.value_or("vp_base_squelch_enable", true); //
837 if (sec.exists(Keys::kVpBaseSquelchEnable) && sec.exists(Keys::kVpEnable))
838 {
840 "Invalid {} cannot specify both vp_base_squelch_enable and vp_enable options. "
841 "vp_enable was deprecated and replaced by vp_base_squelch_enable",
843 }
844
845 if (sec.exists(Keys::kVpBaseSquelchEnable))
846 {
848 }
849 else if (sec.exists(Keys::kVpEnable))
850 {
852 }
853 else
854 {
856 }
860
864 // Temporary squelching config for the peers selected as a source of //
865 // validator messages. The config must be removed once squelching is //
866 // made the default routing algorithm. //
869 {
871 "Invalid {} vp_base_squelch_max_selected_peers must be greater than or equal to 3",
873 }
877
878 txReduceRelayEnable = sec.valueOr(Keys::kTxEnable, false);
879 txReduceRelayMetrics = sec.valueOr(Keys::kTxMetrics, false);
880 txReduceRelayMinPeers = sec.valueOr(Keys::kTxMinPeers, 20);
883 {
885 "Invalid {}, tx_min_peers must be greater than or equal to 10, tx_relay_percentage "
886 "must be greater than or equal to 10 and less than or equal to 100",
888 }
889 }
890
891 if (getSingleSection(secConfig, Sections::kMaxTransactions, strTemp, j_))
892 {
895 }
896
897 if (getSingleSection(secConfig, Sections::kServerDomain, strTemp, j_))
898 {
899 if (!isProperlyFormedTomlDomain(strTemp))
900 {
902 "Invalid {}: the domain name does not appear to meet the requirements.",
904 }
905
906 serverDomain = strTemp;
907 }
908
910 {
911 auto const sec = section(Sections::kOverlay);
912
913 using namespace std::chrono;
914
915 try
916 {
917 if (auto val = sec.get(Keys::kMaxUnknownTime))
919 }
920 catch (...)
921 {
923 "Invalid value 'max_unknown_time' in {}: must be of the form '<number>' "
924 "representing seconds.",
926 }
927
928 if (maxUnknownTime < seconds{300} || maxUnknownTime > seconds{1800})
929 {
931 "Invalid value 'max_unknown_time' in {}: the time must be between 300 and 1800 "
932 "seconds, inclusive.",
934 }
935
936 try
937 {
938 if (auto val = sec.get(Keys::kMaxDivergedTime))
940 }
941 catch (...)
942 {
944 "Invalid value 'max_diverged_time' in {}: must be of the form '<number>' "
945 "representing seconds.",
947 }
948
950 {
952 "Invalid value 'max_diverged_time' in {}: the time must be between 60 and 900 "
953 "seconds, inclusive.",
955 }
956
957 // Both manifest counts parse and validate identically, so read them
958 // the same way. Returns nullopt when the key is absent, leaving the
959 // built-in default in effect at the use site.
960 auto const manifestCount = [&sec](char const* key) -> std::optional<std::size_t> {
962
963 try
964 {
965 if (auto val = sec.get(key))
967 }
968 catch (...)
969 {
971 "Invalid value '{}' in {}: must be of the form '<number>' representing a count "
972 "of manifests.",
973 key,
975 }
976
977 if (count && (*count < kMinManifestCount || *count > kMaxManifestCount))
978 {
980 "Invalid value '{}' in {}: the count must be between {} and {}, inclusive.",
981 key,
985 }
986
987 return count;
988 };
989
992 }
993
994 if (getSingleSection(secConfig, Sections::kAmendmentMajorityTime, strTemp, j_))
995 {
996 using namespace std::chrono;
997 boost::regex const re(R"(^\s*(\d+)\s*(minutes|hours|days|weeks)\s*(\s+.*)?$)");
998 boost::smatch match;
999 if (!boost::regex_match(strTemp, match, re))
1000 {
1002 "Invalid {}, must be: [0-9]+ [minutes|hours|days|weeks]",
1004 }
1005
1006 auto const duration = beast::lexicalCastThrow<std::uint32_t>(match[1].str());
1007
1008 if (boost::iequals(match[2], "minutes"))
1009 {
1011 }
1012 else if (boost::iequals(match[2], "hours"))
1013 {
1015 }
1016 else if (boost::iequals(match[2], "days"))
1017 {
1019 }
1020 else if (boost::iequals(match[2], "weeks"))
1021 {
1023 }
1024
1026 {
1028 "Invalid {}, the minimum amount of time an amendment must hold a majority is 15 "
1029 "minutes",
1031 }
1032 }
1033
1034 if (getSingleSection(secConfig, Sections::kBetaRpcApi, strTemp, j_))
1036
1037 // Do not load trusted validator configuration for standalone mode
1038 if (!runStandalone_)
1039 {
1040 // If a file was explicitly specified, then throw if the
1041 // path is malformed or if the file does not exist or is
1042 // not a file.
1043 // If the specified file is not an absolute path, then look
1044 // for it in the same directory as the config file.
1045 // If no path was specified, then look for validators.txt
1046 // in the same directory as the config file, but don't complain
1047 // if we can't find it.
1048 std::filesystem::path validatorsFile;
1049
1050 if (getSingleSection(secConfig, Sections::kValidatorsFile, strTemp, j_))
1051 {
1052 validatorsFile = strTemp;
1053
1054 if (validatorsFile.empty())
1055 {
1057 std::format("Invalid path specified in [{}]", Sections::kValidatorsFile));
1058 }
1059
1060 if (!validatorsFile.is_absolute() && !configDir.empty())
1061 validatorsFile = configDir / validatorsFile;
1062
1063 if (!std::filesystem::exists(validatorsFile))
1064 {
1066 "The file specified in [{}] does not exist: {}",
1068 validatorsFile.string()));
1069 }
1070 if (!std::filesystem::is_regular_file(validatorsFile) &&
1071 !std::filesystem::is_symlink(validatorsFile))
1072 {
1074 "Invalid file specified in [{}]: {}",
1076 validatorsFile.string()));
1077 }
1078 }
1079 else if (!configDir.empty())
1080 {
1081 validatorsFile = configDir / kValidatorsFileName;
1082
1083 if (!validatorsFile.empty())
1084 {
1085 if (!std::filesystem::exists(validatorsFile) ||
1086 (!std::filesystem::is_regular_file(validatorsFile) &&
1087 !std::filesystem::is_symlink(validatorsFile)))
1088 {
1089 validatorsFile.clear();
1090 }
1091 }
1092 }
1093
1094 if (!validatorsFile.empty() && std::filesystem::exists(validatorsFile) &&
1095 (std::filesystem::is_regular_file(validatorsFile) ||
1096 std::filesystem::is_symlink(validatorsFile)))
1097 {
1098 std::error_code ec;
1099 auto const data = getFileContents(ec, validatorsFile);
1100 if (ec)
1101 {
1103 "Failed to read '{}': {} (error {})",
1104 validatorsFile.string(),
1105 ec.message(),
1106 ec.value()));
1107 }
1108
1109 auto iniFile = parseIniFile(data, true);
1110
1111 auto entries = getIniFileSection(iniFile, Sections::kValidators);
1112
1113 if (entries != nullptr)
1115
1116 auto valKeyEntries = getIniFileSection(iniFile, Sections::kValidatorKeys);
1117
1118 if (valKeyEntries != nullptr)
1119 section(Sections::kValidatorKeys).append(*valKeyEntries);
1120
1121 auto valSiteEntries = getIniFileSection(iniFile, Sections::kValidatorListSites);
1122
1123 if (valSiteEntries != nullptr)
1125
1126 auto valListKeys = getIniFileSection(iniFile, Sections::kValidatorListKeys);
1127
1128 if (valListKeys != nullptr)
1130
1131 auto valListThreshold = getIniFileSection(iniFile, Sections::kValidatorListThreshold);
1132
1133 if (valListThreshold != nullptr)
1135
1136 if ((entries == nullptr) && (valKeyEntries == nullptr) && (valListKeys == nullptr))
1137 {
1139 "The file specified in [{}] does not contain a [{}], [{}] or [{}] section: {}",
1144 validatorsFile.string()));
1145 }
1146 }
1147
1149 auto const& listThreshold = section(Sections::kValidatorListThreshold);
1150 if (listThreshold.lines().empty())
1151 {
1152 return std::nullopt;
1153 }
1154 if (listThreshold.values().size() == 1)
1155 {
1156 auto const strTemp = listThreshold.values()[0];
1157 auto const listThreshold = beast::lexicalCastThrow<std::size_t>(strTemp);
1158 if (listThreshold == 0)
1159 {
1160 return std::nullopt; // NOTE: Explicitly ask for computed
1161 }
1162 if (listThreshold > section(Sections::kValidatorListKeys).values().size())
1163 {
1165 "Value in config section [{}] exceeds the number of configured list keys",
1167 }
1168 return listThreshold;
1169 }
1170
1172 "Config section [{}] should contain single value only",
1174 }();
1175
1176 // Consolidate [validator_keys] and [validators]
1178
1181 {
1183 std::format("[{}] config section is missing", Sections::kValidatorListKeys));
1184 }
1185 }
1186
1187 {
1188 auto const part = section(Sections::kFeatures);
1189 for (auto const& s : part.values())
1190 {
1191 if (auto const f = getRegisteredFeature(s))
1192 {
1193 features.insert(*f);
1194 }
1195 else
1196 {
1197 Throw<std::runtime_error>(std::format("Unknown feature: {} in config file.", s));
1198 }
1199 }
1200 }
1201
1202 // This doesn't properly belong here, but check to make sure that the
1203 // value specified for network_quorum is achievable:
1204 {
1205 auto pm = peersMax;
1206
1207 // FIXME this apparently magic value is actually defined as a constant
1208 // elsewhere (see defaultMaxPeers) but we handle this check here.
1209 if (pm == 0)
1210 pm = 21;
1211
1212 if (networkQuorum > pm)
1213 {
1215 "The minimum number of required peers (network_quorum) exceeds "
1216 "the maximum number of allowed peers (peers_max)");
1217 }
1218 }
1219}
1220
1223{
1224 auto logFile = debugLogfile_;
1225
1226 if (!logFile.empty() && !logFile.is_absolute())
1227 {
1228 // Unless an absolute path for the log file is specified, the
1229 // path is relative to the config file directory.
1230 logFile = std::filesystem::absolute(configDir / logFile);
1231 }
1232
1233 if (!logFile.empty())
1234 {
1235 auto const logDir = logFile.parent_path();
1236
1237 if (!std::filesystem::is_directory(logDir))
1238 {
1239 std::error_code ec;
1241
1242 // If we fail, we warn but continue so that the calling code can
1243 // decide how to handle this situation.
1244 if (ec)
1245 {
1246 std::cerr << "Unable to create log file path " << logDir << ": " << ec.message()
1247 << '\n';
1248 }
1249 }
1250 }
1251
1252 return logFile;
1253}
1254
1255int
1257{
1258 auto const index = static_cast<std::underlying_type_t<SizedItem>>(item);
1259 XRPL_ASSERT(index < kSizedItems.size(), "xrpl::Config::getValueFor : valid index input");
1260 XRPL_ASSERT(!node || *node <= 4, "xrpl::Config::getValueFor : unset or valid node");
1261 return kSizedItems.at(index).second.at(node.value_or(nodeSize));
1262}
1263
1265setupFeeVote(Section const& section)
1266{
1267 FeeSetup setup;
1268 {
1269 std::uint64_t temp = 0;
1270 if (set(temp, Keys::kReferenceFee, section) &&
1272 setup.referenceFee = temp;
1273 }
1274 {
1275 std::uint32_t temp = 0;
1276 if (set(temp, Keys::kAccountReserve, section))
1277 setup.accountReserve = temp;
1278 if (set(temp, Keys::kOwnerReserve, section))
1279 setup.ownerReserve = temp;
1280 }
1281 {
1282 // Signed, so a negative value is refused rather than wrapping.
1283 std::int64_t temp = 0;
1284 if (set(temp, Keys::kGasLimit, section) && temp >= 0 && temp <= kMaxGasLimit)
1285 setup.gasLimit = static_cast<std::uint32_t>(temp);
1286 if (set(temp, Keys::kBytecodeSizeLimit, section) && temp >= 0 &&
1287 temp <= kMaxBytecodeSizeLimit)
1288 setup.bytecodeSizeLimit = static_cast<std::uint32_t>(temp);
1289 if (set(temp, Keys::kGasPrice, section) && temp >= kMinGasPrice &&
1291 setup.gasPrice = static_cast<std::uint32_t>(temp);
1292 }
1293 return setup;
1294}
1295
1296DatabaseCon::Setup
1298{
1299 DatabaseCon::Setup setup;
1300
1301 setup.startUp = c.startUp;
1302 setup.standAlone = c.standalone();
1304 if (!setup.standAlone && setup.dataDir.empty())
1305 {
1306 Throw<std::runtime_error>("database_path must be set.");
1307 }
1308
1309 if (!setup.globalPragma)
1310 {
1311 auto const& sqlite = c.section(Sections::kSqlite);
1313 result->reserve(3);
1314
1315 // defaults
1316 std::string safetyLevel;
1317 std::string journalMode = "wal";
1318 std::string synchronous = "normal";
1319 std::string tempStore = "file";
1320 bool showRiskWarning = false;
1321
1322 if (set(safetyLevel, "safety_level", sqlite))
1323 {
1324 if (boost::iequals(safetyLevel, "low"))
1325 {
1326 // low safety defaults
1327 journalMode = "memory";
1328 synchronous = "off";
1329 tempStore = "memory";
1330 showRiskWarning = true;
1331 }
1332 else if (!boost::iequals(safetyLevel, "high"))
1333 {
1335 std::format("Invalid safety_level value: {}", safetyLevel));
1336 }
1337 }
1338
1339 {
1340 // #journal_mode Valid values : delete, truncate, persist,
1341 // memory, wal, off
1342 if (set(journalMode, "journal_mode", sqlite) && !safetyLevel.empty())
1343 {
1345 "Configuration file may not define both "
1346 "\"safety_level\" and \"journal_mode\"");
1347 }
1348 bool const higherRisk =
1349 boost::iequals(journalMode, "memory") || boost::iequals(journalMode, "off");
1350 showRiskWarning = showRiskWarning || higherRisk;
1351 if (higherRisk || boost::iequals(journalMode, "delete") ||
1352 boost::iequals(journalMode, "truncate") || boost::iequals(journalMode, "persist") ||
1353 boost::iequals(journalMode, "wal"))
1354 {
1355 result->emplace_back(commonDbPragmaJournal(journalMode));
1356 }
1357 else
1358 {
1360 std::format("Invalid journal_mode value: {}", journalMode));
1361 }
1362 }
1363
1364 {
1365 // #synchronous Valid values : off, normal, full, extra
1366 if (set(synchronous, "synchronous", sqlite) && !safetyLevel.empty())
1367 {
1369 "Configuration file may not define both "
1370 "\"safety_level\" and \"synchronous\"");
1371 }
1372 bool const higherRisk = boost::iequals(synchronous, "off");
1373 showRiskWarning = showRiskWarning || higherRisk;
1374 if (higherRisk || boost::iequals(synchronous, "normal") ||
1375 boost::iequals(synchronous, "full") || boost::iequals(synchronous, "extra"))
1376 {
1377 result->emplace_back(commonDbPragmaSync(synchronous));
1378 }
1379 else
1380 {
1382 std::format("Invalid synchronous value: {}", synchronous));
1383 }
1384 }
1385
1386 {
1387 // #temp_store Valid values : default, file, memory
1388 if (set(tempStore, "temp_store", sqlite) && !safetyLevel.empty())
1389 {
1391 "Configuration file may not define both "
1392 "\"safety_level\" and \"temp_store\"");
1393 }
1394 bool const higherRisk = boost::iequals(tempStore, "memory");
1395 showRiskWarning = showRiskWarning || higherRisk;
1396 if (higherRisk || boost::iequals(tempStore, "default") ||
1397 boost::iequals(tempStore, "file"))
1398 {
1399 result->emplace_back(commonDbPragmaTemp(tempStore));
1400 }
1401 else
1402 {
1403 Throw<std::runtime_error>(std::format("Invalid temp_store value: {}", tempStore));
1404 }
1405 }
1406
1407 if (showRiskWarning && j && c.ledgerHistory > kSqliteTuningCutoff)
1408 {
1409 JLOG(j->warn()) << "reducing the data integrity guarantees from the "
1410 "default [sqlite] behavior is not recommended for "
1411 "nodes storing large amounts of history, because of the "
1412 "difficulty inherent in rebuilding corrupted data.";
1413 }
1414 XRPL_ASSERT(
1415 result->size() == 3, "xrpl::setup_DatabaseCon::globalPragma : result size is 3");
1416 setup.globalPragma = std::move(result);
1417 }
1418 setup.useGlobalPragma = true;
1419
1420 auto const setPragma = [](std::string& pragma, std::string const& key, int64_t value) {
1421 pragma = "PRAGMA " + key + "=" + std::to_string(value) + ";";
1422 };
1423
1424 // Lgr Pragma
1425 setPragma(setup.lgrPragma[0], "journal_size_limit", 1582080);
1426
1427 // TX Pragma
1428 int64_t pageSize = 4096;
1429 int64_t journalSizeLimit = 1582080;
1431 {
1432 auto& s = c.section(Sections::kSqlite);
1433 set(journalSizeLimit, Keys::kJournalSizeLimit, s);
1434 set(pageSize, Keys::kPageSize, s);
1435 if (pageSize < 512 || pageSize > 65536)
1436 Throw<std::runtime_error>("Invalid page_size. Must be between 512 and 65536.");
1437
1438 if ((pageSize & (pageSize - 1)) != 0)
1439 Throw<std::runtime_error>("Invalid page_size. Must be a power of 2.");
1440 }
1441
1442 setPragma(setup.txPragma[0], "page_size", pageSize);
1443 setPragma(setup.txPragma[1], "journal_size_limit", journalSizeLimit);
1444 setPragma(setup.txPragma[2], "max_page_count", 4294967294);
1445 setPragma(setup.txPragma[3], "mmap_size", 17179869184);
1446
1447 return setup;
1448}
1449} // namespace xrpl
T absolute(T... args)
T clamp(T... args)
A generic endpoint for log messages.
Definition Journal.h:44
Stream warn() const
Definition Journal.h:356
void build(IniFileSections const &ifs)
bool exists(std::string const &name) const
Returns true if a section with the given name exists.
void legacy(std::string const &section, std::string value)
Set a value that is not a key/value pair.
Section & section(std::string const &name)
Returns the section with the given name.
static constexpr int kMinJobQueueTx
std::filesystem::path configFile_
std::unordered_set< UInt256, beast::Uhash<> > features
static constexpr std::string_view kConfigLegacyName
std::optional< std::size_t > maxUntrustedCount
std::chrono::seconds maxDivergedTime
static constexpr int kMaxJobQueueTx
std::optional< int > sweepInterval
std::uint32_t fetchDepth
beast::Journal const j_
bool standalone() const
std::size_t txReduceRelayMinPeers
static constexpr std::size_t kMinManifestCount
std::optional< std::size_t > maxTrustedCount
static constexpr std::string_view kDatabaseDirName
std::size_t vpReduceRelaySquelchMaxSelectedPeers
////////////////// !
static constexpr std::string_view kConfigFileName
std::filesystem::path getDebugLogFile() const
Returns the full path and filename of the debug log file.
static constexpr std::size_t kMaxManifestCount
void setup(std::string const &strConf, bool bQuiet, bool bSilent, bool bStandalone)
Set up the configuration and determine the config and data directories.
std::chrono::seconds maxUnknownTime
std::uint64_t const ramSize_
std::vector< std::string > ipsFixed
void loadFromString(std::string const &fileContents)
Load the config from the contents of the string.
std::string sslVerifyFile
std::optional< std::size_t > maxSubscriptionsPerConnection
std::size_t txRelayPercentage
std::optional< std::size_t > validatorListThreshold
std::filesystem::path debugLogfile_
bool runStandalone_
Operate in stand-alone mode.
static constexpr std::string_view kValidatorsFileName
bool txReduceRelayEnable
////////////// END OF TEMPORARY CODE BLOCK /////////////////////
std::vector< std::string > ips
bool signingEnabled_
Determines if the server will sign a tx, given an account's secret seed.
void setupControl(bool bQuiet, bool bSilent, bool bStandalone)
std::uint32_t ledgerHistory
int getValueFor(SizedItem item, std::optional< std::size_t > node=std::nullopt) const
Retrieve the default value for the item at the specified node size.
std::size_t networkQuorum
std::filesystem::path configDir
std::chrono::seconds amendmentMajorityTime
static void initializeSSLContext(std::string const &sslVerifyDir, std::string const &sslVerifyFile, bool sslVerify, beast::Journal j)
Holds a collection of configuration values.
Definition BasicConfig.h:28
std::vector< std::string > const & values() const
Returns all the values in the section.
Definition BasicConfig.h:68
void append(std::vector< std::string > const &lines)
Append a set of lines to this section.
T count(T... args)
T create_directories(T... args)
T current_path(T... args)
T data(T... args)
T distance(T... args)
T emplace_back(T... args)
T emplace(T... args)
T empty(T... args)
T end(T... args)
T endl(T... args)
T exists(T... args)
T find(T... args)
T format(T... args)
T getenv(T... args)
T hardware_concurrency(T... args)
T is_absolute(T... args)
T is_directory(T... args)
T is_regular_file(T... args)
T make_unique(T... args)
T max(T... args)
T message(T... args)
T min(T... args)
constexpr Out lexicalCastThrow(In in)
Convert from one type to another, throw on error.
constexpr Out lexicalCast(In in, Out defaultValue=Out())
Convert from one type to another.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
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,...
constexpr std::uint32_t kSqliteTuningCutoff
Definition DBInit.h:43
constexpr std::uint32_t kMinGasPrice
std::chrono::duration< int, std::ratio_multiply< std::chrono::hours::period, std::ratio< 24 > > > Days
Definition chrono.h:19
bool isProperlyFormedTomlDomain(std::string_view domain)
Determines if the given string looks like a TOML-file hosting domain.
static std::string getEnvVar(char const *name)
std::optional< UInt256 > getRegisteredFeature(std::string const &name)
FeeSetup setupFeeVote(Section const &section)
bool getSingleSection(IniFileSections &secSource, std::string const &strSection, std::string &strValue, beast::Journal j)
IniFileSections::mapped_type * getIniFileSection(IniFileSections &secSource, std::string const &strSection)
constexpr std::array< std::pair< SizedItem, std::array< int, 5 > >, 13 > kSizedItems
IniFileSections parseIniFile(std::string const &strInput, bool const bTrim)
bool getIfExists(Section const &section, std::string const &name, T &v)
std::string commonDbPragmaJournal(std::string_view journalMode)
Definition DBInit.h:21
std::string trimWhitespace(std::string str)
Remove leading and trailing ASCII whitespace.
std::string commonDbPragmaTemp(std::string_view tempStore)
Definition DBInit.h:33
static std::string const & systemName()
std::string getFileContents(std::error_code &ec, std::filesystem::path const &sourcePath, std::optional< std::size_t > maxSize=std::nullopt)
static void checkZeroPorts(Config const &config)
DatabaseCon::Setup setupDatabaseCon(Config const &c, std::optional< beast::Journal > j=std::nullopt)
constexpr std::uint32_t kMaxGasLimit
Hard protocol bounds on the Feature Extension fee settings.
std::chrono::duration< int, std::ratio_multiply< Days::period, std::ratio< 7 > > > Weeks
Definition chrono.h:22
constexpr std::uint32_t kMaxBytecodeSizeLimit
std::unordered_map< std::string, std::vector< std::string > > IniFileSections
Definition BasicConfig.h:19
std::string commonDbPragmaSync(std::string_view synchronous)
Definition DBInit.h:27
XRPL_NO_SANITIZE_ADDRESS void Throw(Args &&... args)
Definition contract.h:52
T regex_replace(T... args)
T size(T... args)
T str(T... args)
std::array< std::string, 4 > txPragma
Definition DatabaseCon.h:98
static std::unique_ptr< std::vector< std::string > const > globalPragma
Definition DatabaseCon.h:97
std::filesystem::path dataDir
Definition DatabaseCon.h:82
std::array< std::string, 1 > lgrPragma
Definition DatabaseCon.h:99
Fee schedule for startup / standalone, and to vote for.
XRPAmount accountReserve
The account reserve requirement in drops.
XRPAmount ownerReserve
The per-owned item reserve requirement in drops.
XRPAmount referenceFee
The cost of a reference transaction in drops.
std::uint32_t gasPrice
The price of 1 WASM gas, in micro-drops.
std::uint32_t bytecodeSizeLimit
The bytecode size limit for Feature Extensions.
std::uint32_t gasLimit
The gas limit for Feature Extensions.
static constexpr auto kPageSize
Definition Constants.h:145
static constexpr auto kTxRelayPercentage
Definition Constants.h:176
static constexpr auto kGasLimit
Definition Constants.h:112
static constexpr auto kFastLoad
Definition Constants.h:107
static constexpr auto kTxMetrics
Definition Constants.h:174
static constexpr auto kAccountReserve
Definition Constants.h:84
static constexpr auto kBytecodeSizeLimit
Definition Constants.h:97
static constexpr auto kUseTxTables
Definition Constants.h:180
static constexpr auto kReferenceFee
Definition Constants.h:153
static constexpr auto kVpBaseSquelchEnable
Definition Constants.h:182
static constexpr auto kPort
Definition Constants.h:149
static constexpr auto kGasPrice
Definition Constants.h:113
static constexpr auto kMaxUnknownTime
Definition Constants.h:126
static constexpr auto kJournalSizeLimit
Definition Constants.h:119
static constexpr auto kTxMinPeers
Definition Constants.h:175
static constexpr auto kVpEnable
Definition Constants.h:184
static constexpr auto kMaxTrustedCount
Definition Constants.h:125
static constexpr auto kMaxUntrustedCount
Definition Constants.h:127
static constexpr auto kVpBaseSquelchMaxSelectedPeers
Definition Constants.h:183
static constexpr auto kMaxDivergedTime
Definition Constants.h:123
static constexpr auto kTxEnable
Definition Constants.h:173
static constexpr auto kOwnerReserve
Definition Constants.h:144
static constexpr auto kAmendmentMajorityTime
Definition Constants.h:8
static constexpr auto kMaxSubscriptionsPerConnection
Definition Constants.h:28
static constexpr auto kPeersInMax
Definition Constants.h:41
static constexpr auto kMaxTransactions
Definition Constants.h:29
static constexpr auto kRelayProposals
Definition Constants.h:53
static constexpr auto kSweepInterval
Definition Constants.h:65
static constexpr auto kNodeSize
Definition Constants.h:34
static constexpr auto kServerDomain
Definition Constants.h:57
static constexpr auto kIps
Definition Constants.h:23
static constexpr auto kOverlay
Definition Constants.h:35
static constexpr auto kReduceRelay
Definition Constants.h:51
static constexpr auto kValidatorListThreshold
Definition Constants.h:72
static constexpr auto kValidators
Definition Constants.h:74
static constexpr auto kSslVerifyFile
Definition Constants.h:64
static constexpr auto kValidatorListKeys
Definition Constants.h:70
static constexpr auto kSslVerifyDir
Definition Constants.h:63
static constexpr auto kNetworkQuorum
Definition Constants.h:31
static constexpr auto kValidationSeed
Definition Constants.h:67
static constexpr auto kSigningSupport
Definition Constants.h:58
static constexpr auto kCompression
Definition Constants.h:11
static constexpr auto kPeersMax
Definition Constants.h:42
static constexpr auto kPathSearchOld
Definition Constants.h:39
static constexpr auto kServer
Definition Constants.h:56
static constexpr auto kLedgerHistory
Definition Constants.h:25
static constexpr auto kElbSupport
Definition Constants.h:15
static constexpr auto kValidatorKeys
Definition Constants.h:68
static constexpr auto kPeerPrivate
Definition Constants.h:40
static constexpr auto kSslVerify
Definition Constants.h:62
static constexpr auto kPeersOutMax
Definition Constants.h:43
static constexpr auto kFeeDefault
Definition Constants.h:17
static constexpr auto kValidatorsFile
Definition Constants.h:75
static constexpr auto kPathSearchMax
Definition Constants.h:38
static constexpr auto kRelayValidations
Definition Constants.h:54
static constexpr auto kNodeDatabase
Definition Constants.h:32
static constexpr auto kIpsFixed
Definition Constants.h:24
static constexpr auto kDatabasePath
Definition Constants.h:13
static constexpr auto kPathSearch
Definition Constants.h:36
static constexpr auto kLedgerReplay
Definition Constants.h:26
static constexpr auto kPrefetchWorkers
Definition Constants.h:50
static constexpr auto kDebugLogfile
Definition Constants.h:14
static constexpr auto kSqlite
Definition Constants.h:61
static constexpr auto kValidatorToken
Definition Constants.h:73
static constexpr auto kPathSearchFast
Definition Constants.h:37
static constexpr auto kVoting
Definition Constants.h:78
static constexpr auto kLedgerTxTables
Definition Constants.h:27
static constexpr auto kBetaRpcApi
Definition Constants.h:9
static constexpr auto kIoWorkers
Definition Constants.h:22
static constexpr auto kFetchDepth
Definition Constants.h:18
static constexpr auto kValidatorListSites
Definition Constants.h:71
static constexpr auto kWorkers
Definition Constants.h:79
static constexpr auto kNetworkId
Definition Constants.h:30
static constexpr auto kFeatures
Definition Constants.h:16
T substr(T... args)
T to_string(T... args)
T value(T... args)
T value_or(T... args)