mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Merge remote-tracking branch 'ripple/develop' into dev
This commit is contained in:
@@ -37,6 +37,7 @@
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
#include <regex>
|
||||
#include <thread>
|
||||
|
||||
#if BOOST_OS_WINDOWS
|
||||
@@ -468,6 +469,28 @@ Config::loadFromString(std::string const& fileContents)
|
||||
if (auto s = getIniFileSection(secConfig, SECTION_SNTP))
|
||||
SNTP_SERVERS = *s;
|
||||
|
||||
// if the user has specified ip:port then replace : with a space.
|
||||
{
|
||||
auto replaceColons = [](std::vector<std::string>& strVec) {
|
||||
const static std::regex e(":([0-9]+)$");
|
||||
for (auto& line : strVec)
|
||||
{
|
||||
// skip anything that might be an ipv6 address
|
||||
if (std::count(line.begin(), line.end(), ':') != 1)
|
||||
continue;
|
||||
|
||||
std::string result = std::regex_replace(line, e, " $1");
|
||||
// sanity check the result of the replace, should be same length
|
||||
// as input
|
||||
if (result.size() == line.size())
|
||||
line = result;
|
||||
}
|
||||
};
|
||||
|
||||
replaceColons(IPS_FIXED);
|
||||
replaceColons(IPS);
|
||||
}
|
||||
|
||||
{
|
||||
std::string dbPath;
|
||||
if (getSingleSection(secConfig, "database_path", dbPath, j_))
|
||||
@@ -603,14 +626,12 @@ Config::loadFromString(std::string const& fileContents)
|
||||
if (getSingleSection(secConfig, SECTION_NETWORK_QUORUM, strTemp, j_))
|
||||
NETWORK_QUORUM = beast::lexicalCastThrow<std::size_t>(strTemp);
|
||||
|
||||
if (getSingleSection(secConfig, SECTION_FEE_ACCOUNT_RESERVE, strTemp, j_))
|
||||
FEE_ACCOUNT_RESERVE = beast::lexicalCastThrow<std::uint64_t>(strTemp);
|
||||
|
||||
if (getSingleSection(secConfig, SECTION_FEE_OWNER_RESERVE, strTemp, j_))
|
||||
FEE_OWNER_RESERVE = beast::lexicalCastThrow<std::uint64_t>(strTemp);
|
||||
|
||||
FEES = setup_FeeVote(section("voting"));
|
||||
/* [fee_default] is documented in the example config files as useful for
|
||||
* things like offline transaction signing. Until that's completely
|
||||
* deprecated, allow it to override the [voting] section. */
|
||||
if (getSingleSection(secConfig, SECTION_FEE_DEFAULT, strTemp, j_))
|
||||
FEE_DEFAULT = beast::lexicalCastThrow<std::uint64_t>(strTemp);
|
||||
FEES.reference_fee = beast::lexicalCastThrow<std::uint64_t>(strTemp);
|
||||
|
||||
if (getSingleSection(secConfig, SECTION_LEDGER_HISTORY, strTemp, j_))
|
||||
{
|
||||
@@ -1009,4 +1030,24 @@ Config::getValueFor(SizedItem item, std::optional<std::size_t> node) const
|
||||
return sizedItems.at(index).second.at(node.value_or(NODE_SIZE));
|
||||
}
|
||||
|
||||
FeeSetup
|
||||
setup_FeeVote(Section const& section)
|
||||
{
|
||||
FeeSetup setup;
|
||||
{
|
||||
std::uint64_t temp;
|
||||
if (set(temp, "reference_fee", section) &&
|
||||
temp <= std::numeric_limits<XRPAmount::value_type>::max())
|
||||
setup.reference_fee = temp;
|
||||
}
|
||||
{
|
||||
std::uint32_t temp;
|
||||
if (set(temp, "account_reserve", section))
|
||||
setup.account_reserve = temp;
|
||||
if (set(temp, "owner_reserve", section))
|
||||
setup.owner_reserve = temp;
|
||||
}
|
||||
return setup;
|
||||
}
|
||||
|
||||
} // namespace ripple
|
||||
|
||||
Reference in New Issue
Block a user