Improved error message

This commit is contained in:
Milo Davis 2017-10-27 19:41:47 +02:00 committed by Benjamin Canou
parent dd9e5f5c95
commit 9a056eef23

View File

@ -126,10 +126,16 @@ let start_prevalidation ?proto_header ~predecessor ~timestamp () =
State.Block.context predecessor >>= fun predecessor_context -> State.Block.context predecessor >>= fun predecessor_context ->
Context.get_protocol predecessor_context >>= fun protocol -> Context.get_protocol predecessor_context >>= fun protocol ->
let predecessor = State.Block.hash predecessor in let predecessor = State.Block.hash predecessor in
let (module Proto) = begin
match State.Registred_protocol.get protocol with match State.Registred_protocol.get protocol with
| None -> assert false (* FIXME, this should not happen! *) | None ->
| Some protocol -> protocol in (* 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 Context.reset_test_network
predecessor_context predecessor predecessor_context predecessor
timestamp >>= fun predecessor_context -> timestamp >>= fun predecessor_context ->