offline tool: add enable/disable-auditor cmd
.
This commit is contained in:
parent
ac4058df7e
commit
6ee1a994ad
14 changed files with 330 additions and 242 deletions
38
src/pg.ml
38
src/pg.ml
|
|
@ -11,7 +11,9 @@
|
|||
|
||||
transaction
|
||||
|
||||
should check validity of signatures got from db, for /management at least *)
|
||||
should check validity of signatures got from db, for /management at least
|
||||
|
||||
clean up caqti error type *)
|
||||
(* TODO time
|
||||
fix comparison with timestamp footgun *)
|
||||
|
||||
|
|
@ -186,39 +188,21 @@ let insert_auditor_denom_sig =
|
|||
fun (module Conn : CONN) ~auditor_pub ~h_denom_pub ~auditor_sig ->
|
||||
Conn.exec insert_auditor_denom_sig (auditor_pub, h_denom_pub, auditor_sig)
|
||||
|
||||
let _get_auditors =
|
||||
let get_auditors =
|
||||
Caqti_type.(unit ->* t3 eddsa_pub string string)
|
||||
"SELECT auditor_pub, auditor_url, auditor_name FROM auditors WHERE \
|
||||
is_active"
|
||||
in
|
||||
fun (module Conn : CONN) () -> Conn.collect_list get_auditors ()
|
||||
|
||||
let _get_auditor_denoms =
|
||||
let get_auditor_denoms =
|
||||
let auditor_sig = Bin_sig.ExchangeKeyValidity.caqti in
|
||||
Caqti_type.(unit ->* t3 eddsa_pub denomination_hash auditor_sig)
|
||||
"SELECT auditors.auditor_pub, denominations.denom_pub_hash, \
|
||||
auditor_denom_sigs.auditor_sig FROM auditor_denom_sigs JOIN auditors \
|
||||
USING (auditor_uuid) JOIN denominations USING (denominations_serial) \
|
||||
WHERE auditors.is_active"
|
||||
in
|
||||
fun (module Conn : CONN) () -> Conn.collect_list get_auditor_denoms ()
|
||||
|
||||
(* TODO
|
||||
(* todo auditors
|
||||
maybe check that url and name are unique/same for each auditor_pub
|
||||
do the ht logic out of pg.ml *)
|
||||
and do the ht logic out of pg.ml? *)
|
||||
(* this does not return auditors that are not auditing any denom *)
|
||||
let get_auditor_keys =
|
||||
let get_auditor_keys =
|
||||
let auditor_sig = Bin_sig.ExchangeKeyValidity.caqti in
|
||||
Caqti_type.(
|
||||
unit ->* t5 eddsa_pub string string denomination_hash auditor_sig)
|
||||
"SELECT auditors.auditor_pub, auditors.url, auditors.name, \
|
||||
denominations.denom_pub_hash, auditor_denom_sigs.auditor_sig FROM \
|
||||
auditor_denom_sigs JOIN auditors USING (auditor_uuid) JOIN \
|
||||
denominations USING (denominations_serial) WHERE auditors.is_active"
|
||||
"SELECT a.auditor_pub, a.auditor_url, a.auditor_name, dn.denom_pub_hash, \
|
||||
ads.auditor_sig FROM auditor_denom_sigs AS ads JOIN auditors AS a USING \
|
||||
(auditor_uuid) JOIN denominations AS dn USING (denominations_serial) \
|
||||
WHERE a.is_active"
|
||||
in
|
||||
fun (module Conn : CONN) () ->
|
||||
fun (module Conn : CONN) ->
|
||||
let open Syntax in
|
||||
let* l = Conn.collect_list get_auditor_keys () |> unwrap_err_caqti in
|
||||
let ht = Hashtbl.create 0xff in
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue