Alpha: Fix commitment bug

This commit is contained in:
Pierre Chambart 2018-06-30 02:07:33 +02:00 committed by Benjamin Canou
parent f5091bf5e6
commit f381693da8

View File

@ -7,13 +7,15 @@
(* *)
(**************************************************************************)
include Blake2B.Make(Base58)(struct
module H = Blake2B.Make(Base58)(struct
let name = "Blinded public key hash"
let title = "A blinded public key hash"
let b58check_prefix = "\001\002\049\223"
let size = Some Ed25519.Public_key_hash.size
end)
include H
let () =
Base58.check_encoded_prefix b58check_encoding "btz1" 37
@ -30,25 +32,4 @@ let activation_code_of_hex h =
invalid_arg "Blinded_public_key_hash.activation_code_of_hex" ;
MBytes.of_hex (`Hex h)
module Index = struct
type nonrec t = t
let path_length = 2
let rpc_arg = rpc_arg
let compare = compare
let encoding = encoding
let to_path bpkh l =
let `Hex h = MBytes.to_hex (to_bytes bpkh) in
String.sub h 0 2 :: String.sub h 2 (size - 2) :: l
let of_path = function
| [ h1 ; h2 ] -> of_bytes_opt (MBytes.of_hex (`Hex (h1 ^ h2)))
| _ -> None
let compare = compare
let encoding = encoding
let rpc_arg = rpc_arg
end
module Index = H