Mempool_worker: only introduce errors where they are needed
This commit is contained in:
parent
f593677e99
commit
481772fc98
@ -481,13 +481,13 @@ module Make(Proto: Registered_protocol.T) : T with module Proto = Proto = struct
|
||||
(* this function update the internal state of the worker *)
|
||||
let validate_helper w parsed_op =
|
||||
let state = Worker.state w in
|
||||
apply_operation state parsed_op >>= fun (validation_state,result) ->
|
||||
apply_operation state parsed_op >>= fun (validation_state, result) ->
|
||||
begin
|
||||
match validation_state with
|
||||
| Some validation_state -> state.validation_state <- validation_state
|
||||
| None -> ()
|
||||
end ;
|
||||
return result
|
||||
Lwt.return result
|
||||
|
||||
let notify_helper w result { Operation.shell ; proto } =
|
||||
let state = Worker.state w in
|
||||
@ -503,12 +503,12 @@ module Make(Proto: Registered_protocol.T) : T with module Proto = Proto = struct
|
||||
let state = Worker.state w in
|
||||
match Cache.find_validated_opt state.cache parsed_op with
|
||||
| None | Some (Branch_delayed _) ->
|
||||
validate_helper w parsed_op >>=? fun result ->
|
||||
validate_helper w parsed_op >>= fun result ->
|
||||
Cache.add_validated state.cache parsed_op result;
|
||||
(* operations are notified only the first time *)
|
||||
notify_helper w result parsed_op.raw ;
|
||||
return result
|
||||
| Some result -> return result
|
||||
Lwt.return result
|
||||
| Some result -> Lwt.return result
|
||||
|
||||
let on_parse w raw_op =
|
||||
let state = Worker.state w in
|
||||
@ -524,7 +524,7 @@ module Make(Proto: Registered_protocol.T) : T with module Proto = Proto = struct
|
||||
type r. t -> r Request.t -> r tzresult Lwt.t = fun w request ->
|
||||
match request with
|
||||
| Request.Parse raw_op -> on_parse w raw_op
|
||||
| Request.Validate parsed_op -> on_validate w parsed_op
|
||||
| Request.Validate parsed_op -> on_validate w parsed_op >>= return
|
||||
|
||||
let on_launch (_ : t) (_ : Name.t) ( { chain_db ; validation_state } as parameters ) =
|
||||
let chain_state = Distributed_db.chain_state chain_db in
|
||||
|
Loading…
Reference in New Issue
Block a user