Alpha/Endorser: less RPC calls
This commit is contained in:
parent
669b1b02e7
commit
1d1bd2f7d1
@ -74,9 +74,8 @@ let get_signing_slots cctxt ?(chain = `Main) block delegate level =
|
|||||||
|
|
||||||
let inject_endorsement
|
let inject_endorsement
|
||||||
(cctxt : #Proto_alpha.full)
|
(cctxt : #Proto_alpha.full)
|
||||||
?(chain = `Main) block level ?async
|
?(chain = `Main) block hash level ?async
|
||||||
src_sk slots pkh =
|
src_sk slots pkh =
|
||||||
Shell_services.Blocks.hash cctxt ~chain ~block () >>=? fun hash ->
|
|
||||||
Alpha_services.Forge.endorsement cctxt
|
Alpha_services.Forge.endorsement cctxt
|
||||||
(chain, block)
|
(chain, block)
|
||||||
~branch:hash
|
~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
|
| [] -> cctxt#error "No slot found at level %a" Raw_level.pp level
|
||||||
| slots -> return slots
|
| slots -> return slots
|
||||||
end >>=? fun 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) ->
|
Client_keys.get_key cctxt src_pkh >>=? fun (name, _pk, _sk) ->
|
||||||
cctxt#message
|
cctxt#message
|
||||||
"Injected endorsement level %a, contract %s '%a'"
|
"Injected endorsement level %a, contract %s '%a'"
|
||||||
@ -173,7 +173,7 @@ let endorse_for_delegate cctxt { delegate ; block ; slots ; } =
|
|||||||
Raw_level.pp level
|
Raw_level.pp level
|
||||||
(List.length slots) >>= fun () ->
|
(List.length slots) >>= fun () ->
|
||||||
inject_endorsement cctxt
|
inject_endorsement cctxt
|
||||||
b level
|
b hash level
|
||||||
sk slots delegate >>=? fun oph ->
|
sk slots delegate >>=? fun oph ->
|
||||||
lwt_log_info
|
lwt_log_info
|
||||||
"Injected endorsement for block '%a' \
|
"Injected endorsement for block '%a' \
|
||||||
@ -182,7 +182,7 @@ let endorse_for_delegate cctxt { delegate ; block ; slots ; } =
|
|||||||
Raw_level.pp level
|
Raw_level.pp level
|
||||||
name
|
name
|
||||||
Operation_hash.pp_short oph >>= fun () ->
|
Operation_hash.pp_short oph >>= fun () ->
|
||||||
cctxt#message
|
lwt_log_info
|
||||||
"Injected endorsement level %a, contract %s '%a'"
|
"Injected endorsement level %a, contract %s '%a'"
|
||||||
Raw_level.pp level
|
Raw_level.pp level
|
||||||
name
|
name
|
||||||
|
Loading…
Reference in New Issue
Block a user