~ HashCode.to_denomination_hash

This commit is contained in:
swrup 2025-12-07 08:11:11 +01:00
parent cf20d60bb6
commit 32fa5b1fc3
2 changed files with 4 additions and 11 deletions

View file

@ -69,14 +69,12 @@ module HashCode : sig
type t
val hash : string -> t
val to_octets : t -> string
val to_denomination_hash : t -> Bin_type.DenominationHash.t
val jsont : t Jsont.t
end = struct
type t = B32.t
(* TODO rm
for convertion to DenominationHash *)
let to_octets s = s
let to_denomination_hash s = Bin_type.DenominationHash.of_octets s
let hash s =
let open Digestif.SHA512 in

View file

@ -99,9 +99,7 @@ let mk_future_keys_response ~(sm_signkey : Secmod_signkey.t)
let verify_denom_signature ~sm_denom DenomSignature.{ h_denom_pub; master_sig }
=
let open Syntax in
let denom_hash =
Bin_type.DenominationHash.of_octets (HashCode.to_octets h_denom_pub)
in
let denom_hash = HashCode.to_denomination_hash h_denom_pub in
let* denom =
Secmod_denom.get_denoms sm_denom
|> List.find_opt (fun (denom : Denomination.t) -> denom.h_pub = denom_hash)
@ -172,10 +170,7 @@ let update_master_signatures ~db_conn ~sm_signkey ~sm_denom
let* () =
denom_sigs
|> List.map (fun DenomSignature.{ h_denom_pub; master_sig } ->
(* TODO better denomination-hash type *)
let h_denom_pub =
Bin_type.DenominationHash.of_octets (HashCode.to_octets h_denom_pub)
in
let h_denom_pub = HashCode.to_denomination_hash h_denom_pub in
(h_denom_pub, master_sig))
|> Secmod_denom.add_master_signatures db_conn sm_denom
in