From 9035bb94ab9d3512306b21bc822c92a25735b2f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Henry?= Date: Thu, 22 Mar 2018 13:41:57 +0100 Subject: [PATCH] Baker: do not generate random when not required --- src/proto_alpha/lib_baking/client_baking_forge.ml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/proto_alpha/lib_baking/client_baking_forge.ml b/src/proto_alpha/lib_baking/client_baking_forge.ml index 490db6979..11882c3ff 100644 --- a/src/proto_alpha/lib_baking/client_baking_forge.ml +++ b/src/proto_alpha/lib_baking/client_baking_forge.ml @@ -540,8 +540,13 @@ let bake (cctxt : #Proto_alpha.full) state = ~shell_header ~priority ?seed_nonce_hash ~src_sk operations |> trace_exn (Failure "Error while injecting block") >>=? fun block_hash -> - State.record_block cctxt level block_hash seed_nonce - |> trace_exn (Failure "Error while recording block") >>=? fun () -> + begin + if seed_nonce_hash <> None then + State.record_block cctxt level block_hash seed_nonce + |> trace_exn (Failure "Error while recording block") + else + return () + end >>=? fun () -> Client_keys.Public_key_hash.name cctxt delegate >>=? fun name -> cctxt#message "Injected block %a for %s after %a \