This commit is contained in:
swrup 2026-02-03 14:04:05 +01:00
parent 67bd144bb0
commit 382dd29ffe
3 changed files with 17 additions and 21 deletions

View file

@ -190,7 +190,7 @@ let mk_keys ~db_conn (module Sm : Secmod.S) ~last_issue_date =
sign_f ~f:(Sm.sign_with_signkey ~pub:exchange_pub) R.{ list_issue_date; hc } sign_f ~f:(Sm.sign_with_signkey ~pub:exchange_pub) R.{ list_issue_date; hc }
in in
let recoup = [] in let recoup = (* todo /recoup *) [] in
let global_fees = (* TODO *) [] in let global_fees = (* TODO *) [] in
let auditors = (* TODO *) [] in let auditors = (* TODO *) [] in
let extensions = None in let extensions = None in

View file

@ -303,7 +303,7 @@ module Auditors = struct
let auditor_pub = v.AuditorSetupMessage.auditor_pub in let auditor_pub = v.AuditorSetupMessage.auditor_pub in
let validity_start = v.AuditorSetupMessage.validity_start in let validity_start = v.AuditorSetupMessage.validity_start in
let* last_date_opt = let* last_date_opt =
Pg.lookup_auditor_timestamp db_conn auditor_pub |> unwrap_err_caqti Pg.get_auditor_timestamp db_conn auditor_pub |> unwrap_err_caqti
in in
match last_date_opt with match last_date_opt with
| None -> | None ->
@ -341,7 +341,7 @@ module Auditors_disable = struct
let do_ ~db_conn auditor_pub let do_ ~db_conn auditor_pub
AuditorTeardownMessage.{ master_sig= _; validity_end } = AuditorTeardownMessage.{ master_sig= _; validity_end } =
let* last_date_opt = let* last_date_opt =
Pg.lookup_auditor_timestamp db_conn auditor_pub |> unwrap_err_caqti Pg.get_auditor_timestamp db_conn auditor_pub |> unwrap_err_caqti
in in
match last_date_opt with match last_date_opt with
| None -> Error "auditor not found" | None -> Error "auditor not found"
@ -460,7 +460,7 @@ module Global_fees = struct
let* global_fees = let* global_fees =
let start_date = v.GlobalFees.start_date in let start_date = v.GlobalFees.start_date in
let end_date = v.GlobalFees.end_date in let end_date = v.GlobalFees.end_date in
Pg.lookup_global_fees_by_time db_conn ~start_date ~end_date Pg.get_global_fees_by_time db_conn ~start_date ~end_date
|> unwrap_err_caqti |> unwrap_err_caqti
in in
match global_fees with match global_fees with
@ -526,7 +526,7 @@ module Wire = struct
let do_ ~db_conn v = let do_ ~db_conn v =
let* last_change_opt = let* last_change_opt =
let payto_uri = v.WireSetupMessage.payto_uri in let payto_uri = v.WireSetupMessage.payto_uri in
Pg.lookup_wire_timestamp db_conn ~payto_uri |> unwrap_err_caqti Pg.get_wire_timestamp db_conn ~payto_uri |> unwrap_err_caqti
in in
match last_change_opt with match last_change_opt with
| Some _ -> Error "wire already setup" | Some _ -> Error "wire already setup"
@ -573,7 +573,7 @@ module Wire_disable = struct
let do_ ~db_conn let do_ ~db_conn
WireTeardownMessage.{ payto_uri; master_sig_del= _; validity_end } = WireTeardownMessage.{ payto_uri; master_sig_del= _; validity_end } =
let* last_change_opt = let* last_change_opt =
Pg.lookup_wire_timestamp db_conn ~payto_uri |> unwrap_err_caqti Pg.get_wire_timestamp db_conn ~payto_uri |> unwrap_err_caqti
in in
match last_change_opt with match last_change_opt with
| None -> Error "wire not found" | None -> Error "wire not found"

View file

