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 ;
|
| Request_validation { net_db ; notify_new_block ; canceler ;
|
||||||
peer ; hash ; header ; operations } ->
|
peer ; hash ; header ; operations } ->
|
||||||
let net_state = Distributed_db.net_state net_db in
|
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
|
State.Block.read_opt net_state hash >>= function
|
||||||
| Some block ->
|
| Some block ->
|
||||||
lwt_debug "previously validated block %a (after pipe)"
|
lwt_debug "previously validated block %a (after pipe)"
|
||||||
@ -468,8 +467,10 @@ let rec worker_loop bv =
|
|||||||
block ;
|
block ;
|
||||||
may_wakeup (Ok block) ;
|
may_wakeup (Ok block) ;
|
||||||
return ()
|
return ()
|
||||||
| None when invalid ->
|
| None ->
|
||||||
may_wakeup (Error [(* TODO commit error and read back*)]) ;
|
State.Block.read_invalid net_state hash >>= function
|
||||||
|
| Some { errors } ->
|
||||||
|
may_wakeup (Error errors) ;
|
||||||
return ()
|
return ()
|
||||||
| None ->
|
| None ->
|
||||||
begin
|
begin
|
||||||
@ -509,6 +510,9 @@ let rec worker_loop bv =
|
|||||||
may_wakeup err ;
|
may_wakeup err ;
|
||||||
return ()
|
return ()
|
||||||
| Error errors as err ->
|
| 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 () ->
|
Lwt_utils.protect ~canceler:bv.canceler begin fun () ->
|
||||||
Distributed_db.commit_invalid_block
|
Distributed_db.commit_invalid_block
|
||||||
net_db hash header errors
|
net_db hash header errors
|
||||||
|
Loading…
Reference in New Issue
Block a user