@@ -277,7 +277,7 @@ def manual_test(self, node_number, use_timestamp):
277
277
self .start_node (node_number )
278
278
node = self .nodes [node_number ]
279
279
assert_equal (node .getblockcount (), 995 )
280
- assert_raises_rpc_error (- 1 , "not in prune mode" , node .pruneblockchain , 500 )
280
+ assert_raises_rpc_error (- 1 , "Cannot prune blocks because node is not in prune mode" , node .pruneblockchain , 500 )
281
281
282
282
# now re-start in manual pruning mode
283
283
self .restart_node (node_number , extra_args = ["-prune=1" ])
@@ -308,11 +308,18 @@ def has_block(index):
308
308
self .generate (node , 6 , sync_fun = self .no_op )
309
309
assert_equal (node .getblockchaininfo ()["blocks" ], 1001 )
310
310
311
+ # prune parameter in the future (block or timestamp) should raise an exception
312
+ future_parameter = height (1001 ) + 5
313
+ if use_timestamp :
314
+ assert_raises_rpc_error (- 8 , "Could not find block with at least the specified timestamp" , node .pruneblockchain , future_parameter )
315
+ else :
316
+ assert_raises_rpc_error (- 8 , "Blockchain is shorter than the attempted prune height" , node .pruneblockchain , future_parameter )
317
+
311
318
# Pruned block should still know the number of transactions
312
319
assert_equal (node .getblockheader (node .getblockhash (1 ))["nTx" ], block1_details ["nTx" ])
313
320
314
321
# negative heights should raise an exception
315
- assert_raises_rpc_error (- 8 , "Negative" , node .pruneblockchain , - 10 )
322
+ assert_raises_rpc_error (- 8 , "Negative block height " , node .pruneblockchain , - 10 )
316
323
317
324
# height=100 too low to prune first block file so this is a no-op
318
325
prune (100 )
0 commit comments