2016-09-08 21:13:10 +04:00
|
|
|
(**************************************************************************)
|
|
|
|
(* *)
|
2017-11-14 03:36:14 +04:00
|
|
|
(* Copyright (c) 2014 - 2017. *)
|
2016-09-08 21:13:10 +04:00
|
|
|
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
|
|
|
|
(* *)
|
|
|
|
(* All rights reserved. No warranty, explicit or implicit, provided. *)
|
|
|
|
(* *)
|
|
|
|
(**************************************************************************)
|
|
|
|
|
2017-11-07 20:38:11 +04:00
|
|
|
let run (cctxt : Client_commands.full_context) ?max_priority ~delay ?min_date delegates ~endorsement ~denunciation ~baking =
|
2016-09-08 21:13:10 +04:00
|
|
|
(* TODO really detach... *)
|
|
|
|
let endorsement =
|
2017-09-19 13:31:35 +04:00
|
|
|
if endorsement then
|
2017-11-01 15:07:33 +04:00
|
|
|
Client_baking_blocks.monitor
|
2017-11-07 20:38:11 +04:00
|
|
|
cctxt ?min_date ~min_heads:1 () >>=? fun block_stream ->
|
2017-11-01 15:07:33 +04:00
|
|
|
Client_baking_endorsement.create cctxt ~delay delegates block_stream >>= fun () ->
|
2017-04-05 01:35:41 +04:00
|
|
|
return ()
|
2016-09-08 21:13:10 +04:00
|
|
|
else
|
2017-04-05 01:35:41 +04:00
|
|
|
return ()
|
2016-09-08 21:13:10 +04:00
|
|
|
in
|
|
|
|
let denunciation =
|
2017-09-19 13:31:35 +04:00
|
|
|
if denunciation then
|
2017-11-01 15:07:33 +04:00
|
|
|
Client_baking_operations.monitor_endorsement
|
2017-11-07 20:38:11 +04:00
|
|
|
cctxt >>=? fun endorsement_stream ->
|
2017-11-01 15:07:33 +04:00
|
|
|
Client_baking_denunciation.create cctxt endorsement_stream >>= fun () ->
|
2017-04-05 01:35:41 +04:00
|
|
|
return ()
|
2016-09-08 21:13:10 +04:00
|
|
|
else
|
2017-04-05 01:35:41 +04:00
|
|
|
return ()
|
2016-09-08 21:13:10 +04:00
|
|
|
in
|
|
|
|
let forge =
|
2017-11-01 15:07:33 +04:00
|
|
|
if baking then begin
|
|
|
|
Client_baking_blocks.monitor
|
2017-11-07 20:38:11 +04:00
|
|
|
cctxt ?min_date ~min_heads:1 () >>=? fun block_stream ->
|
2017-11-01 15:07:33 +04:00
|
|
|
Client_baking_operations.monitor_endorsement
|
2017-11-07 20:38:11 +04:00
|
|
|
cctxt >>=? fun endorsement_stream ->
|
2017-11-01 15:07:33 +04:00
|
|
|
Client_baking_forge.create cctxt
|
2017-04-05 01:35:41 +04:00
|
|
|
?max_priority delegates block_stream endorsement_stream >>=? fun () ->
|
|
|
|
return ()
|
2017-03-09 17:35:43 +04:00
|
|
|
end else
|
2017-04-05 01:35:41 +04:00
|
|
|
return ()
|
2016-09-08 21:13:10 +04:00
|
|
|
in
|
2017-04-05 01:35:41 +04:00
|
|
|
denunciation >>=? fun () ->
|
|
|
|
endorsement >>=? fun () ->
|
2016-09-08 21:13:10 +04:00
|
|
|
forge
|