Skip to content

Commit b935abb

Browse files
author
MarcoFalke
committed
Merge bitcoin/bitcoin#22684: test: check for invalid -prune parameters
e2ff385 test: check for invalid `-prune` parameters (Sebastian Falbesoner) Pull request description: This small PR adds missing test coverage for invalid `-prune` parameter values / combinations: https://github.com/bitcoin/bitcoin/blob/77e23ca945030d557559a7391cb8bd368693548c/src/init.cpp#L926-L928 https://github.com/bitcoin/bitcoin/blob/77e23ca945030d557559a7391cb8bd368693548c/src/init.cpp#L935-L937 https://github.com/bitcoin/bitcoin/blob/77e23ca945030d557559a7391cb8bd368693548c/src/init.cpp#L844-L849 Not sure if the tests fit into `feature_config_args.py` or should rather be moved into `feature_pruning.py`; the latter though seems to be run less often due to being very memory-hungry. ACKs for top commit: laanwj: Code review ACK e2ff385 Tree-SHA512: bb0db98090058ecac9f8a01301634e9dba9a65fd56b6a0b770f88da28c4f01e240e22b1225f0d231e28bdd4b5b51bff0e6853cccc46ed0190e91b84f7954a9db
2 parents 42b00a3 + e2ff385 commit b935abb

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

test/functional/feature_pruning.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,24 @@ def create_big_chain(self):
127127

128128
self.sync_blocks(self.nodes[0:5])
129129

130+
def test_invalid_command_line_options(self):
131+
self.nodes[0].assert_start_raises_init_error(
132+
expected_msg='Error: Prune cannot be configured with a negative value.',
133+
extra_args=['-prune=-1'],
134+
)
135+
self.nodes[0].assert_start_raises_init_error(
136+
expected_msg='Error: Prune configured below the minimum of 550 MiB. Please use a higher number.',
137+
extra_args=['-prune=549'],
138+
)
139+
self.nodes[0].assert_start_raises_init_error(
140+
expected_msg='Error: Prune mode is incompatible with -txindex.',
141+
extra_args=['-prune=550', '-txindex'],
142+
)
143+
self.nodes[0].assert_start_raises_init_error(
144+
expected_msg='Error: Prune mode is incompatible with -coinstatsindex.',
145+
extra_args=['-prune=550', '-coinstatsindex'],
146+
)
147+
130148
def test_height_min(self):
131149
assert os.path.isfile(os.path.join(self.prunedir, "blk00000.dat")), "blk00000.dat is missing, pruning too early"
132150
self.log.info("Success")
@@ -453,6 +471,9 @@ def run_test(self):
453471
self.log.info("Test wallet re-scan")
454472
self.wallet_test()
455473

474+
self.log.info("Test invalid pruning command line options")
475+
self.test_invalid_command_line_options()
476+
456477
self.log.info("Done")
457478

458479
if __name__ == '__main__':

0 commit comments

Comments
 (0)