Validator: always log invalid block
This commit is contained in:
parent
471006b2dd
commit
8f30934220
@ -457,7 +457,6 @@ 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)"
|
||||
@ -468,8 +467,10 @@ let rec worker_loop bv =
|
||||
block ;
|
||||
may_wakeup (Ok block) ;
|
||||
return ()
|
||||
| None when invalid ->
|
||||
may_wakeup (Error [(* TODO commit error and read back*)]) ;
|
||||
| None ->
|
||||
State.Block.read_invalid net_state hash >>= function
|
||||
| Some { errors } ->
|
||||
may_wakeup (Error errors) ;
|
||||
return ()
|
||||
| None ->
|
||||
begin
|
||||
@ -509,6 +510,9 @@ let rec worker_loop bv =
|
||||
may_wakeup err ;
|
||||
return ()
|
||||
| Error errors as err ->
|
||||
lwt_log_error "@[<v 2>Received invalid block %a:@ %a@]"
|
||||
Block_hash.pp_short hash
|
||||
Error_monad.pp_print_error errors >>= fun () ->
|
||||
Lwt_utils.protect ~canceler:bv.canceler begin fun () ->
|
||||
Distributed_db.commit_invalid_block
|
||||
net_db hash header errors
|
||||
|
Loading…
Reference in New Issue
Block a user