diff --git a/test/validate_response.ml b/test/validate_response.ml index 4db13e8b..b6f3a80b 100644 --- a/test/validate_response.ml +++ b/test/validate_response.ml @@ -87,37 +87,38 @@ let keys content = let* () = (* TODO O(n^2) *) v.auditors - |> list_iter + |> List.concat_map (fun AuditorKeys. { auditor_pub; auditor_url; auditor_name= _; denomination_keys } -> let auditor_url_hash = Hash.H64.hash auditor_url in denomination_keys - |> list_iter + |> List.map (fun AuditorDenominationKey.{ denom_pub_h; auditor_sig } -> - let open Denomination in - let opt = - denom_l |> List.find_opt (fun dn -> dn.h_pub = denom_pub_h) - in - match opt with - | None -> Fmt.error "auditor denomination key not found" - | Some dn -> - let open Signatures.ExchangeKeyValidity in - verify auditor_pub auditor_sig - { - auditor_url_hash; - master= auditor_pub; - start= dn.stamp_start; - expire_withdraw= dn.stamp_expire_withdraw; - expire_spend= dn.stamp_expire_deposit; - expire_legal= dn.stamp_expire_legal; - value= dn.value; - fee_withdraw= dn.fee_withdraw; - fee_deposit= dn.fee_deposit; - fee_refresh= dn.fee_refresh; - denom_hash= denom_pub_h; - })) + (denom_pub_h, auditor_url_hash, auditor_pub, auditor_sig))) + |> list_iter + (fun (denom_pub_h, auditor_url_hash, auditor_pub, auditor_sig) -> + let open Denomination in + denom_l |> List.find_opt (fun dn -> dn.h_pub = denom_pub_h) + |> function + | None -> Fmt.error "auditor denomination key not found" + | Some dn -> + let open Signatures.ExchangeKeyValidity in + verify auditor_pub auditor_sig + { + auditor_url_hash; + master= auditor_pub; + start= dn.stamp_start; + expire_withdraw= dn.stamp_expire_withdraw; + expire_spend= dn.stamp_expire_deposit; + expire_legal= dn.stamp_expire_legal; + value= dn.value; + fee_withdraw= dn.fee_withdraw; + fee_deposit= dn.fee_deposit; + fee_refresh= dn.fee_refresh; + denom_hash= dn.h_pub; + }) in Ok ()