2222
2323
2424def 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. )
2626
2727class PruneTest (BitcoinTestFramework ):
2828 def set_test_params (self ):
@@ -69,7 +69,7 @@ def create_big_chain(self):
6969 sync_blocks (self .nodes [0 :5 ])
7070
7171 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" ) ):
7373 raise AssertionError ("blk00000.dat is missing, pruning too early" )
7474 self .log .info ("Success" )
7575 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):
7979 mine_large_block (self .nodes [0 ], self .utxo_cache_0 )
8080
8181 # 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 )
8383
8484 self .log .info ("Success" )
8585 usage = calc_usage (self .prunedir )
@@ -255,7 +255,7 @@ def prune(index, expected_ret=None):
255255 assert_equal (ret , expected_ret )
256256
257257 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 ) ))
259259
260260 # should not prune because chain tip of node 3 (995) < PruneAfterHeight (1000)
261261 assert_raises_rpc_error (- 1 , "Blockchain is too short for pruning" , node .pruneblockchain , height (500 ))
0 commit comments