diff --git a/src/node/net/p2p_connection_pool.ml b/src/node/net/p2p_connection_pool.ml index 06e5bf776..61d8e9684 100644 --- a/src/node/net/p2p_connection_pool.ml +++ b/src/node/net/p2p_connection_pool.ml @@ -768,12 +768,20 @@ and authenticate pool ?point_info canceler fd point = ?listening_port:pool.config.listening_port pool.config.identity pool.message_config.versions end ~on_error: begin fun err -> - (* Authentication incorrect! *) (* TODO do something when the error is Not_enough_proof_of_work ?? *) - lwt_debug "@[authenticate: %a%s -> failed@ %a@]" - Point.pp point - (if incoming then " incoming" else "") - pp_print_error err >>= fun () -> + begin match err with + | [ Lwt_utils.Canceled ] -> + (* Currently only on time out *) + lwt_debug "authenticate: %a%s -> canceled" + Point.pp point + (if incoming then " incoming" else "") + | err -> + (* Authentication incorrect! *) + lwt_debug "@[authenticate: %a%s -> failed@ %a@]" + Point.pp point + (if incoming then " incoming" else "") + pp_print_error err + end >>= fun () -> may_register_my_id_point pool err ; log pool (Authentication_failed point) ; if incoming then diff --git a/src/node/shell/bootstrap_pipeline.ml b/src/node/shell/bootstrap_pipeline.ml index da5b4c2ab..0b58d75d7 100644 --- a/src/node/shell/bootstrap_pipeline.ml +++ b/src/node/shell/bootstrap_pipeline.ml @@ -90,6 +90,12 @@ let headers_fetch_worker_loop pipeline = Lwt.return_unit | Error [Exn Lwt.Canceled | Lwt_utils.Canceled | Exn Lwt_pipe.Closed] -> Lwt.return_unit + | Error [ Distributed_db.Block_header.Timeout bh ] -> + lwt_log_info "request for header %a from peer %a timed out." + Block_hash.pp_short bh + P2p.Peer_id.pp_short pipeline.peer_id >>= fun () -> + Canceler.cancel pipeline.canceler >>= fun () -> + Lwt.return_unit | Error err -> pipeline.errors <- pipeline.errors @ err ; lwt_log_error "@[Unexpected error (headers fetch):@ %a@]" @@ -128,6 +134,12 @@ let rec operations_fetch_worker_loop pipeline = | Error [Exn Lwt.Canceled | Lwt_utils.Canceled | Exn Lwt_pipe.Closed] -> Lwt_pipe.close pipeline.fetched_blocks ; Lwt.return_unit + | Error [ Distributed_db.Operations.Timeout (bh, n) ] -> + lwt_log_info "request for operations %a:%d from peer %a timed out." + Block_hash.pp_short bh n + P2p.Peer_id.pp_short pipeline.peer_id >>= fun () -> + Canceler.cancel pipeline.canceler >>= fun () -> + Lwt.return_unit | Error err -> pipeline.errors <- pipeline.errors @ err ; lwt_log_error "@[Unexpected error (operations fetch):@ %a@]" diff --git a/src/node/shell/net_validator.ml b/src/node/shell/net_validator.ml index e3dd59159..ef285db8b 100644 --- a/src/node/shell/net_validator.ml +++ b/src/node/shell/net_validator.ml @@ -198,6 +198,10 @@ and worker_loop nv = if Fitness.(block_header.shell.fitness <= head_header.shell.fitness) then + lwt_log_info "current head is better than %a %a %a, we do not switch" + Block_hash.pp_short block_hash + Fitness.pp block_header.shell.fitness + Time.pp_hum block_header.shell.timestamp >>= fun () -> return () else begin Chain.set_head nv.net_state block >>= fun previous ->