Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/lib/consensus/proof_of_stake.ml
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ module Make_str (A : Wire_types.Concrete) = struct
let create_epoch_ledger ~config ~context:(module Context : CONTEXT)
~genesis_epoch_ledger =
let open Context in
if Mina_ledger.Ledger.Root.Config.exists_backing config then (
if Mina_ledger.Ledger.Root.Config.exists_any_backing config then (
[%log info]
~metadata:
[ ("config", Mina_ledger.Ledger.Root.Config.to_yojson config) ]
Expand Down
6 changes: 6 additions & 0 deletions src/lib/mina_ledger/root.ml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ struct
| Converting_db_config { primary_directory; converting_directory } ->
file_exists primary_directory && file_exists converting_directory

let exists_any_backing = function
| Stable_db_config path ->
file_exists path
| Converting_db_config { primary_directory; converting_directory = _ } ->
file_exists primary_directory

let with_directory ~backing_type ~directory_name =
match backing_type with
| Stable_db ->
Expand Down
4 changes: 4 additions & 0 deletions src/lib/mina_ledger/root.mli
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ module Make
(** Test if a root ledger backing already exists with this config *)
val exists_backing : t -> bool

(** Test if a root ledger backing already exists with this config, ignoring
the specific backing type of the root *)
val exists_any_backing : t -> bool

(** Delete a backing of any type that might exist with this config, if
present. this function will try any backing type even if it didn't match
up with one provided in the config *)
Expand Down
2 changes: 1 addition & 1 deletion src/lib/mina_ledger/test/test_mina_ledger.ml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ module Root_test = struct
in
L.Root.Config.move_backing_exn ~src:config ~dst:config_moved ;
assert (
(not (L.Root.Config.exists_backing config))
(not (L.Root.Config.exists_any_backing config))
&& L.Root.Config.exists_backing config_moved
|| failwith "Config is not moved" ) ;
let root_moved =
Expand Down