Shell/mempool: handle failure to re-instantiate prevalidator
When the protocol changes, the prevalidator is re-instantiated. In case this fails, the old-prevalidator still needs to be shutdown.
This commit is contained in:
parent
cd25bb4160
commit
c02a970a28
@ -301,13 +301,17 @@ let on_request (type a) w spawn_child (req : a Request.t) : a tzresult Lwt.t =
|
||||
let (limits, chain_db) = Prevalidator.parameters old_prevalidator in
|
||||
(* TODO inject in the new prevalidator the operation
|
||||
from the previous one. *)
|
||||
Prevalidator.create
|
||||
limits
|
||||
(module Proto)
|
||||
chain_db >>=? fun prevalidator ->
|
||||
nv.prevalidator <- Some prevalidator ;
|
||||
Prevalidator.shutdown old_prevalidator >>= fun () ->
|
||||
return_unit
|
||||
Prevalidator.create limits (module Proto) chain_db >>= function
|
||||
| Error errs ->
|
||||
Log.lwt_log_error "@[Failed to reinstantiate prevalidator:@ %a@]"
|
||||
pp_print_error errs >>= fun () ->
|
||||
nv.prevalidator <- None ;
|
||||
Prevalidator.shutdown old_prevalidator >>= fun () ->
|
||||
return_unit
|
||||
| Ok prevalidator ->
|
||||
nv.prevalidator <- Some prevalidator ;
|
||||
Prevalidator.shutdown old_prevalidator >>= fun () ->
|
||||
return_unit
|
||||
end else begin
|
||||
Prevalidator.flush old_prevalidator block_hash >>=? fun () ->
|
||||
return_unit
|
||||
|
Loading…
Reference in New Issue
Block a user