fix denom-group order
This commit is contained in:
parent
b607bf9f82
commit
58849ab89b
1 changed files with 7 additions and 10 deletions
|
|
@ -4,6 +4,9 @@ open Syntax
|
||||||
open Api
|
open Api
|
||||||
module String_map = Stdlib.Map.Make (Stdlib.String)
|
module String_map = Stdlib.Map.Make (Stdlib.String)
|
||||||
|
|
||||||
|
(* TODO
|
||||||
|
for now we only have one item in each "denom group"
|
||||||
|
change this once we have denom/signkey rotation *)
|
||||||
let denomgroup_of_denomdata
|
let denomgroup_of_denomdata
|
||||||
Denom_data.
|
Denom_data.
|
||||||
{
|
{
|
||||||
|
|
@ -100,20 +103,14 @@ let mk_keys ~db_conn (module Sm : Secmod.S) ~last_issue_date =
|
||||||
(*Pg.get_denominations db_conn |> unwrap_err_caqti *)
|
(*Pg.get_denominations db_conn |> unwrap_err_caqti *)
|
||||||
Sm.get_denoms_data ()
|
Sm.get_denoms_data ()
|
||||||
in
|
in
|
||||||
(* TODO check order!! *)
|
|
||||||
let denom_data_l =
|
let denom_data_l =
|
||||||
|
(* reverse chronological order *)
|
||||||
List.sort
|
List.sort
|
||||||
(fun a b ->
|
(fun a b -> Stdlib.compare b.Denom_data.stamp_start a.stamp_start)
|
||||||
let open Denom_data in
|
|
||||||
Stdlib.compare a.stamp_start b.stamp_start)
|
|
||||||
denom_data_l
|
denom_data_l
|
||||||
in
|
in
|
||||||
let list_issue_date =
|
let list_issue_date =
|
||||||
(* TODO is this the last [stamp_start] value? *)
|
match denom_data_l with [] -> None | v :: _ -> v.stamp_start
|
||||||
(* date when the denomination keys were last updated *)
|
|
||||||
match denom_data_l with
|
|
||||||
| [] -> None
|
|
||||||
| v :: _ -> v.stamp_start
|
|
||||||
in
|
in
|
||||||
let denominations =
|
let denominations =
|
||||||
(* TODO really need to understand and correctly group denoms
|
(* TODO really need to understand and correctly group denoms
|
||||||
|
|
@ -130,7 +127,7 @@ let mk_keys ~db_conn (module Sm : Secmod.S) ~last_issue_date =
|
||||||
List.sort
|
List.sort
|
||||||
(fun a b ->
|
(fun a b ->
|
||||||
let open Signkey_data in
|
let open Signkey_data in
|
||||||
Stdlib.compare a.stamp_start b.stamp_start)
|
Stdlib.compare b.stamp_start a.stamp_start)
|
||||||
signkey_data_l
|
signkey_data_l
|
||||||
in
|
in
|
||||||
List.filter_map
|
List.filter_map
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue