Alpha/Daemons: enforce waiting for a bootstrapped node before starting daemons

This commit is contained in:
Vincent Botbol 2018-08-22 16:54:05 +02:00 committed by Grégoire Henry
parent 1cabf7763f
commit 9d20295a2b
No known key found for this signature in database
GPG Key ID: 50D984F20BD445D2

View File

@ -23,9 +23,16 @@
(* *)
(*****************************************************************************)
let await_bootstrapped_node (cctxt: #Proto_alpha.full) =
(* Waiting for the node to be synchronized *)
cctxt#message "Waiting for the node to be synchronized with the its \
peers..." >>= fun () ->
Shell_services.Monitor.bootstrapped cctxt
module Endorser = struct
let run (cctxt : #Proto_alpha.full) ~delay ?min_date delegates =
await_bootstrapped_node cctxt >>=? fun _ ->
Client_baking_blocks.monitor_heads
~next_protocols:(Some [Proto_alpha.hash])
cctxt `Main >>=? fun block_stream ->
@ -38,6 +45,7 @@ end
module Baker = struct
let run (cctxt : #Proto_alpha.full) ?fee_threshold ?max_priority ?min_date ~context_path delegates =
await_bootstrapped_node cctxt >>=? fun _ ->
Client_baking_blocks.monitor_heads
~next_protocols:(Some [Proto_alpha.hash])
cctxt `Main >>=? fun block_stream ->
@ -51,6 +59,7 @@ end
module Accuser = struct
let run (cctxt : #Proto_alpha.full) ~preserved_levels =
await_bootstrapped_node cctxt >>=? fun _ ->
Client_baking_blocks.monitor_valid_blocks
~next_protocols:(Some [Proto_alpha.hash])
cctxt ~chains:[ `Main ] () >>=? fun valid_blocks_stream ->