Shell: faster propagation of protocols
This commit is contained in:
parent
1c3880519b
commit
22bf535d68
@ -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
|
||||
|
@ -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 ->
|
||||
|
Loading…
Reference in New Issue
Block a user