Skip to content

Commit a84dade

Browse files
committed
Merge bitcoin/bitcoin#28157: test doc: tests acceptstalefeeestimates option is only supported on regtest chain
ee5a036 test: ensure acceptstalefeeestimates is supported only on regtest chain (ismaelsadeeq) 22d5d4b tx fees, policy: doc: update and delete unnecessary comment (ismaelsadeeq) Pull request description: This PR Follow up comments from [#27622](bitcoin/bitcoin#27622) It test that the new `regtest-only` option `acceptstalefeeestimates` is not supported on [main, signet and test chains](https://github.com/bitcoin/bitcoin/pull/27622/files#r1235218268), removes an unnecessary [comment](https://github.com/bitcoin/bitcoin/pull/27622/files#r1235204323), and update fee estimator `MAXFILEAGE` [description comment](https://github.com/bitcoin/bitcoin/pull/27622/files#r1233887314). ACKs for top commit: jonatack: ACK ee5a036 glozow: utACK ee5a036 Tree-SHA512: 4755f25b08db62f37614ea768272b12580ee0d481fb7fa339379901a6132c66828777c6747d3fe67490ceace3a6ff248bf13bdf65720f6e5ba8642eb762acd3c
2 parents ded6873 + ee5a036 commit a84dade

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

src/policy/fees.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -548,14 +548,12 @@ CBlockPolicyEstimator::CBlockPolicyEstimator(const fs::path& estimation_filepath
548548

549549
AutoFile est_file{fsbridge::fopen(m_estimation_filepath, "rb")};
550550

551-
// Whenever the fee estimation file is not present return early
552551
if (est_file.IsNull()) {
553552
LogPrintf("%s is not found. Continue anyway.\n", fs::PathToString(m_estimation_filepath));
554553
return;
555554
}
556555

557556
std::chrono::hours file_age = GetFeeEstimatorFileAge();
558-
// fee estimate file must not be too old to avoid wrong fee estimates.
559557
if (file_age > MAX_FILE_AGE && !read_stale_estimates) {
560558
LogPrintf("Fee estimation file %s too old (age=%lld > %lld hours) and will not be used to avoid serving stale estimates.\n", fs::PathToString(m_estimation_filepath), Ticks<std::chrono::hours>(file_age), Ticks<std::chrono::hours>(MAX_FILE_AGE));
561559
return;

src/policy/fees.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@
2525
// How often to flush fee estimates to fee_estimates.dat.
2626
static constexpr std::chrono::hours FEE_FLUSH_INTERVAL{1};
2727

28-
/** fee_estimates.dat that are more than 60 hours (2.5 days) will not be read,
29-
* as the estimates in the file are stale.
28+
/** fee_estimates.dat that are more than 60 hours (2.5 days) old will not be read,
29+
* as fee estimates are based on historical data and may be inaccurate if
30+
* network activity has changed.
3031
*/
3132
static constexpr std::chrono::hours MAX_FILE_AGE{60};
3233

test/functional/feature_config_args.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,14 @@ def test_ignored_default_conf(self):
371371
f'is being used instead.') + r"[\s\S]*", env=env, match=ErrorMatch.FULL_REGEX)
372372
node.args = node_args
373373

374+
def test_acceptstalefeeestimates_arg_support(self):
375+
self.log.info("Test -acceptstalefeeestimates option support")
376+
conf_file = self.nodes[0].datadir_path / "bitcoin.conf"
377+
for chain, chain_name in {("main", ""), ("test", "testnet3"), ("signet", "signet")}:
378+
util.write_config(conf_file, n=0, chain=chain_name, extra_config='acceptstalefeeestimates=1\n')
379+
self.nodes[0].assert_start_raises_init_error(expected_msg=f'Error: acceptstalefeeestimates is not supported on {chain} chain.')
380+
util.write_config(conf_file, n=0, chain="regtest") # Reset to regtest
381+
374382
def run_test(self):
375383
self.test_log_buffer()
376384
self.test_args_log()
@@ -383,6 +391,7 @@ def run_test(self):
383391
self.test_invalid_command_line_options()
384392
self.test_ignored_conf()
385393
self.test_ignored_default_conf()
394+
self.test_acceptstalefeeestimates_arg_support()
386395

387396
# Remove the -datadir argument so it doesn't override the config file
388397
self.nodes[0].args = [arg for arg in self.nodes[0].args if not arg.startswith("-datadir")]

0 commit comments

Comments
 (0)