Baker: do not generate random when not required

This commit is contained in:
Grégoire Henry 2018-03-22 13:41:57 +01:00
parent bf0dfda7d4
commit 9035bb94ab

View File

@ -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 ->
begin
if seed_nonce_hash <> None then
State.record_block cctxt level block_hash seed_nonce
|> trace_exn (Failure "Error while recording block") >>=? fun () ->
|> 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 \