File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change 2
2
# Copyright (c) 2022-present The Bitcoin Core developers
3
3
# Distributed under the MIT software license, see the accompanying
4
4
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
5
- """Test removing undeleted pruned blk files on startup."""
5
+ """Tests around pruning rev and blk files on startup."""
6
6
7
7
import platform
8
8
from test_framework .test_framework import BitcoinTestFramework
9
+ from test_framework .util import assert_equal
9
10
10
11
11
12
class FeatureRemovePrunedFilesOnStartupTest (BitcoinTestFramework ):
@@ -50,6 +51,22 @@ def run_test(self):
50
51
assert not blk0 .exists ()
51
52
assert not rev1 .exists ()
52
53
54
+ self .log .info ("Check that a reindex will wipe all files" )
55
+
56
+ def ls_files ():
57
+ ls = [
58
+ entry .name
59
+ for entry in self .nodes [0 ].blocks_path .iterdir ()
60
+ if entry .is_file () and any (map (entry .name .startswith , ["rev" , "blk" ]))
61
+ ]
62
+ return sorted (ls )
63
+
64
+ assert_equal (len (ls_files ()), 4 )
65
+ self .restart_node (0 , extra_args = self .extra_args [0 ] + ["-reindex" ])
66
+ assert_equal (self .nodes [0 ].getblockcount (), 0 )
67
+ self .stop_node (0 ) # Stop node to flush the two newly created files
68
+ assert_equal (ls_files (), ["blk00000.dat" , "rev00000.dat" ])
69
+
53
70
54
71
if __name__ == '__main__' :
55
72
FeatureRemovePrunedFilesOnStartupTest (__file__ ).main ()
You can’t perform that action at this time.
0 commit comments