Skip to content

Commit edf98c5

Browse files
committed
d2600bc Merge bitcoin#28157: test doc: tests `acceptstalefeeestimates` option is only supported on regtest chain (DCG-Claude) 5bd92ee Merge bitcoin#28070: test: Drop 22.x node from TxindexCompatibilityTest (DCG-Claude) 0976752 Merge bitcoin#27884: test: Use TestNode datadir_path or chain_path where possible (DCG-Claude) Pull request description: <!-- backportsys v1 --> > 🔎 **Needs a careful look.** Commits are ordered by how much they were adapted: 🔴 heavy first, then 🟡 light (at most two invented lines, or up to six lines counting edits of upstream functional-test or doc lines), then 🟢 faithful (identical to upstream apart from context). ## Issue being fixed or feature implemented Backports 3 Bitcoin Core v0.26 pull request(s) that the Dash queue selected, including any discovered prerequisites: bitcoin#27884, bitcoin#28070, bitcoin#28157. ## What was done? | upstream | commit | review | gates | notes | |---|---|---|---|---| | bitcoin#27884 | `61144e66a8` | 🔴 heavy | build:pass mech:warn pick:pass tests:pass tree:pass verify:pass | Backports bitcoin#27884: adds the TestNode datadir_path/wallets_path properties and lets authproxy serialize p | | bitcoin#28070 | `c7fcabbc03` | 🔴 heavy | build:pass mech:warn pick:pass tests:pass tree:pass verify:pass | Backports bitcoin#28070, which adds the TestNode.blocks_path helper, switches tests to it with upstream's scri | | bitcoin#28157 | `4c719b396c` | 🔴 heavy | build:pass ci_fork:pass ci_upstream:pass mech:warn pick:pass tests:pass tree:pass verify:pass | Backports bitcoin#28157: fee-estimator doc comment cleanups plus a functional test confirming -acceptstalefeee | Each commit keeps the upstream subject (`partial Merge …` only where a hunk is deferred to a prerequisite still to be backported, named in the commit body; a hunk Dash intentionally never wants is recorded in the commit body or the reviewer's note above and does not make the backport partial). Conflicts were resolved commit by commit; commits that needed no resolution were cherry-picked unchanged. ## How Has This Been Tested? Recorded per commit, at that commit's own sha, not once for the branch: - built at each commit, reusing the worktree build cache - the test suites touched by each diff run at that commit, where the diff selected one - a mechanical diff-of-diffs against the upstream patch (every upstream hunk present, no added line without an upstream counterpart, no Dash-specific line dropped) - an independent verification pass on 3 commit(s) that needed adaptation - CI green on the fork gate PR thepastaclaw#95 at `4c719b396c`, which is this branch's head Gates that did not come back clean — please weigh these: - bitcoin#27884 `mech`: **warn** — 16 invented line(s); 6 Dash-feature line(s) removed; 11 partial/prereq/low-risk finding(s) - bitcoin#28070 `mech`: **warn** — 1 partial/prereq/low-risk finding(s) - bitcoin#28157 `mech`: **warn** — 7 invented line(s); 1 edited line(s) ## Breaking Changes None beyond the upstream changes themselves. ## Checklist: _Left for the reviewer; backportsys does not tick boxes on its own behalf._ - [ ] I have performed a self-review of my own code - [ ] I have made corresponding changes to the documentation - [ ] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_ --- ### Maintainer controls <!-- backportsys controls --> Tick a box and backportsys acts on it within a few minutes, then clears the box. For anything else — a hunk to drop, a resolution to redo, a question — just leave a review comment; nothing here needs a box. - [ ] 🔒 **Hands off** — stop every automated update to this branch <!-- bps:hands_off --> - [ ] 🔄 **Rebase** onto current `develop` <!-- bps:rebase --> - [ ] ❌ **Close** — abandon this batch and release its items <!-- bps:close --> <!-- /backportsys controls --> <!-- human notes below; the bot never edits this section --> Top commit has no ACKs. Tree-SHA512: fc4896bca24c4cd827fd39c95d72bc2dc4e9043660ab714927c84a19f2279db3fa61d04f901c1c7c15f3c3aec758cc29a9eb0545de6870623b3bb9345bf7b608
2 parents ab1b710 + d2600bc commit edf98c5

44 files changed

Lines changed: 179 additions & 174 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎src/policy/fees.cpp‎

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

562562
AutoFile est_file{fsbridge::fopen(m_estimation_filepath, "rb")};
563563

564-
// Whenever the fee estimation file is not present return early
565564
if (est_file.IsNull()) {
566565
LogPrintf("%s is not found. Continue anyway.\n", fs::PathToString(m_estimation_filepath));
567566
return;
568567
}
569568

