This commit is contained in:
swrup 2026-02-26 20:12:35 +01:00
parent 261cece0e3
commit af2f365741
2 changed files with 86 additions and 0 deletions

View file

@ -114,6 +114,9 @@ let mk_keys ~db_conn (module Keys : Keys.S) ~last_issue_date =
let* global_fees =
Pg.get_global_fees db_conn ~start_date:Timestamp.zero |> unwrap_err_caqti
in
let () =
List.iter Http_management.Global_fees.print_global_fees global_fees
in
let* auditors =
(* /auditors/$AUDITOR_PUB/$H_DENOM_PUB *)
Pg.get_auditor_keys db_conn

View file

@ -292,6 +292,88 @@ module Wire_fee = struct
end
module Global_fees = struct
let to_hex s =
let hex = Hex.of_string s in
let hex = Hex.hexdump_s ~print_row_numbers:false ~print_chars:false hex in
hex
(*
let print_global_fees
GlobalFees.
{
start_date;
end_date;
purse_timeout;
history_expiration;
history_fee;
account_fee;
purse_fee;
purse_account_limit;
master_sig;
} =
let pp_timestamp ppf ts =
let s = Bin.to_string Timestamp.bin ts |> to_hex in
Fmt.pf ppf "%s" s
in
let pp_duration ppf d =
let s = Bin.to_string Time.TimeRelative.bin d |> to_hex in
Fmt.pf ppf "%s" s
in
let pp_amount ppf amount =
let s = Bin.to_string Amount.bin amount |> to_hex in
Fmt.pf ppf "%s" s
in
Fmt.epr
{|
{
start_date = %a;
end_date = %a;
purse_timeout = %a;
history_expiration = %a;
history_fee = %a;
account_fee = %a;
purse_fee = %a;
purse_account_limit = %lu;
master_sig = %S;
}
|}
pp_timestamp start_date pp_timestamp end_date pp_duration purse_timeout
pp_duration history_expiration pp_amount history_fee pp_amount account_fee
pp_amount purse_fee purse_account_limit
(Signatures.GlobalFees.to_octets master_sig |> to_hex);
()
*)
let print_global_fees
GlobalFees.
{
start_date;
end_date;
history_fee;
account_fee;
purse_fee;
history_expiration;
purse_account_limit;
purse_timeout;
master_sig= _;
} =
let open Signatures.GlobalFees in
let r =
{
R.start_date;
end_date;
purse_timeout;
history_expiration;
history_fee;
account_fee;
purse_fee;
purse_account_limit;
}
in
let s = Bin.to_string R.bin r in
Fmt.epr "@.%s@." (to_hex s);
()
let verify (module Keys : Keys.S)
GlobalFees.
{
@ -337,6 +419,7 @@ module Global_fees = struct
"a different global-fees was already setup for this time frame"
| true ->
Logs.info (fun m -> m "an identical global-fees was already setup");
let () = print_global_fees vv in
Ok ())
| _ ->
Error