From 10d1b08c85e864dc05d69de9a17a789cf1c17ad4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Henry?= Date: Mon, 20 Nov 2017 03:54:54 +0100 Subject: [PATCH] Validator: do not try to validate twice an invalid block --- src/node/shell/block_validator.ml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/node/shell/block_validator.ml b/src/node/shell/block_validator.ml index 8fde1d365..e14d38d07 100644 --- a/src/node/shell/block_validator.ml +++ b/src/node/shell/block_validator.ml @@ -457,6 +457,7 @@ let rec worker_loop bv = | Request_validation { net_db ; notify_new_block ; canceler ; peer ; hash ; header ; operations } -> let net_state = Distributed_db.net_state net_db in + State.Block.known_invalid net_state hash >>= fun invalid -> State.Block.read_opt net_state hash >>= function | Some block -> lwt_debug "previously validated block %a (after pipe)" @@ -467,6 +468,9 @@ let rec worker_loop bv = block ; may_wakeup (Ok block) ; return () + | None when invalid -> + may_wakeup (Error [(* TODO commit error and read back*)]) ; + return () | None -> begin lwt_debug "validating block %a"