diff --git a/src/proto_alpha/lib_delegate/client_baking_endorsement.ml b/src/proto_alpha/lib_delegate/client_baking_endorsement.ml index 4759717a5..82d3e8cd0 100644 --- a/src/proto_alpha/lib_delegate/client_baking_endorsement.ml +++ b/src/proto_alpha/lib_delegate/client_baking_endorsement.ml @@ -49,11 +49,11 @@ let inject_endorsement ~branch:hash ~level:level () >>=? fun bytes -> + State.record cctxt pkh level >>=? fun () -> Shell_services.Chain.chain_id cctxt ~chain () >>=? fun chain_id -> Client_keys.append cctxt src_sk ~watermark:(Endorsement chain_id) bytes >>=? fun signed_bytes -> Shell_services.Injection.operation cctxt ?async ~chain signed_bytes >>=? fun oph -> - State.record cctxt pkh level >>=? fun () -> return oph let check_endorsement cctxt level pkh = diff --git a/src/proto_alpha/lib_delegate/client_baking_forge.ml b/src/proto_alpha/lib_delegate/client_baking_forge.ml index 8b063a44e..0be91fb24 100644 --- a/src/proto_alpha/lib_delegate/client_baking_forge.ml +++ b/src/proto_alpha/lib_delegate/client_baking_forge.ml @@ -961,6 +961,9 @@ let bake (cctxt : #Proto_alpha.full) state = -% t event "double_bake_near_miss" -% a level_tag level) >>= return | false -> + (* Record baked blocks to prevent double baking and nonces to reveal later *) + State.record cctxt src_pkh level >>=? fun () -> + inject_block cctxt ~chain ~force:true ~shell_header ~priority ?seed_nonce_hash ~src_sk operations |> trace_exn (Failure "Error while injecting block") >>=? fun block_hash -> @@ -977,8 +980,6 @@ let bake (cctxt : #Proto_alpha.full) state = -% a operations_tag operations ) >>= fun () -> - (* Record baked blocks to prevent double baking and nonces to reveal later *) - State.record cctxt src_pkh level >>=? fun () -> begin if seed_nonce_hash <> None then Client_baking_nonces.add cctxt block_hash seed_nonce |> trace_exn (Failure "Error while recording nonce")