This commit is contained in:
swrup 2025-10-07 17:28:14 +02:00
parent bc29388ef1
commit e33eac6a6f
4 changed files with 18 additions and 10 deletions

BIN
a.output Normal file

Binary file not shown.

0
b.output Normal file
View file

View file

@ -451,15 +451,23 @@ module WithdrawConfirmationPS = struct
noreveal_index: int32; noreveal_index: int32;
} }
let size = Purpose.size + HashPlanchetsP.size + int32_size (*let size = Purpose.size + HashPlanchetsP.size + int32_size*)
let purpose = Purpose.make ~size Taler_signatures.exchange_confirm_withdraw
open Bin
let bin = let bin =
let open Bin in record (fun purpose h_planchets noreveal_index ->
record (fun _urpose h_planchets noreveal_index -> (purpose, { h_planchets; noreveal_index }))
{ h_planchets; noreveal_index }) |+ field Purpose.bin (fun (purpose, _t) -> purpose)
|+ field Purpose.bin (Fun.const purpose) |+ field HashPlanchetsP.bin (fun (_p, t) -> t.h_planchets)
|+ field HashPlanchetsP.bin (fun t -> t.h_planchets) |+ field beint32 (fun (_p, t) -> t.noreveal_index)
|+ field beint32 (fun t -> t.noreveal_index)
|> sealr |> sealr
let size =
match Size.of_value (Size.size_of bin) with
| Dynamic _ | Unknown -> Fmt.failwith "size_of failure: size is not Static"
| Static n -> n
let purpose = Purpose.make ~size Taler_signatures.exchange_confirm_withdraw
let bin = map bin (fun (_p, t) -> t) (fun t -> (purpose, t))
end end

View file

@ -80,8 +80,8 @@ let () =
assert (size = size'); assert (size = size');
assert (size = 76); assert (size = 76);
(* for cmp test with signatures.c output (* for cmp test with signatures.c output *)
let raw_str = Bin.to_string bin dummy_t in let raw_str = Bin.to_string bin dummy_t in
Printf.printf "%s" raw_str; Printf.printf "%s" raw_str;
*)
() ()