This PR Follow up comments from #27622
It test that the new regtest-only option acceptstalefeeestimates is not supported on main, signet and test chains, removes an unnecessary comment, and update fee estimator MAXFILEAGE description comment.
This PR Follow up comments from #27622
It test that the new regtest-only option acceptstalefeeestimates is not supported on main, signet and test chains, removes an unnecessary comment, and update fee estimator MAXFILEAGE description comment.
<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--021abf342d371248e50ceaed478a90ca-->
See the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.
<!--174a7506f384e20aa4161008e828411d-->
Reviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
Due to the multiple datadirs in the feature_config_args test, this assertion actually does fail in combine_logs.py:
I get the same error on master branch too, so I dunno if it's really up to you and this PR to patch around it or not.
107 | @@ -108,6 +108,29 @@ def test_config_file_parser(self): 108 | self.restart_node(0) 109 | self.nodes[0].stop_node(expected_stderr=f'Warning: {inc_conf_file_path}:1 Section [testnot] is not recognized.{os.linesep}{inc_conf_file2_path}:1 Section [testnet] is not recognized.') 110 | 111 | + with open(inc_conf_file_path, 'w', encoding='utf-8') as conf: 112 | + conf.write('') # clear
You don't need to clear here, or on L125 because you are opening the conf file with "w" so the contents of the file get overwritten. Tests pass without the two clear lines, and I checked with extra open/read/print statements that the expected configuration settings were present in the file at each step.
Thank you. I removed the clears.
I get the same error on master branch too, so I dunno if it's really up to you and this PR to patch around it or not.
I think this should be fixed in follow-up PR.
122 | + self.log.info("test acceptstalefeeestimates option is not supported on signet chain.") 123 | + with open(inc_conf_file_path, 'w', encoding='utf-8') as conf: 124 | + conf.write('signet=1\n') 125 | + conf.write('acceptstalefeeestimates=1\n') 126 | + self.nodes[0].assert_start_raises_init_error(extra_args=[f"-conf={inc_conf_file_path}", "-allowignoredconf"], expected_msg='Error: acceptstalefeeestimates is not supported on signet chain.') 127 | +
Can be made quite a bit more DRY:
self.log.info(f"Test -acceptstalefeeestimates option is not supported on non-regtest chains")
for chain in ["main", "test", "signet"]:
with open(inc_conf_file_path, 'w', encoding='utf-8') as conf:
conf.write(f'chain={chain}\n')
conf.write('acceptstalefeeestimates=1\n')
self.nodes[0].assert_start_raises_init_error(extra_args=[f"-conf={inc_conf_file_path}", "-allowignoredconf"], expected_msg=f'Error: acceptstalefeeestimates is not supported on {chain} chain.')
Also don't think this belongs in test_config_file_parser, probably worth adding its own function for?
Thank you, I updated with your suggestions
377 | @@ -378,7 +378,7 @@ def test_acceptstalefeeestimates_option(self): 378 | os.utime(fee_dat, (last_modified_time, last_modified_time)) 379 | 380 | # Restart node with -acceptstalefeeestimates option to ensure fee_estimate.dat file is read 381 | - self.start_node(0,extra_args=["-acceptstalefeeestimates"]) 382 | + self.start_node(0, extra_args=["-acceptstalefeeestimates"])
Would generally avoid unrelated style nits, you're not touching this line (or even file, for that matter) for anything else, so best to just leave as is.
Done, thanks
555 | } 556 | 557 | std::chrono::hours file_age = GetFeeEstimatorFileAge(); 558 | - // fee estimate file must not be too old to avoid wrong fee estimates. 559 | + // Serving stale fee estimates can cause transactions to become stuck in the bottom of the mempool in the worst case. 560 | + // Don't do that.
I think I know what you mean, but imo transactions being stuck is a little bit of a jump from feerate underestimation. Maybe "Serving stale fee estimates may lead to overpaying in fees or not meeting minimum feerate requirements in the worst case." Or just delete this comment, as the code is self-explanatory and there is already a comment above MAX_FILE_AGE.
I deleted the comment. Thank you
376 | + inc_conf_file_path = os.path.join(self.nodes[0].datadir, 'include.conf') 377 | + for chain in ["main", "test", "signet"]: 378 | + with open(inc_conf_file_path, 'w', encoding='utf-8') as conf: 379 | + conf.write(f'chain={chain}\n') 380 | + conf.write('acceptstalefeeestimates=1\n') 381 | + self.nodes[0].assert_start_raises_init_error(extra_args=[f"-conf={inc_conf_file_path}", "-allowignoredconf"], expected_msg=f'Error: acceptstalefeeestimates is not supported on {chain} chain.')
I'm not sure why, and maybe it's an issue with my local environment as the CI is green, but this test passes for me in the previous push 9bd96327232ac9fbb7f9cb0a0545a4410bdd4964 but not with the latest push ef19d52e25407df1a56a76038dd4c95e03e75250; only the signet case passes while the main and test cases raise the following:
AssertionError: [node 0] Expected message "Error: acceptstalefeeestimates is not supported on test chain." does not fully match stderr:
"Error: Unable to start HTTP server. See debug log for details."
Correcting myself, it turns out there isn't a difference between the two pushes. The issue comes from having bitcoind already running on mainnet, testnet, or signet; if yes, the test fails with the message I described. If others see this issue too, would it be feasible to write the test to be independent of bitcoind running on those chains when the test is run?
Thank you @jonatack, I was able to recreate the same Error. b24ffb05e42ec13ade193c9d7bea0def4296a4a8 should fix this.
Thanks for looking into it! Running the updated test with mainnet/testnet3/signet nodes running, the mainnet test passed. However, it still fails for the testnet3 and signet cases. (IDK about other people, but I usually have mainnet and one or both of signet and testnet3 running while working on this project and running tests.)
(nit in your last push, this diff was correct before the update, 2 spaces is the norm before a # comment)
- conf.write('') # clear
+ conf.write('') # clear
You can verify this using, say, the black python linter:
$ black --code "conf.write('') # clear"
conf.write("") # clear
Thanks, Fix this and the nit in 530ea157ea1c25821711617e5f1da3e95cfdc66d
Concept ACK
Due to the multiple datadirs in the
feature_config_argstest, this assertion actually does fail incombine_logs.py:I get the same error on master branch too, so I dunno if it's really up to you and this PR to patch around it or not. @pinheadmz The update on 530ea157ea1c25821711617e5f1da3e95cfdc66d is using the
node[0]'sbitcoin.confto set the options.
Could rebase for green CI, if still relevant?
rebased
370 | @@ -371,6 +371,18 @@ def test_ignored_default_conf(self): 371 | f'is being used instead.') + r"[\s\S]*", env=env, match=ErrorMatch.FULL_REGEX) 372 | node.args = node_args 373 | 374 | + def test_acceptstalefeeestimates_arg_support(self): 375 | + self.log.info("Test -acceptstalefeeestimates option support") 376 | + 377 | + conf_file = self.nodes[0].datadir_path / "bitcoin.conf" 378 | + chains = {"main":"", "test":"testnet3", "signet":"signet"}
chains = {"main": "", "test": "testnet3", "signet": "signet"}
$ pycodestyle test/functional/feature_config_args.py
...
test/functional/feature_config_args.py:378:25: E231 missing whitespace after ':'
test/functional/feature_config_args.py:378:36: E231 missing whitespace after ':'
test/functional/feature_config_args.py:378:57: E231 missing whitespace after ':'
or alternatively
for chain, chain_name in {("main", ""), ("test", "testnet3"), ("signet", "signet")}:
Thank you, I fixed the nit.
380 | + util.write_config(conf_file, n=0, chain=chain_name, extra_config='acceptstalefeeestimates=1\n') 381 | + self.nodes[0].assert_start_raises_init_error(expected_msg=f'Error: acceptstalefeeestimates is not supported on {chain} chain.') 382 | + 383 | + util.write_config(conf_file, n=0, chain="regtest") # Reset to regtest 384 | + 385 | +
Can drop extra newline
$ pycodestyle test/functional/feature_config_args.py
...
test/functional/feature_config_args.py:386:5: E303 too many blank lines (2)
(optionally also drop the newlines at lines 376 and 382)
I removed the blank lines.
Tested ACK 8884d5c6059495253dc84e1b984315ddbc78ecd3
Some non-blocking comments, happy to re-ack if you update.
ACK ee5a0369cc4305da7b3d26f37677de05ad797e51
utACK ee5a0369cc4305da7b3d26f37677de05ad797e51