Shell: simplify operation injecion error handling
This commit is contained in:
parent
249e4564d3
commit
8a6deca8a0
@ -370,8 +370,7 @@ let on_request
|
|||||||
on_notify w pv peer mempool ;
|
on_notify w pv peer mempool ;
|
||||||
return ()
|
return ()
|
||||||
| Request.Inject op ->
|
| Request.Inject op ->
|
||||||
on_inject pv op >>= fun tzresult ->
|
on_inject pv op
|
||||||
return tzresult
|
|
||||||
| Request.Arrived (oph, op) ->
|
| Request.Arrived (oph, op) ->
|
||||||
on_operation_arrived pv oph op ;
|
on_operation_arrived pv oph op ;
|
||||||
return ()
|
return ()
|
||||||
@ -427,7 +426,9 @@ let on_launch w _ (limits, chain_db) =
|
|||||||
|
|
||||||
let on_error w r st errs =
|
let on_error w r st errs =
|
||||||
Worker.record_event w (Event.Request (r, st, Some errs)) ;
|
Worker.record_event w (Event.Request (r, st, Some errs)) ;
|
||||||
Lwt.return (Error errs)
|
match r with
|
||||||
|
| Request.(View (Inject _)) -> return ()
|
||||||
|
| _ -> Lwt.return (Error errs)
|
||||||
|
|
||||||
let on_completion w r _ st =
|
let on_completion w r _ st =
|
||||||
Worker.record_event w (Event.Request (Request.view r, st, None )) ;
|
Worker.record_event w (Event.Request (Request.view r, st, None )) ;
|
||||||
@ -485,8 +486,7 @@ let context w =
|
|||||||
Prevalidation.end_prevalidation validation_state
|
Prevalidation.end_prevalidation validation_state
|
||||||
|
|
||||||
let inject_operation w op =
|
let inject_operation w op =
|
||||||
Worker.push_request_and_wait w (Inject op) >>=? fun result ->
|
Worker.push_request_and_wait w (Inject op)
|
||||||
Lwt.return result
|
|
||||||
|
|
||||||
let status = Worker.status
|
let status = Worker.status
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ module Request = struct
|
|||||||
type 'a t =
|
type 'a t =
|
||||||
| Flush : Block_hash.t -> unit t
|
| Flush : Block_hash.t -> unit t
|
||||||
| Notify : P2p_peer.Id.t * Mempool.t -> unit t
|
| Notify : P2p_peer.Id.t * Mempool.t -> unit t
|
||||||
| Inject : Operation.t -> unit tzresult t
|
| Inject : Operation.t -> unit t
|
||||||
| Arrived : Operation_hash.t * Operation.t -> unit t
|
| Arrived : Operation_hash.t * Operation.t -> unit t
|
||||||
| Advertise : unit t
|
| Advertise : unit t
|
||||||
type view = View : _ t -> view
|
type view = View : _ t -> view
|
||||||
|
@ -11,7 +11,7 @@ module Request : sig
|
|||||||
type 'a t =
|
type 'a t =
|
||||||
| Flush : Block_hash.t -> unit t
|
| Flush : Block_hash.t -> unit t
|
||||||
| Notify : P2p_peer.Id.t * Mempool.t -> unit t
|
| Notify : P2p_peer.Id.t * Mempool.t -> unit t
|
||||||
| Inject : Operation.t -> unit tzresult t
|
| Inject : Operation.t -> unit t
|
||||||
| Arrived : Operation_hash.t * Operation.t -> unit t
|
| Arrived : Operation_hash.t * Operation.t -> unit t
|
||||||
| Advertise : unit t
|
| Advertise : unit t
|
||||||
type view = View : _ t -> view
|
type view = View : _ t -> view
|
||||||
|
Loading…
Reference in New Issue
Block a user