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
|
~peer:pv.peer_id
|
||||||
~timeout:pv.parameters.limits.protocol_timeout
|
~timeout:pv.parameters.limits.protocol_timeout
|
||||||
protocol >>= function
|
protocol >>= function
|
||||||
| Ok _ -> return ()
|
| Ok _ ->
|
||||||
|
Distributed_db.Request.current_head
|
||||||
|
pv.parameters.chain_db ~peer:pv.peer_id () ;
|
||||||
|
return ()
|
||||||
| Error _ ->
|
| Error _ ->
|
||||||
(* TODO: punish *)
|
(* TODO: punish *)
|
||||||
debug w
|
debug w
|
||||||
|
@ -119,8 +119,14 @@ let fetch_and_compile_protocol pv ?peer ?timeout hash =
|
|||||||
Distributed_db.Protocol.read_opt pv.db hash >>= function
|
Distributed_db.Protocol.read_opt pv.db hash >>= function
|
||||||
| Some protocol -> return protocol
|
| Some protocol -> return protocol
|
||||||
| None ->
|
| None ->
|
||||||
lwt_log_notice "Fetching protocol %a from peer "
|
let may_print_peer ppf = function
|
||||||
Protocol_hash.pp_short hash >>= fun () ->
|
| 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 ()
|
Distributed_db.Protocol.fetch pv.db ?peer ?timeout hash ()
|
||||||
end >>=? fun protocol ->
|
end >>=? fun protocol ->
|
||||||
validate pv hash protocol >>=? fun proto ->
|
validate pv hash protocol >>=? fun proto ->
|
||||||
|
Loading…
Reference in New Issue
Block a user