Node: better error reporting in peer validator

This commit is contained in:
Pietro Abate 2017-12-13 12:08:43 +01:00 committed by Benjamin Canou
parent 054506a85f
commit 9d30a8f4bf

View File

@ -191,12 +191,13 @@ let rec worker_loop pv =
end >>= function end >>= function
| Ok () -> | Ok () ->
worker_loop pv worker_loop pv
| Error (( Unknown_ancestor | Error ((( Unknown_ancestor
| Block_locator.Invalid_locator _ | Block_locator.Invalid_locator _
| Block_validator.Invalid_block _ ) :: _) -> | Block_validator.Invalid_block _ ) :: _) as errors ) ->
(* TODO ban the peer_id... *) (* TODO ban the peer_id... *)
lwt_log_info "Terminating the validation worker for peer %a (kickban)." lwt_log_info "Terminating the validation worker for peer %a (kickban)."
P2p.Peer_id.pp_short pv.peer_id >>= fun () -> P2p.Peer_id.pp_short pv.peer_id >>= fun () ->
lwt_debug "%a" Error_monad.pp_print_error errors >>= fun () ->
Lwt_canceler.cancel pv.canceler >>= fun () -> Lwt_canceler.cancel pv.canceler >>= fun () ->
Lwt.return_unit Lwt.return_unit
| Error [Block_validator.Unavailable_protocol { protocol } ] -> begin | Error [Block_validator.Unavailable_protocol { protocol } ] -> begin