add update_master_signatures

This commit is contained in:
swrup 2025-12-07 01:02:54 +01:00
parent 0d17d2a675
commit e9b7142412
11 changed files with 93 additions and 38 deletions

View file

@ -12,12 +12,18 @@ let get_denoms t =
Miou.Mutex.protect t.lock @@ fun () ->
Hashtbl.to_seq_values t.denom_ht |> List.of_seq
(* TODO *)
let update_denoms _conn t denoms =
let add_master_signatures conn t l =
Miou.Mutex.protect t.lock @@ fun () ->
List.iter
(fun denom -> Hashtbl.replace t.denom_ht denom.Denomination.h_pub denom)
denoms
list_iter
(fun (h_denom_pub, master_sig) ->
match Hashtbl.find_opt t.denom_ht h_denom_pub with
| None -> Error "secmod_denom failure: denomination hash not found."
| Some denom ->
let denom = { denom with master_sig= Some master_sig } in
let* () = Pg.add_denomination_key conn denom |> unwrap_err_caqti in
Hashtbl.replace t.denom_ht h_denom_pub denom;
Ok ())
l
let dir = Fpath.(v "data" / "secmod_signkey")