Skip to content

Commit 14bc0c8

Browse files
committed
Add assert_synced to root creation
1 parent 679bcb5 commit 14bc0c8

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

src/lib/mina_ledger/root.ml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,14 +172,14 @@ struct
172172
| Converting_db db ->
173173
Converting_ledger.merkle_root db
174174

175-
let create ~logger ~config ~depth () =
175+
let create ~logger ~config ~depth ?(assert_synced = false) () =
176176
match config with
177177
| Config.Stable_db_config directory_name ->
178178
Stable_db (Stable_db.create ~directory_name ~depth ())
179179
| Converting_db_config config ->
180180
Converting_db
181181
(Converting_ledger.create ~config:(In_directories config) ~logger
182-
~depth () )
182+
~depth ~assert_synced () )
183183

184184
let create_temporary ~logger ~backing_type ~depth () =
185185
match backing_type with
@@ -230,7 +230,8 @@ struct
230230
[empty_hardfork_db]. The accounts are set in the target database in chunks
231231
so the daemon is still responsive during this operation; the daemon would
232232
otherwise stop everything as it hashed every account in the list. *)
233-
let chunked_migration ?(chunk_size = 1 lsl 6) stable_locations_and_accounts empty_migrated_db =
233+
let chunked_migration ?(chunk_size = 1 lsl 6) stable_locations_and_accounts
234+
empty_migrated_db =
234235
let open Async.Deferred.Let_syntax in
235236
let ledger_depth = Migrated_db.depth empty_migrated_db in
236237
let addrs_and_accounts =

src/lib/mina_ledger/root.mli

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,13 @@ module Make
114114

115115
(** Create a root ledger backed by a single database in the given
116116
directory. *)
117-
val create : logger:Logger.t -> config:Config.t -> depth:int -> unit -> t
117+
val create :
118+
logger:Logger.t
119+
-> config:Config.t
120+
-> depth:int
121+
-> ?assert_synced:bool
122+
-> unit
123+
-> t
118124

119125
val create_temporary :
120126
logger:Logger.t
@@ -135,8 +141,7 @@ module Make
135141
(** Make a checkpoint of the root ledger [t] of the same backing type using
136142
[directory_name] as a template for its location. Return a new root ledger
137143
backed by that checkpoint. *)
138-
val create_checkpoint_with_directory :
139-
t -> directory_name:string -> t
144+
val create_checkpoint_with_directory : t -> directory_name:string -> t
140145

141146
(** Convert a root backed by a [Config.Stable_db] to *)
142147
val make_converting : t -> t Async.Deferred.t

0 commit comments

Comments
 (0)