Shell: faster propagation of protocols

This commit is contained in:
Grégoire Henry 2018-06-02 19:06:54 +02:00 committed by Benjamin Canou
parent 1c3880519b
commit 22bf535d68
2 changed files with 12 additions and 3 deletions

View File

@ -265,7 +265,10 @@ let on_error w r st errs =
~peer:pv.peer_id
~timeout:pv.parameters.limits.protocol_timeout
protocol >>= function
| Ok _ -> return ()
| Ok _ ->
Distributed_db.Request.current_head
pv.parameters.chain_db ~peer:pv.peer_id () ;
return ()
| Error _ ->
(* TODO: punish *)
debug w

View File

@ -119,8 +119,14 @@ let fetch_and_compile_protocol pv ?peer ?timeout hash =
Distributed_db.Protocol.read_opt pv.db hash >>= function
| Some protocol -> return protocol
| None ->
lwt_log_notice "Fetching protocol %a from peer "
Protocol_hash.pp_short hash >>= fun () ->
let may_print_peer ppf = function
| None -> ()
| Some peer ->
Format.fprintf ppf " from peer %a"
P2p_peer.Id.pp peer in
lwt_log_notice "Fetching protocol %a%a"
Protocol_hash.pp_short hash
may_print_peer peer >>= fun () ->
Distributed_db.Protocol.fetch pv.db ?peer ?timeout hash ()
end >>=? fun protocol ->
validate pv hash protocol >>=? fun proto ->