Alpha/baker: wait for first block instead of error
This commit is contained in:
parent
34aeaadb73
commit
46de116fe7
@ -687,11 +687,16 @@ let create
|
|||||||
?max_priority
|
?max_priority
|
||||||
(delegates: public_key_hash list)
|
(delegates: public_key_hash list)
|
||||||
(block_stream: Client_baking_blocks.block_info tzresult Lwt_stream.t) =
|
(block_stream: Client_baking_blocks.block_info tzresult Lwt_stream.t) =
|
||||||
|
let rec wait_for_first_block () =
|
||||||
Lwt_stream.get block_stream >>= function
|
Lwt_stream.get block_stream >>= function
|
||||||
| None | Some (Error _) ->
|
| None | Some (Error _) ->
|
||||||
cctxt#error "Can't fetch the current block head."
|
cctxt#message "Can't fetch the current block head. Retrying soon." >>= fun () ->
|
||||||
|
(* NOTE: this is not a tight loop because of Lwt_stream.get *)
|
||||||
|
wait_for_first_block ()
|
||||||
| Some (Ok bi) ->
|
| Some (Ok bi) ->
|
||||||
create
|
create
|
||||||
cctxt ?max_priority delegates
|
cctxt ?max_priority delegates
|
||||||
block_stream bi
|
block_stream bi
|
||||||
|
in
|
||||||
|
wait_for_first_block ()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user