From 1d1bd2f7d1f510487ca1ac93817e1acabfb5e019 Mon Sep 17 00:00:00 2001 From: MBourgoin Date: Thu, 14 Jun 2018 09:31:10 +0200 Subject: [PATCH] Alpha/Endorser: less RPC calls --- .../lib_delegate/client_baking_endorsement.ml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/proto_alpha/lib_delegate/client_baking_endorsement.ml b/src/proto_alpha/lib_delegate/client_baking_endorsement.ml index 1b44e3904..885e3f571 100644 --- a/src/proto_alpha/lib_delegate/client_baking_endorsement.ml +++ b/src/proto_alpha/lib_delegate/client_baking_endorsement.ml @@ -74,9 +74,8 @@ let get_signing_slots cctxt ?(chain = `Main) block delegate level = let inject_endorsement (cctxt : #Proto_alpha.full) - ?(chain = `Main) block level ?async + ?(chain = `Main) block hash level ?async src_sk slots pkh = - Shell_services.Blocks.hash cctxt ~chain ~block () >>=? fun hash -> Alpha_services.Forge.endorsement cctxt (chain, block) ~branch:hash @@ -127,7 +126,8 @@ let forge_endorsement (cctxt : #Proto_alpha.full) | [] -> cctxt#error "No slot found at level %a" Raw_level.pp level | slots -> return slots end >>=? fun slots -> - inject_endorsement cctxt ~chain ?async block level src_sk slots src_pkh >>=? fun oph -> + Shell_services.Blocks.hash cctxt ~chain ~block () >>=? fun hash -> + inject_endorsement cctxt ~chain ?async block hash level src_sk slots src_pkh >>=? fun oph -> Client_keys.get_key cctxt src_pkh >>=? fun (name, _pk, _sk) -> cctxt#message "Injected endorsement level %a, contract %s '%a'" @@ -173,7 +173,7 @@ let endorse_for_delegate cctxt { delegate ; block ; slots ; } = Raw_level.pp level (List.length slots) >>= fun () -> inject_endorsement cctxt - b level + b hash level sk slots delegate >>=? fun oph -> lwt_log_info "Injected endorsement for block '%a' \ @@ -182,7 +182,7 @@ let endorse_for_delegate cctxt { delegate ; block ; slots ; } = Raw_level.pp level name Operation_hash.pp_short oph >>= fun () -> - cctxt#message + lwt_log_info "Injected endorsement level %a, contract %s '%a'" Raw_level.pp level name