From 9a056eef2325326948081bbd431e455140aa2e75 Mon Sep 17 00:00:00 2001 From: Milo Davis Date: Fri, 27 Oct 2017 19:41:47 +0200 Subject: [PATCH] Improved error message --- src/node/shell/prevalidation.ml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/node/shell/prevalidation.ml b/src/node/shell/prevalidation.ml index 048b54d64..815228e09 100644 --- a/src/node/shell/prevalidation.ml +++ b/src/node/shell/prevalidation.ml @@ -126,10 +126,16 @@ let start_prevalidation ?proto_header ~predecessor ~timestamp () = State.Block.context predecessor >>= fun predecessor_context -> Context.get_protocol predecessor_context >>= fun protocol -> let predecessor = State.Block.hash predecessor in - let (module Proto) = + begin match State.Registred_protocol.get protocol with - | None -> assert false (* FIXME, this should not happen! *) - | Some protocol -> protocol in + | None -> + (* FIXME. *) + (* This should not happen: it should be handled in the validator. *) + failwith "Prevalidation: missing protocol '%a' for the current block." + Protocol_hash.pp_short protocol + | Some protocol -> + return protocol + end >>=? fun (module Proto) -> Context.reset_test_network predecessor_context predecessor timestamp >>= fun predecessor_context ->