From e909481457d965ffa660d2cb85600faa1fa9a81b Mon Sep 17 00:00:00 2001 From: nraymond Date: Wed, 8 Mar 2023 11:29:55 +0100 Subject: [PATCH] Proto: Fix await_protocol_activation that does not wait anymore The last release of resto has fixed a bug in which opening a stream for reading was blocking as long as the first element was not received. Unfortunately, the await_protocol_activation was built on top of this side effect blocking semantic (considering the bug as a feature). This patch fixes the problem in every concerned protocol and now waits for the first received element explicitely. --- src/proto_015_PtLimaPt/lib_delegate/node_rpc.ml | 3 ++- src/proto_016_PtMumbai/lib_delegate/node_rpc.ml | 3 ++- src/proto_alpha/lib_delegate/node_rpc.ml | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/proto_015_PtLimaPt/lib_delegate/node_rpc.ml b/src/proto_015_PtLimaPt/lib_delegate/node_rpc.ml index badb4fc204d4..18c39e031620 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/node_rpc.ml +++ b/src/proto_015_PtLimaPt/lib_delegate/node_rpc.ml @@ -206,6 +206,7 @@ let monitor_proposals cctxt ~chain () = let await_protocol_activation cctxt ~chain () = Monitor_services.heads cctxt ~next_protocols:[Protocol.hash] chain - >>=? fun (_block_stream, stop) -> + >>=? fun (block_stream, stop) -> + Lwt_stream.get block_stream >>= fun _ -> stop () ; return_unit diff --git a/src/proto_016_PtMumbai/lib_delegate/node_rpc.ml b/src/proto_016_PtMumbai/lib_delegate/node_rpc.ml index 754e96117c11..a0c9cb5f2454 100644 --- a/src/proto_016_PtMumbai/lib_delegate/node_rpc.ml +++ b/src/proto_016_PtMumbai/lib_delegate/node_rpc.ml @@ -278,6 +278,7 @@ let monitor_heads cctxt ~chain ?cache () = let await_protocol_activation cctxt ~chain () = Monitor_services.heads cctxt ~next_protocols:[Protocol.hash] chain - >>=? fun (_block_stream, stop) -> + >>=? fun (block_stream, stop) -> + Lwt_stream.get block_stream >>= fun _ -> stop () ; return_unit diff --git a/src/proto_alpha/lib_delegate/node_rpc.ml b/src/proto_alpha/lib_delegate/node_rpc.ml index 754e96117c11..a0c9cb5f2454 100644 --- a/src/proto_alpha/lib_delegate/node_rpc.ml +++ b/src/proto_alpha/lib_delegate/node_rpc.ml @@ -278,6 +278,7 @@ let monitor_heads cctxt ~chain ?cache () = let await_protocol_activation cctxt ~chain () = Monitor_services.heads cctxt ~next_protocols:[Protocol.hash] chain - >>=? fun (_block_stream, stop) -> + >>=? fun (block_stream, stop) -> + Lwt_stream.get block_stream >>= fun _ -> stop () ; return_unit -- GitLab