From 471006b2dd030c2d524908a08f80944643ce6695 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Henry?= Date: Mon, 20 Nov 2017 04:01:06 +0100 Subject: [PATCH] Validator: properly handle termination of Block_validator. --- src/node/shell/bootstrap_pipeline.ml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/node/shell/bootstrap_pipeline.ml b/src/node/shell/bootstrap_pipeline.ml index ce9fba01e..da5b4c2ab 100644 --- a/src/node/shell/bootstrap_pipeline.ml +++ b/src/node/shell/bootstrap_pipeline.ml @@ -144,11 +144,13 @@ let rec validation_worker_loop pipeline = lwt_log_info "requesting validation for block %a from peer %a." Block_hash.pp_short hash P2p.Peer_id.pp_short pipeline.peer_id >>= fun () -> - Block_validator.validate - ~canceler:pipeline.canceler - ~notify_new_block:pipeline.notify_new_block - pipeline.block_validator - pipeline.net_db hash header operations >>=? fun _block -> + Lwt_utils.protect ~canceler:pipeline.canceler begin fun () -> + Block_validator.validate + ~canceler:pipeline.canceler + ~notify_new_block:pipeline.notify_new_block + pipeline.block_validator + pipeline.net_db hash header operations + end >>=? fun _block -> lwt_log_info "validated block %a from peer %a." Block_hash.pp_short hash P2p.Peer_id.pp_short pipeline.peer_id >>= fun () ->