22
22
23
23
24
24
def calc_usage (blockdir ):
25
- return sum (os .path .getsize (blockdir + f ) for f in os .listdir (blockdir ) if os .path .isfile (blockdir + f )) / (1024. * 1024. )
25
+ return sum (os .path .getsize (blockdir + f ) for f in os .listdir (blockdir ) if os .path .isfile (os . path . join ( blockdir , f ) )) / (1024. * 1024. )
26
26
27
27
class PruneTest (BitcoinTestFramework ):
28
28
def set_test_params (self ):
@@ -69,7 +69,7 @@ def create_big_chain(self):
69
69
sync_blocks (self .nodes [0 :5 ])
70
70
71
71
def test_height_min (self ):
72
- if not os .path .isfile (self .prunedir + "blk00000.dat" ):
72
+ if not os .path .isfile (os . path . join ( self .prunedir , "blk00000.dat" ) ):
73
73
raise AssertionError ("blk00000.dat is missing, pruning too early" )
74
74
self .log .info ("Success" )
75
75
self .log .info ("Though we're already using more than 550MiB, current usage: %d" % calc_usage (self .prunedir ))
@@ -79,7 +79,7 @@ def test_height_min(self):
79
79
mine_large_block (self .nodes [0 ], self .utxo_cache_0 )
80
80
81
81
# Wait for blk00000.dat to be pruned
82
- wait_until (lambda : not os .path .isfile (self .prunedir + "blk00000.dat" ), timeout = 30 )
82
+ wait_until (lambda : not os .path .isfile (os . path . join ( self .prunedir , "blk00000.dat" ) ), timeout = 30 )
83
83
84
84
self .log .info ("Success" )
85
85
usage = calc_usage (self .prunedir )
@@ -255,7 +255,7 @@ def prune(index, expected_ret=None):
255
255
assert_equal (ret , expected_ret )
256
256
257
257
def has_block (index ):
258
- return os .path .isfile (self .options . tmpdir + "/node{}/ regtest/ blocks/ blk{:05}.dat" .format (node_number , index ))
258
+ return os .path .isfile (os . path . join ( self .nodes [ node_number ]. datadir , " regtest" , " blocks" , " blk{:05}.dat" .format (index ) ))
259
259
260
260
# should not prune because chain tip of node 3 (995) < PruneAfterHeight (1000)
261
261
assert_raises_rpc_error (- 1 , "Blockchain is too short for pruning" , node .pruneblockchain , height (500 ))
0 commit comments