diff --git a/src/binary_formats.ml b/src/binary_formats.ml index fe66ef4e..6e1e8fc2 100644 --- a/src/binary_formats.ml +++ b/src/binary_formats.ml @@ -235,7 +235,7 @@ module Purpose = struct |+ field beint32 (fun t -> t.purpose) |> sealr - let make size purpose = { size= Int32.of_int size; purpose } + let make ~size purpose = { size= Int32.of_int size; purpose } end (* This is the running SHA512-hash over all @@ -367,10 +367,8 @@ module Blinding_master_seed = MK_BASIC_32 () (* Format used for to generate the signature on a request to withdraw coins from a reserve. *) module Withdraw_request_ps = struct + (* Purpose is #TALER_SIGNATURE_WALLET_RESERVE_WITHDRAW *) type t = { - (* TODO set it in encode/decode *) - (* Purpose is #TALER_SIGNATURE_WALLET_RESERVE_WITHDRAW *) - purpose: Purpose.t; (* Amount to withdraw, excluding fees, i.e. the total sum of the denominations of the coins. Note that the reserve must have a value of at least amount+fee. *) @@ -419,20 +417,14 @@ module Withdraw_request_ps = struct + int32_size + Age_mask.size + let purpose = Purpose.make ~size Taler_signatures.wallet_reserve_withdraw + let bin = let open Bin in record - (fun purpose amount fee h_planchets blinding_seed max_age_group mask -> - { - purpose; - amount; - fee; - h_planchets; - blinding_seed; - max_age_group; - mask; - }) - |+ field Purpose.bin (fun t -> t.purpose) + (fun _purpose amount fee h_planchets blinding_seed max_age_group mask -> + { amount; fee; h_planchets; blinding_seed; max_age_group; mask }) + |+ field Purpose.bin (Fun.const purpose) |+ field Amount.bin (fun t -> t.amount) |+ field Amount.bin (fun t -> t.fee) |+ field Hash_planchets_p.bin (fun t -> t.h_planchets) @@ -462,7 +454,7 @@ module Withdraw_confirmation_ps = struct } let size = Purpose.size + Hash_planchets_p.size + int32_size - let purpose = Purpose.make size Taler_signatures.exchange_confirm_withdraw + let purpose = Purpose.make ~size Taler_signatures.exchange_confirm_withdraw let bin = let open Bin in