This commit is contained in:
swrup 2025-12-07 03:56:00 +01:00
parent 0c8ea5ba65
commit 17f454ae10
2 changed files with 26 additions and 3 deletions

View file

@ -110,9 +110,11 @@ let lookup_denomination_key =
Caqti_type.( Caqti_type.(
denomination_hash denomination_hash
->? t10 time time time time amount amount amount amount amount age_mask) ->? t10 time time time time amount amount amount amount amount age_mask)
"SELECT valid_from, expire_withdraw, expire_deposit, expire_legal, coin, \ "SELECT valid_from, expire_withdraw, expire_deposit, expire_legal, \
fee_withdraw, fee_deposit, fee_refresh, fee_refund, age_mask FROM \ coin::taler_amount, fee_withdraw::taler_amount, \
denominations WHERE denom_pub_hash=$1" fee_deposit::taler_amount, fee_refresh::taler_amount, \
fee_refund::taler_amount, age_mask FROM denominations WHERE \
denom_pub_hash=$1"
in in
fun (module Conn : CONN) (h_denom_pub : DenominationHash.t) -> fun (module Conn : CONN) (h_denom_pub : DenominationHash.t) ->
Conn.find_opt lookup_denomination_key h_denom_pub Conn.find_opt lookup_denomination_key h_denom_pub

View file

@ -12,6 +12,8 @@ let get_denoms t =
Miou.Mutex.protect t.lock @@ fun () -> Miou.Mutex.protect t.lock @@ fun () ->
Hashtbl.to_seq_values t.denom_ht |> List.of_seq Hashtbl.to_seq_values t.denom_ht |> List.of_seq
[@@@ocaml.warning "-27"]
let add_master_signatures conn t l = let add_master_signatures conn t l =
Miou.Mutex.protect t.lock @@ fun () -> Miou.Mutex.protect t.lock @@ fun () ->
list_iter list_iter
@ -22,6 +24,25 @@ let add_master_signatures conn t l =
let denom = { denom with master_sig= Some master_sig } in let denom = { denom with master_sig= Some master_sig } in
let* () = Pg.add_denomination_key conn denom |> unwrap_err_caqti in let* () = Pg.add_denomination_key conn denom |> unwrap_err_caqti in
Hashtbl.replace t.denom_ht h_denom_pub denom; Hashtbl.replace t.denom_ht h_denom_pub denom;
let* ( valid_from,
expire_withdraw,
expire_deposit,
expire_legal,
coin,
fee_withdraw,
fee_deposit,
fee_refresh,
fee_refund,
age_mask ) =
Pg.lookup_denomination_key conn h_denom_pub
|> unwrap_err_caqti
|> Result.map Option.get
in
(*
assert (valid_from = denom.stamp_start);
assert (coin = denom.value);
assert (age_mask = denom.age_mask);
*)
Ok ()) Ok ())
l l