mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-05-12 19:20:42 +02:00
Policy: warn if -minrelaytxfee
is too high
Some checks failed
Some checks failed
This commit is contained in:
parent
5f8256608f
commit
915068945f
@ -110,7 +110,10 @@ util::Result<void> ApplyArgsManOptions(const ArgsManager& argsman, const CChainP
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (argsman.IsArgSet("-minrelaytxfee")) {
|
if (argsman.IsArgSet("-minrelaytxfee")) {
|
||||||
if (std::optional<CAmount> min_relay_feerate = ParseMoney(argsman.GetArg("-minrelaytxfee", ""))) {
|
std::optional<CAmount> min_relay_feerate = ParseMoney(argsman.GetArg("-minrelaytxfee", ""));
|
||||||
|
if (min_relay_feerate >= 100000000 && (std::string(1, std::string(argsman.GetArg("-minrelaytxfee", "")).at(0)) != "f")) {
|
||||||
|
return util::Error{_("-minrelaytxfee is very high! Prefix with f to force this fee rate")};
|
||||||
|
} else if (min_relay_feerate) {
|
||||||
// High fee check is done afterward in CWallet::Create()
|
// High fee check is done afterward in CWallet::Create()
|
||||||
mempool_opts.min_relay_feerate = CFeeRate{min_relay_feerate.value()};
|
mempool_opts.min_relay_feerate = CFeeRate{min_relay_feerate.value()};
|
||||||
} else {
|
} else {
|
||||||
|
@ -55,7 +55,8 @@ std::optional<CAmount> ParseMoney(const std::string& money_string)
|
|||||||
std::string strWhole;
|
std::string strWhole;
|
||||||
int64_t nUnits = 0;
|
int64_t nUnits = 0;
|
||||||
const char* p = str.c_str();
|
const char* p = str.c_str();
|
||||||
for (; *p; p++)
|
int position =0;
|
||||||
|
for (; *p; p++, position++)
|
||||||
{
|
{
|
||||||
if (*p == '.')
|
if (*p == '.')
|
||||||
{
|
{
|
||||||
@ -70,10 +71,12 @@ std::optional<CAmount> ParseMoney(const std::string& money_string)
|
|||||||
}
|
}
|
||||||
if (IsSpace(*p))
|
if (IsSpace(*p))
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
|
if (!(position == 0 && *p == 'f')) {
|
||||||
if (!IsDigit(*p))
|
if (!IsDigit(*p))
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
strWhole.insert(strWhole.end(), *p);
|
strWhole.insert(strWhole.end(), *p);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (*p) {
|
if (*p) {
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user