Validator: do not try to validate twice an invalid block

This commit is contained in:
Grégoire Henry 2017-11-20 03:54:54 +01:00 committed by Benjamin Canou
parent 7bed296525
commit 10d1b08c85

View File

@ -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"