diff --git a/src/api.ml b/src/api.ml index 420d9f9c..e1f36ddc 100644 --- a/src/api.ml +++ b/src/api.ml @@ -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 diff --git a/src/management.ml b/src/management.ml index 4e51d434..2f6d19f4 100644 --- a/src/management.ml +++ b/src/management.ml @@ -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