New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: add coverage for rpc error when trying to rescan beyond pruned data #25937
Conversation
Concept ACK. The pruning tests are in the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test passed four times for me. Edit: did not try without the wallet.
@@ -143,6 +143,10 @@ def test_invalid_command_line_options(self): | |||
extra_args=['-prune=550', '-reindex-chainstate'], | |||
) | |||
|
|||
def test_rescan_blockchain(self): | |||
self.restart_node(0, ["-prune=550"]) | |||
assert_raises_rpc_error(-1, "Can't rescan beyond pruned data. Use RPC call getblockchaininfo to determine your pruned height.", self.nodes[0].rescanblockchain) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be good to explain in a docstring or comment why this assert will fail here.
If helpful, here is the result of printing getblockchaininfo at this point.
def test_rescan_blockchain(self):
self.restart_node(0, ["-prune=550"])
+ import pprint
+ pprint.pprint(self.nodes[0].getblockchaininfo())
assert_raises_rpc_error(-1, "Can't rescan beyond pruned data. Use RPC call getblockchaininfo to determine your pruned height.", self.nodes[0].rescanblockchain)
results (two runs)
2022-09-01T22:12:35.086000Z TestFramework (INFO): Test it's not possible to rescan beyond pruned data
{'automatic_pruning': True,
'bestblockhash': '5e4cd87c756bfa94ee47f7ad64e7ccc2db3ca77ba214ac64ca121159388acb2c',
'blocks': 1553,
'chain': 'regtest',
'chainwork': '0000000000000000000000000000000000000000000000000000000000000c24',
'difficulty': Decimal('4.656542373906925E-10'),
'headers': 1553,
'initialblockdownload': False,
'mediantime': 1662069944,
'prune_target_size': 576716800,
'pruned': True,
'pruneheight': 1056,
'size_on_disk': 461006996,
'time': 1662069945,
'verificationprogress': 1,
'warnings': 'This is a pre-release test build - use at your own risk - do not '
'use for mining or merchant applications'}
2022-09-01T22:12:35.847000Z TestFramework (INFO): Done
2022-09-01T23:00:43.821000Z TestFramework (INFO): Test it's not possible to rescan beyond pruned data
{'automatic_pruning': True,
'bestblockhash': '7075780a24234273a3d53f0a73e0be233c0748fd3fe74c8beb6c6a7ea8ee9686',
'blocks': 1553,
'chain': 'regtest',
'chainwork': '0000000000000000000000000000000000000000000000000000000000000c24',
'difficulty': Decimal('4.656542373906925E-10'),
'headers': 1553,
'initialblockdownload': False,
'mediantime': 1662072650,
'prune_target_size': 576716800,
'pruned': True,
'pruneheight': 1056,
'size_on_disk': 461006996,
'time': 1662072651,
'verificationprogress': 1,
'warnings': 'This is a pre-release test build - use at your own risk - do not '
'use for mining or merchant applications'}
2022-09-01T23:00:44.840000Z TestFramework (INFO): Done
7852e8e
to
cca4f82
Compare
Force-pushed: call |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK cca4f82
is it possible to check that |
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ReviewsSee 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. ConflictsNo conflicts as of last run. |
@aureleoules, I think so. |
Does that mean you are working on / implementing this? |
…rescan beyond pruned data cca4f82 test: add coverage for rpc error when trying to rescan beyond pruned data (brunoerg) Pull request description: This PR adds test coverage for the following rpc error: https://github.com/bitcoin/bitcoin/blob/15692e2641592394bdd4da0a7c2d371de8e576dd/src/wallet/rpc/transactions.cpp#L896-L899 ACKs for top commit: MarcoFalke: lgtm ACK cca4f82 aureleoules: ACK cca4f82 Tree-SHA512: 724a055e9f6cddf1935699e8769015115f24f6485a0bd87e8660072ee44a15c1bddfdda848acc101ea7184b7e65a33b5b0d80b563d2ba3ecdab7a631378d6476
This PR adds test coverage for the following rpc error:
bitcoin/src/wallet/rpc/transactions.cpp
Lines 896 to 899 in 15692e2