From 705a779d7640a9a10c244175278a2435e6041167 Mon Sep 17 00:00:00 2001 From: Vincent Botbol Date: Wed, 19 Sep 2018 17:48:29 +0200 Subject: [PATCH] Admin: add an "unmark all" invalid blocks command --- .../client_admin_commands.ml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/lib_client_commands/client_admin_commands.ml b/src/lib_client_commands/client_admin_commands.ml index 66efa7051..0dc307864 100644 --- a/src/lib_client_commands/client_admin_commands.ml +++ b/src/lib_client_commands/client_admin_commands.ml @@ -32,7 +32,7 @@ let commands () = ~desc: "Make the node forget its decision of rejecting blocks." no_options (prefixes [ "unmark" ; "invalid" ] - @@ seq_of_param (Block_hash.param ~name:"blocks" ~desc:"blocks to remove from invalid list")) + @@ seq_of_param (Block_hash.param ~name:"block" ~desc:"blocks to remove from invalid list")) (fun () blocks (cctxt : #Client_context.full) -> iter_s (fun block -> @@ -42,4 +42,19 @@ let commands () = Block_hash.pp block >>= fun () -> return_unit) blocks) ; + + command ~group + ~desc: "Make the node forget every decision of rejecting blocks." + no_options + (prefixes [ "unmark" ; "all" ; "invalid" ; "blocks" ] + @@ stop) + (fun () (cctxt : #Client_context.full) -> + Shell_services.Invalid_blocks.list cctxt () >>=? fun invalid_blocks -> + iter_s (fun { Chain_services.hash } -> + Shell_services.Invalid_blocks.delete cctxt hash >>=? fun () -> + cctxt#message + "Block %a no longer marked invalid." + Block_hash.pp_short hash >>= fun () -> + return_unit) + invalid_blocks) ; ]