aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMarcos Magueta <maguetamarcos@gmail.com>2026-09-02 23:42:52 -0300
committerMarcos Magueta <maguetamarcos@gmail.com>2026-09-02 23:42:52 -0300
commit836e1ab528379ac5e0e9151cf369628dcf1034a3 (patch)
treebb8706705591451e8771489dcb2ae4767ce992fd /lib
parent1259773fac4d7c334351c61ab8cf71231c1af4ef (diff)
downloadRNT-836e1ab528379ac5e0e9151cf369628dcf1034a3.tar.gz
RNT-836e1ab528379ac5e0e9151cf369628dcf1034a3.zip
fix initialization persistence
Diffstat (limited to 'lib')
-rw-r--r--lib/kernel/Branch.ml7
-rw-r--r--lib/kernel/BranchManager.ml7
2 files changed, 10 insertions, 4 deletions
diff --git a/lib/kernel/Branch.ml b/lib/kernel/Branch.ml
index 31442f6..f44ab6e 100644
--- a/lib/kernel/Branch.ml
+++ b/lib/kernel/Branch.ml
@@ -73,6 +73,9 @@ module Make (S : Abstract.Storage.STORAGE) = struct
let make conn =
let open Utilities.Result in
- let* empty = SI.with_transaction conn MultigroupM.empty_under in
- Ok (new branch conn { multigroups = empty; previous = None } |> Protocols.Handle.make)
+ SI.with_transaction conn (fun tx ->
+ let* empty = MultigroupM.empty_under tx in
+ let branch = { multigroups = empty; previous = None } in
+ let* _ = SI.store_blob tx (Representation.to_blob branch) in
+ Ok (new branch conn branch |> Protocols.Handle.make))
end
diff --git a/lib/kernel/BranchManager.ml b/lib/kernel/BranchManager.ml
index c1e4aef..016f75a 100644
--- a/lib/kernel/BranchManager.ml
+++ b/lib/kernel/BranchManager.ml
@@ -14,8 +14,11 @@ module Make (S : Abstract.Storage.STORAGE) = struct
let root_for tx label =
let open Utilities.Result in
let* label = S.get tx (S.Label label) in
- let label = Option.map Concepts.Hash.hash_of_blob label in
- Ok label
+ let data = Option.map (fun blob -> Concepts.Blob.bytes_of_blob blob
+ |> Bytes.to_string
+ |> Concepts.Hash.of_raw_string)
+ label in
+ Ok data
let persist_root tx label addr =
let data = Concepts.Hash.blob_of_hash addr in