570569
std::chrono::hours file_age = GetFeeEstimatorFileAge();
571-
// fee estimate file must not be too old to avoid wrong fee estimates.
572570
if (file_age > MAX_FILE_AGE && !read_stale_estimates) {
573571
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));
574572
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_abortnode.py‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@
99
- Mine a fork that requires disconnecting the tip.
1010
- Verify that dashd AbortNode's.
1111
"""
12-
1312
from test_framework.test_framework import BitcoinTestFramework
14-
from test_framework.util import get_datadir_path
15-
import os
1613

1714

1815
class AbortNodeTest(BitcoinTestFramework):
@@ -26,10 +23,9 @@ def setup_network(self):
2623

2724
def run_test(self):
2825
self.generate(self.nodes[0], 3, sync_fun=self.no_op)
29-
datadir = get_datadir_path(self.options.tmpdir, 0)
3026

3127
# Deleting the undo file will result in reorg failure
32-
os.unlink(os.path.join(datadir, self.chain, 'blocks', 'rev00000.dat'))
28+
(self.nodes[0].blocks_path / "rev00000.dat").unlink()
3329

3430
# Connecting to a node with a more work chain will trigger a reorg
3531
# attempt.

‎test/functional/feature_addrman.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def set_test_params(self):
5252
self.num_nodes = 1
5353

5454
def run_test(self):
55-
peers_dat = os.path.join(self.nodes[0].datadir, self.chain, "peers.dat")
55+
peers_dat = os.path.join(self.nodes[0].chain_path, "peers.dat")
5656
init_error = lambda reason: (
5757
f"Error: Invalid or corrupt peers.dat \\({reason}\\). If you believe this "
5858
f"is a bug, please report it to {self.config['environment']['PACKAGE_BUGREPORT']}. "

‎test/functional/feature_anchors.py‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ def set_test_params(self):
2323
self.disable_autoconnect = False
2424

2525
def run_test(self):
26-
node_anchors_path = os.path.join(
27-
self.nodes[0].datadir, "regtest", "anchors.dat"
28-
)
26+
node_anchors_path = self.nodes[0].chain_path / "anchors.dat"
2927

3028
self.log.info("When node starts, check if anchors.dat doesn't exist")
3129
assert not os.path.exists(node_anchors_path)

‎test/functional/feature_asmap.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def test_asmap_health_check(self):
121121

122122
def run_test(self):
123123
self.node = self.nodes[0]
124-
self.datadir = os.path.join(self.node.datadir, self.chain)
124+
self.datadir = self.node.chain_path
125125
self.default_asmap = os.path.join(self.datadir, DEFAULT_ASMAP_FILENAME)
126126
self.asmap_raw = os.path.join(os.path.dirname(os.path.realpath(__file__)), ASMAP)
127127

‎test/functional/feature_blocksdir.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def set_test_params(self):
1818

1919
def run_test(self):
2020
self.stop_node(0)
21-
assert os.path.isdir(os.path.join(self.nodes[0].datadir, self.chain, "blocks"))
21+
assert os.path.isdir(os.path.join(self.nodes[0].chain_path, "blocks"))
2222
assert not os.path.isdir(os.path.join(self.nodes[0].datadir, "blocks"))
2323
shutil.rmtree(self.nodes[0].datadir)
2424
initialize_datadir(self.options.tmpdir, 0, self.chain)
@@ -31,7 +31,7 @@ def run_test(self):
3131
self.log.info("mining blocks..")
3232
self.generatetoaddress(self.nodes[0], 10, self.nodes[0].get_deterministic_priv_key().address)
3333
assert os.path.isfile(os.path.join(blocksdir_path, self.chain, "blocks", "blk00000.dat"))
34-
assert os.path.isdir(os.path.join(self.nodes[0].datadir, self.chain, "blocks", "index"))
34+
assert os.path.isdir(os.path.join(self.nodes[0].chain_path, "blocks", "index"))
3535

3636

3737
if __name__ == '__main__':

‎test/functional/feature_config_args.py‎

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import os
88
import pathlib
99
import re
10+
import shutil
1011
import sys
1112
import tempfile
1213
import time
@@ -32,7 +33,7 @@ def test_config_file_parser(self):
3233
self.stop_node(0)
3334

3435
# Check that startup fails if conf= is set in bitcoin.conf or in an included conf file
35-
bad_conf_file_path = os.path.join(self.options.tmpdir, 'node0', 'bitcoin_bad.conf')
36+
bad_conf_file_path = self.nodes[0].datadir_path / "bitcoin_bad.conf"
3637
util.write_config(bad_conf_file_path, n=0, chain='', extra_config=f'conf=some.conf\n')
3738
conf_in_config_file_err = 'Error: Error reading configuration file: conf cannot be set in the configuration file; use includeconf= if you want to include additional config files'
3839
self.nodes[0].assert_start_raises_init_error(
@@ -75,7 +76,7 @@ def test_config_file_parser(self):
7576
conf.write("wallet=foo\n")
7677
self.nodes[0].assert_start_raises_init_error(expected_msg=f'Error: Config setting for -wallet only applied on {self.chain} network when in [{self.chain}] section.')
7778

78-
main_conf_file_path = os.path.join(self.options.tmpdir, 'node0', 'dash_main.conf')
79+
main_conf_file_path = self.nodes[0].datadir_path / "dash_main.conf"
7980
util.write_config(main_conf_file_path, n=0, chain='', extra_config=f'includeconf={inc_conf_file_path}\n')
8081
with open(inc_conf_file_path, 'w', encoding='utf-8') as conf:
8182
conf.write('acceptnonstdtxn=1\n')
@@ -367,6 +368,20 @@ def test_ignored_default_conf(self):
367368
f'is being used instead.') + r"[\s\S]*", env=env, match=ErrorMatch.FULL_REGEX)
368369
node.args = node_args
369370

371+
def test_acceptstalefeeestimates_arg_support(self):
372+
self.log.info("Test -acceptstalefeeestimates option support")
373+
conf_file = self.nodes[0].datadir_path / "dash.conf"
374+
existing_paths = set(self.nodes[0].datadir_path.iterdir())
375+
for chain, chain_name in {("main", ""), ("test", "testnet3"), ("devnet", "devnet")}:
376+
util.write_config(conf_file, n=0, chain=chain_name, extra_config='acceptstalefeeestimates=1\n')
377+
self.nodes[0].assert_start_raises_init_error(expected_msg=f'Error: acceptstalefeeestimates is not supported on {chain} chain.')
378+
util.write_config(conf_file, n=0, chain="regtest") # Reset to regtest
379+
# Remove the chain dirs created by the failed starts above, so node0 keeps a single
380+
# chain dir holding a debug.log, as combine_logs.py (run by Dash CI on every test) expects
381+
for path in set(self.nodes[0].datadir_path.iterdir()) - existing_paths:
382+
if path.is_dir():
383+
shutil.rmtree(path)
384+
370385
def run_test(self):
371386
self.test_log_buffer()
372387
self.test_args_log()
@@ -380,6 +395,7 @@ def run_test(self):
380395
self.test_invalid_command_line_options()
381396
self.test_ignored_conf()
382397
self.test_ignored_default_conf()
398+
self.test_acceptstalefeeestimates_arg_support()
383399

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

‎test/functional/feature_dirsymlinks.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def run_test(self):
2626
self.stop_node(0)
2727

2828
rename_and_link(
29-
from_name=self.nodes[0].chain_path / "blocks",
29+
from_name=self.nodes[0].blocks_path,
3030
to_name=dir_new_blocks,
3131
)
3232
rename_and_link(

‎test/functional/feature_filelock.py‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
# Distributed under the MIT software license, see the accompanying
44
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
55
"""Check that it's not possible to start a second bitcoind instance using the same datadir or wallet."""
6-
import os
76
import random
87
import string
98

@@ -26,7 +25,7 @@ def setup_network(self):
2625
self.nodes[0].wait_for_rpc_connection()
2726

2827
def run_test(self):
29-
datadir = os.path.join(self.nodes[0].datadir, self.chain)
28+
datadir = self.nodes[0].chain_path
3029
self.log.info(f"Using datadir {datadir}")
3130

3231
self.log.info("Check that we can't start a second dashd instance using the same datadir")
@@ -43,7 +42,7 @@ def run_test(self):
4342
def check_wallet_filelock(descriptors):
4443
wallet_name = ''.join([random.choice(string.ascii_lowercase) for _ in range(6)])
4544
self.nodes[0].createwallet(wallet_name=wallet_name, descriptors=descriptors)
46-
wallet_dir = os.path.join(datadir, 'wallets')
45+
wallet_dir = self.nodes[0].wallets_path
4746
self.log.info("Check that we can't start a second dashd instance using the same wallet")
4847
if descriptors:
4948
expected_msg = f"Error: SQLiteDatabase: Unable to obtain an exclusive lock on the database, is it being used by another instance of {self.config['environment']['PACKAGE_NAME']}?"

0 commit comments

Comments
 (0)