|
83 | 83 | #include <util/syserror.h>
|
84 | 84 | #include <util/thread.h>
|
85 | 85 | #include <util/threadnames.h>
|
| 86 | +#include <util/time.h> |
86 | 87 | #include <util/translation.h>
|
87 | 88 | #include <validation.h>
|
88 | 89 | #include <validationinterface.h>
|
@@ -586,6 +587,7 @@ void SetupServerArgs(ArgsManager& argsman)
|
586 | 587 | argsman.AddArg("-acceptnonstdtxn", strprintf("Relay and mine \"non-standard\" transactions (%sdefault: %u)", "testnet/regtest only; ", !testnetChainParams->RequireStandard()), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::NODE_RELAY);
|
587 | 588 | argsman.AddArg("-incrementalrelayfee=<amt>", strprintf("Fee rate (in %s/kvB) used to define cost of relay, used for mempool limiting and replacement policy. (default: %s)", CURRENCY_UNIT, FormatMoney(DEFAULT_INCREMENTAL_RELAY_FEE)), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::NODE_RELAY);
|
588 | 589 | argsman.AddArg("-dustrelayfee=<amt>", strprintf("Fee rate (in %s/kvB) used to define dust, the value of an output such that it will cost more than its value in fees at this fee rate to spend it. (default: %s)", CURRENCY_UNIT, FormatMoney(DUST_RELAY_TX_FEE)), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::NODE_RELAY);
|
| 590 | + argsman.AddArg("-acceptstalefeeestimates", strprintf("Read fee estimates even if they are stale (%sdefault: %u) fee estimates are considered stale if they are %s hours old", "regtest only; ", DEFAULT_ACCEPT_STALE_FEE_ESTIMATES, Ticks<std::chrono::hours>(MAX_FILE_AGE)), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST); |
589 | 591 | argsman.AddArg("-bytespersigop", strprintf("Equivalent bytes per sigop in transactions for relay and mining (default: %u)", DEFAULT_BYTES_PER_SIGOP), ArgsManager::ALLOW_ANY, OptionsCategory::NODE_RELAY);
|
590 | 592 | argsman.AddArg("-datacarrier", strprintf("Relay and mine data carrier transactions (default: %u)", DEFAULT_ACCEPT_DATACARRIER), ArgsManager::ALLOW_ANY, OptionsCategory::NODE_RELAY);
|
591 | 593 | argsman.AddArg("-datacarriersize", strprintf("Maximum size of data in data carrier transactions we relay and mine (default: %u)", MAX_OP_RETURN_RELAY), ArgsManager::ALLOW_ANY, OptionsCategory::NODE_RELAY);
|
@@ -1254,7 +1256,11 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
1254 | 1256 | // Don't initialize fee estimation with old data if we don't relay transactions,
|
1255 | 1257 | // as they would never get updated.
|
1256 | 1258 | if (!ignores_incoming_txs) {
|
1257 |
| - node.fee_estimator = std::make_unique<CBlockPolicyEstimator>(FeeestPath(args)); |
| 1259 | + bool read_stale_estimates = args.GetBoolArg("-acceptstalefeeestimates", DEFAULT_ACCEPT_STALE_FEE_ESTIMATES); |
| 1260 | + if (read_stale_estimates && (chainparams.GetChainType() != ChainType::REGTEST)) { |
| 1261 | + return InitError(strprintf(_("acceptstalefeeestimates is not supported on %s chain."), chainparams.GetChainTypeString())); |
| 1262 | + } |
| 1263 | + node.fee_estimator = std::make_unique<CBlockPolicyEstimator>(FeeestPath(args), read_stale_estimates); |
1258 | 1264 |
|
1259 | 1265 | // Flush estimates to disk periodically
|
1260 | 1266 | CBlockPolicyEstimator* fee_estimator = node.fee_estimator.get();
|
|
0 commit comments