@ -128,13 +128,13 @@ let insert_signkey_revocation =
fun (module Conn : CONN) exchange_pub master_sig -> fun (module Conn : CONN) exchange_pub master_sig ->
Conn.exec signkey_revocation_insert (exchange_pub, master_sig) Conn.exec signkey_revocation_insert (exchange_pub, master_sig)
let lookup_auditor_timestamp = let get_auditor_timestamp =
let lookup_auditor_timestamp = let get_auditor_timestamp =
Caqti_type.(eddsa_pub ->? time) Caqti_type.(eddsa_pub ->? time)
"SELECT last_change FROM auditors WHERE auditor_pub=$1" "SELECT last_change FROM auditors WHERE auditor_pub=$1"
in in
fun (module Conn : CONN) auditor_pub -> fun (module Conn : CONN) auditor_pub ->
Conn.find_opt lookup_auditor_timestamp auditor_pub Conn.find_opt get_auditor_timestamp auditor_pub
let insert_auditor = let insert_auditor =
let insert_auditor = let insert_auditor =
@ -265,14 +265,14 @@ let insert_wire_fee =
(wire_method, fee_start, fee_end, wire_fee, closing_fee, master_sig_wire) (wire_method, fee_start, fee_end, wire_fee, closing_fee, master_sig_wire)
let get_wire_fees_by_time = let get_wire_fees_by_time =
let lookup_wire_fee_by_time = let get_wire_fee_by_time =
Caqti_type.(t3 wire_method time time ->* aggregate_transfer_fee) Caqti_type.(t3 wire_method time time ->* aggregate_transfer_fee)
"SELECT (wire_fee).*, (closing_fee).*, start_date, end_date, master_sig \ "SELECT (wire_fee).*, (closing_fee).*, start_date, end_date, master_sig \
FROM wire_fee WHERE wire_method=$1 AND end_date > $2 AND start_date < \ FROM wire_fee WHERE wire_method=$1 AND end_date > $2 AND start_date < \
$3" $3"
in in
fun (module Conn : CONN) ~wire_method ~start_date ~end_date -> fun (module Conn : CONN) ~wire_method ~start_date ~end_date ->
Conn.collect_list lookup_wire_fee_by_time (wire_method, start_date, end_date) Conn.collect_list get_wire_fee_by_time (wire_method, start_date, end_date)
let get_wire_fees = let get_wire_fees =
let get_wire_fees = let get_wire_fees =
@ -293,15 +293,15 @@ let get_global_fees =
fun (module Conn : CONN) ~start_date -> fun (module Conn : CONN) ~start_date ->
Conn.collect_list get_global_fees start_date Conn.collect_list get_global_fees start_date
let lookup_global_fees_by_time = let get_global_fees_by_time =
let lookup_global_fees_by_time = let get_global_fees_by_time =
Caqti_type.(t2 time time ->* global_fee) Caqti_type.(t2 time time ->* global_fee)
"SELECT start_date, end_date, (history_fee).*, (account_fee).*, \ "SELECT start_date, end_date, (history_fee).*, (account_fee).*, \
(purse_fee).*, history_expiration, purse_account_limit, purse_timeout, \ (purse_fee).*, history_expiration, purse_account_limit, purse_timeout, \
master_sig FROM global_fee WHERE end_date > $1 AND start_date < $2" master_sig FROM global_fee WHERE end_date > $1 AND start_date < $2"
in in
fun (module Conn : CONN) ~start_date ~end_date -> fun (module Conn : CONN) ~start_date ~end_date ->
Conn.collect_list lookup_global_fees_by_time (start_date, end_date) Conn.collect_list get_global_fees_by_time (start_date, end_date)
let insert_global_fee = let insert_global_fee =
let insert_global_fee = let insert_global_fee =
@ -313,13 +313,13 @@ let insert_global_fee =
in in
fun (module Conn : CONN) v -> Conn.exec insert_global_fee v fun (module Conn : CONN) v -> Conn.exec insert_global_fee v
let lookup_wire_timestamp = let get_wire_timestamp =
let lookup_wire_timestamp = let get_wire_timestamp =
Caqti_type.(payto_uri ->? time) Caqti_type.(payto_uri ->? time)
"SELECT last_change FROM wire_accounts WHERE payto_uri=$1" "SELECT last_change FROM wire_accounts WHERE payto_uri=$1"
in in
fun (module Conn : CONN) ~payto_uri -> fun (module Conn : CONN) ~payto_uri ->
Conn.find_opt lookup_wire_timestamp payto_uri Conn.find_opt get_wire_timestamp payto_uri
let insert_wire = let insert_wire =
let insert_wire = let insert_wire =
@ -388,7 +388,3 @@ let insert_partner =
$3, $4, ($5,$6), $7, $8) ON CONFLICT DO NOTHING" $3, $4, ($5,$6), $7, $8) ON CONFLICT DO NOTHING"
in in
fun (module Conn : CONN) v -> Conn.exec insert_partner v fun (module Conn : CONN) v -> Conn.exec insert_partner v
(* TODO
get_recoup_denoms
*)