Baker/Endorser: record baked blocks and endorsement before injecting
This commit is contained in:
parent
3b46f49651
commit
9f52c43cff
@ -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 =
|
||||
|
@ -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")
|
||||
|
Loading…
Reference in New Issue
Block a user