diff options
author | Christian Grothoff <christian@grothoff.org> | 2021-07-31 21:40:48 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2021-07-31 21:40:48 +0200 |
commit | fde9dc80f6e6a5fe4c5856b2ed78e6c024528c43 (patch) | |
tree | 35d5e52652b38f75a5279fe855cc1d345fe3c1c5 | |
parent | 1d54400a025ff62ad15b77ab117ea5188884b1a1 (diff) | |
download | exchange-fde9dc80f6e6a5fe4c5856b2ed78e6c024528c43.tar.gz exchange-fde9dc80f6e6a5fe4c5856b2ed78e6c024528c43.zip |
-more json_pack cleaning
-rw-r--r-- | src/auditor/report-lib.c | 29 | ||||
-rw-r--r-- | src/auditor/report-lib.h | 20 | ||||
-rw-r--r-- | src/auditor/taler-auditor-httpd.c | 14 | ||||
-rw-r--r-- | src/auditor/taler-auditor-httpd_deposit-confirmation.c | 6 | ||||
-rw-r--r-- | src/auditor/taler-auditor-httpd_exchanges.c | 22 | ||||
-rw-r--r-- | src/auditor/taler-helper-auditor-aggregation.c | 209 | ||||
-rw-r--r-- | src/auditor/taler-helper-auditor-coins.c | 466 | ||||
-rw-r--r-- | src/auditor/taler-helper-auditor-deposits.c | 64 | ||||
-rw-r--r-- | src/auditor/taler-helper-auditor-reserves.c | 342 | ||||
-rw-r--r-- | src/auditor/taler-helper-auditor-wire.c | 569 | ||||
-rw-r--r-- | src/include/taler_json_lib.h | 26 | ||||
-rw-r--r-- | src/json/json_pack.c | 23 |
12 files changed, 902 insertions, 888 deletions
diff --git a/src/auditor/report-lib.c b/src/auditor/report-lib.c index 36baf640e..5f45d7198 100644 --- a/src/auditor/report-lib.c +++ b/src/auditor/report-lib.c | |||
@@ -114,35 +114,6 @@ TALER_ARL_do_abort (void) | |||
114 | 114 | ||
115 | 115 | ||
116 | /** | 116 | /** |
117 | * Convert absolute time to human-readable JSON string. | ||
118 | * | ||
119 | * @param at time to convert | ||
120 | * @return human-readable string representing the time | ||
121 | */ | ||
122 | json_t * | ||
123 | TALER_ARL_json_from_time_abs_nbo (struct GNUNET_TIME_AbsoluteNBO at) | ||
124 | { | ||
125 | return json_string | ||
126 | (GNUNET_STRINGS_absolute_time_to_string | ||
127 | (GNUNET_TIME_absolute_ntoh (at))); | ||
128 | } | ||
129 | |||
130 | |||
131 | /** | ||
132 | * Convert absolute time to human-readable JSON string. | ||
133 | * | ||
134 | * @param at time to convert | ||
135 | * @return human-readable string representing the time | ||
136 | */ | ||
137 | json_t * | ||
138 | TALER_ARL_json_from_time_abs (struct GNUNET_TIME_Absolute at) | ||
139 | { | ||
140 | return json_string | ||
141 | (GNUNET_STRINGS_absolute_time_to_string (at)); | ||
142 | } | ||
143 | |||
144 | |||
145 | /** | ||
146 | * Add @a object to the report @a array. Fail hard if this fails. | 117 | * Add @a object to the report @a array. Fail hard if this fails. |
147 | * | 118 | * |
148 | * @param array report array to append @a object to | 119 | * @param array report array to append @a object to |
diff --git a/src/auditor/report-lib.h b/src/auditor/report-lib.h index 05632f2dc..5df990cf5 100644 --- a/src/auditor/report-lib.h +++ b/src/auditor/report-lib.h | |||
@@ -91,26 +91,6 @@ extern struct GNUNET_TIME_Absolute start_time; | |||
91 | 91 | ||
92 | 92 | ||
93 | /** | 93 | /** |
94 | * Convert absolute time to human-readable JSON string. | ||
95 | * | ||
96 | * @param at time to convert | ||
97 | * @return human-readable string representing the time | ||
98 | */ | ||
99 | json_t * | ||
100 | TALER_ARL_json_from_time_abs_nbo (struct GNUNET_TIME_AbsoluteNBO at); | ||
101 | |||
102 | |||
103 | /** | ||
104 | * Convert absolute time to human-readable JSON string. | ||
105 | * | ||
106 | * @param at time to convert | ||
107 | * @return human-readable string representing the time | ||
108 | */ | ||
109 | json_t * | ||
110 | TALER_ARL_json_from_time_abs (struct GNUNET_TIME_Absolute at); | ||
111 | |||
112 | |||
113 | /** | ||
114 | * Add @a object to the report @a array. Fail hard if this fails. | 94 | * Add @a object to the report @a array. Fail hard if this fails. |
115 | * | 95 | * |
116 | * @param array report array to append @a object to | 96 | * @param array report array to append @a object to |
diff --git a/src/auditor/taler-auditor-httpd.c b/src/auditor/taler-auditor-httpd.c index d68ec7593..1824167fe 100644 --- a/src/auditor/taler-auditor-httpd.c +++ b/src/auditor/taler-auditor-httpd.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of TALER | 2 | This file is part of TALER |
3 | Copyright (C) 2014-2020 Taler Systems SA | 3 | Copyright (C) 2014-2021 Taler Systems SA |
4 | 4 | ||
5 | TALER is free software; you can redistribute it and/or modify it under the | 5 | TALER is free software; you can redistribute it and/or modify it under the |
6 | terms of the GNU Affero General Public License as published by the Free Software | 6 | terms of the GNU Affero General Public License as published by the Free Software |
@@ -323,11 +323,13 @@ handle_version (struct TAH_RequestHandler *rh, | |||
323 | (void) connection_cls; | 323 | (void) connection_cls; |
324 | if (NULL == ver) | 324 | if (NULL == ver) |
325 | { | 325 | { |
326 | ver = json_pack ("{s:s, s:s, s:o}", | 326 | ver = GNUNET_JSON_PACK ( |
327 | "version", AUDITOR_PROTOCOL_VERSION, | 327 | GNUNET_JSON_pack_string ("version", |
328 | "currency", TAH_currency, | 328 | AUDITOR_PROTOCOL_VERSION), |
329 | "auditor_public_key", GNUNET_JSON_from_data_auto ( | 329 | GNUNET_JSON_pack_string ("currency", |
330 | &auditor_pub)); | 330 | TAH_currency), |
331 | GNUNET_JSON_pack_data_auto ("auditor_public_key", | ||
332 | &auditor_pub)); | ||
331 | } | 333 | } |
332 | if (NULL == ver) | 334 | if (NULL == ver) |
333 | { | 335 | { |
diff --git a/src/auditor/taler-auditor-httpd_deposit-confirmation.c b/src/auditor/taler-auditor-httpd_deposit-confirmation.c index 31d7a7195..9632f0cc5 100644 --- a/src/auditor/taler-auditor-httpd_deposit-confirmation.c +++ b/src/auditor/taler-auditor-httpd_deposit-confirmation.c | |||
@@ -228,10 +228,10 @@ verify_and_execute_deposit_confirmation ( | |||
228 | TALER_EC_GENERIC_DB_STORE_FAILED, | 228 | TALER_EC_GENERIC_DB_STORE_FAILED, |
229 | "deposit confirmation"); | 229 | "deposit confirmation"); |
230 | } | 230 | } |
231 | return TALER_MHD_reply_json_pack (connection, | 231 | return TALER_MHD_REPLY_JSON_PACK (connection, |
232 | MHD_HTTP_OK, | 232 | MHD_HTTP_OK, |
233 | "{s:s}", | 233 | GNUNET_JSON_pack_string ("status", |
234 | "status", "DEPOSIT_CONFIRMATION_OK"); | 234 | "DEPOSIT_CONFIRMATION_OK")); |
235 | } | 235 | } |
236 | 236 | ||
237 | 237 | ||
diff --git a/src/auditor/taler-auditor-httpd_exchanges.c b/src/auditor/taler-auditor-httpd_exchanges.c index be627ba1c..7b54b6d49 100644 --- a/src/auditor/taler-auditor-httpd_exchanges.c +++ b/src/auditor/taler-auditor-httpd_exchanges.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of TALER | 2 | This file is part of TALER |
3 | Copyright (C) 2014-2020 Taler Systems SA | 3 | Copyright (C) 2014-2021 Taler Systems SA |
4 | 4 | ||
5 | TALER is free software; you can redistribute it and/or modify it under the | 5 | TALER is free software; you can redistribute it and/or modify it under the |
6 | terms of the GNU Affero General Public License as published by the Free Software | 6 | terms of the GNU Affero General Public License as published by the Free Software |
@@ -45,12 +45,11 @@ add_exchange (void *cls, | |||
45 | json_t *list = cls; | 45 | json_t *list = cls; |
46 | json_t *obj; | 46 | json_t *obj; |
47 | 47 | ||
48 | obj = json_pack ("{s:o, s:s}", | 48 | obj = GNUNET_JSON_PACK ( |
49 | "master_pub", | 49 | GNUNET_JSON_pack_data_auto ("master_pub", |
50 | GNUNET_JSON_from_data_auto (master_pub), | 50 | master_pub), |
51 | "exchange_url", | 51 | GNUNET_JSON_pack_string ("exchange_url", |
52 | exchange_url); | 52 | exchange_url)); |
53 | GNUNET_break (NULL != obj); | ||
54 | GNUNET_break (0 == | 53 | GNUNET_break (0 == |
55 | json_array_append_new (list, | 54 | json_array_append_new (list, |
56 | obj)); | 55 | obj)); |
@@ -108,10 +107,11 @@ TAH_EXCHANGES_handler (struct TAH_RequestHandler *rh, | |||
108 | TALER_EC_GENERIC_DB_FETCH_FAILED, | 107 | TALER_EC_GENERIC_DB_FETCH_FAILED, |
109 | "exchanges"); | 108 | "exchanges"); |
110 | } | 109 | } |
111 | return TALER_MHD_reply_json_pack (connection, | 110 | return TALER_MHD_REPLY_JSON_PACK ( |
112 | MHD_HTTP_OK, | 111 | connection, |
113 | "{s:o}", | 112 | MHD_HTTP_OK, |
114 | "exchanges", ja); | 113 | GNUNET_JSON_pack_array_steal ("exchanges", |
114 | ja)); | ||
115 | } | 115 | } |
116 | 116 | ||
117 | 117 | ||
diff --git a/src/auditor/taler-helper-auditor-aggregation.c b/src/auditor/taler-helper-auditor-aggregation.c index cdcbd37d1..4990ae405 100644 --- a/src/auditor/taler-helper-auditor-aggregation.c +++ b/src/auditor/taler-helper-auditor-aggregation.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of TALER | 2 | This file is part of TALER |
3 | Copyright (C) 2016-2020 Taler Systems SA | 3 | Copyright (C) 2016-2021 Taler Systems SA |
4 | 4 | ||
5 | TALER is free software; you can redistribute it and/or modify it under the | 5 | TALER is free software; you can redistribute it and/or modify it under the |
6 | terms of the GNU Affero Public License as published by the Free Software | 6 | terms of the GNU Affero Public License as published by the Free Software |
@@ -163,12 +163,17 @@ report_amount_arithmetic_inconsistency ( | |||
163 | exchange); | 163 | exchange); |
164 | } | 164 | } |
165 | TALER_ARL_report (report_amount_arithmetic_inconsistencies, | 165 | TALER_ARL_report (report_amount_arithmetic_inconsistencies, |
166 | json_pack ("{s:s, s:I, s:o, s:o, s:I}", | 166 | GNUNET_JSON_PACK ( |
167 | "operation", operation, | 167 | GNUNET_JSON_pack_string ("operation", |
168 | "rowid", (json_int_t) rowid, | 168 | operation), |
169 | "exchange", TALER_JSON_from_amount (exchange), | 169 | GNUNET_JSON_pack_uint64 ("rowid", |
170 | "auditor", TALER_JSON_from_amount (auditor), | 170 | rowid), |
171 | "profitable", (json_int_t) profitable)); | 171 | TALER_JSON_pack_amount ("exchange", |
172 | exchange), | ||
173 | TALER_JSON_pack_amount ("auditor", | ||
174 | auditor), | ||
175 | GNUNET_JSON_pack_int64 ("profitable", | ||
176 | profitable))); | ||
172 | if (0 != profitable) | 177 | if (0 != profitable) |
173 | { | 178 | { |
174 | target = (1 == profitable) | 179 | target = (1 == profitable) |
@@ -222,13 +227,17 @@ report_coin_arithmetic_inconsistency ( | |||
222 | exchange); | 227 | exchange); |
223 | } | 228 | } |
224 | TALER_ARL_report (report_coin_inconsistencies, | 229 | TALER_ARL_report (report_coin_inconsistencies, |
225 | json_pack ("{s:s, s:o, s:o, s:o, s:I}", | 230 | GNUNET_JSON_PACK ( |
226 | "operation", operation, | 231 | GNUNET_JSON_pack_string ("operation", |
227 | "coin_pub", GNUNET_JSON_from_data_auto ( | 232 | operation), |
228 | coin_pub), | 233 | GNUNET_JSON_pack_data_auto ("coin_pub", |
229 | "exchange", TALER_JSON_from_amount (exchange), | 234 | coin_pub), |
230 | "auditor", TALER_JSON_from_amount (auditor), | 235 | TALER_JSON_pack_amount ("exchange", |
231 | "profitable", (json_int_t) profitable)); | 236 | exchange), |
237 | TALER_JSON_pack_amount ("auditor", | ||
238 | auditor), | ||
239 | GNUNET_JSON_pack_int64 ("profitable", | ||
240 | profitable))); | ||
232 | if (0 != profitable) | 241 | if (0 != profitable) |
233 | { | 242 | { |
234 | target = (1 == profitable) | 243 | target = (1 == profitable) |
@@ -254,10 +263,13 @@ report_row_inconsistency (const char *table, | |||
254 | const char *diagnostic) | 263 | const char *diagnostic) |
255 | { | 264 | { |
256 | TALER_ARL_report (report_row_inconsistencies, | 265 | TALER_ARL_report (report_row_inconsistencies, |
257 | json_pack ("{s:s, s:I, s:s}", | 266 | GNUNET_JSON_PACK ( |
258 | "table", table, | 267 | GNUNET_JSON_pack_string ("table", |
259 | "row", (json_int_t) rowid, | 268 | table), |
260 | "diagnostic", diagnostic)); | 269 | GNUNET_JSON_pack_uint64 ("row", |
270 | rowid), | ||
271 | GNUNET_JSON_pack_string ("diagnostic", | ||
272 | diagnostic))); | ||
261 | } | 273 | } |
262 | 274 | ||
263 | 275 | ||
@@ -797,12 +809,15 @@ wire_transfer_information_cb ( | |||
797 | denom_pub)) | 809 | denom_pub)) |
798 | { | 810 | { |
799 | TALER_ARL_report (report_bad_sig_losses, | 811 | TALER_ARL_report (report_bad_sig_losses, |
800 | json_pack ("{s:s, s:I, s:o, s:o}", | 812 | GNUNET_JSON_PACK ( |
801 | "operation", "wire", | 813 | GNUNET_JSON_pack_string ("operation", |
802 | "row", (json_int_t) rowid, | 814 | "wire"), |
803 | "loss", TALER_JSON_from_amount (coin_value), | 815 | GNUNET_JSON_pack_uint64 ("row", |
804 | "coin_pub", GNUNET_JSON_from_data_auto ( | 816 | rowid), |
805 | &coin.coin_pub))); | 817 | TALER_JSON_pack_amount ("loss", |
818 | coin_value), | ||
819 | GNUNET_JSON_pack_data_auto ("coin_pub", | ||
820 | &coin.coin_pub))); | ||
806 | TALER_ARL_amount_add (&total_bad_sig_loss, | 821 | TALER_ARL_amount_add (&total_bad_sig_loss, |
807 | &total_bad_sig_loss, | 822 | &total_bad_sig_loss, |
808 | coin_value); | 823 | coin_value); |
@@ -985,23 +1000,25 @@ get_wire_fee (struct AggregationContext *ac, | |||
985 | (wfi->prev->end_date.abs_value_us > wfi->start_date.abs_value_us) ) | 1000 | (wfi->prev->end_date.abs_value_us > wfi->start_date.abs_value_us) ) |
986 | { | 1001 | { |
987 | TALER_ARL_report (report_fee_time_inconsistencies, | 1002 | TALER_ARL_report (report_fee_time_inconsistencies, |
988 | json_pack ("{s:s, s:s, s:o}", | 1003 | GNUNET_JSON_PACK ( |
989 | "type", method, | 1004 | GNUNET_JSON_pack_string ("type", |
990 | "diagnostic", | 1005 | method), |
991 | "start date before previous end date", | 1006 | GNUNET_JSON_pack_string ("diagnostic", |
992 | "time", TALER_ARL_json_from_time_abs ( | 1007 | "start date before previous end date"), |
993 | wfi->start_date))); | 1008 | TALER_JSON_pack_time_abs_human ("time", |
1009 | wfi->start_date))); | ||
994 | } | 1010 | } |
995 | if ( (NULL != wfi->next) && | 1011 | if ( (NULL != wfi->next) && |
996 | (wfi->next->start_date.abs_value_us >= wfi->end_date.abs_value_us) ) | 1012 | (wfi->next->start_date.abs_value_us >= wfi->end_date.abs_value_us) ) |
997 | { | 1013 | { |
998 | TALER_ARL_report (report_fee_time_inconsistencies, | 1014 | TALER_ARL_report (report_fee_time_inconsistencies, |
999 | json_pack ("{s:s, s:s, s:o}", | 1015 | GNUNET_JSON_PACK ( |
1000 | "type", method, | 1016 | GNUNET_JSON_pack_string ("type", |
1001 | "diagnostic", | 1017 | method), |
1002 | "end date date after next start date", | 1018 | GNUNET_JSON_pack_string ("diagnostic", |
1003 | "time", TALER_ARL_json_from_time_abs ( | 1019 | "end date date after next start date"), |
1004 | wfi->end_date))); | 1020 | TALER_JSON_pack_time_abs_human ("time", |
1021 | wfi->end_date))); | ||
1005 | } | 1022 | } |
1006 | return &wfi->wire_fee; | 1023 | return &wfi->wire_fee; |
1007 | } | 1024 | } |
@@ -1164,13 +1181,15 @@ check_wire_out_cb (void *cls, | |||
1164 | } | 1181 | } |
1165 | 1182 | ||
1166 | TALER_ARL_report (report_wire_out_inconsistencies, | 1183 | TALER_ARL_report (report_wire_out_inconsistencies, |
1167 | json_pack ("{s:O, s:I, s:o, s:o}", | 1184 | GNUNET_JSON_PACK ( |
1168 | "destination_account", wire, | 1185 | GNUNET_JSON_pack_object_incref ("destination_account", |
1169 | "rowid", (json_int_t) rowid, | 1186 | (json_t *) wire), |
1170 | "expected", | 1187 | GNUNET_JSON_pack_uint64 ("rowid", |
1171 | TALER_JSON_from_amount (&final_amount), | 1188 | rowid), |
1172 | "claimed", | 1189 | TALER_JSON_pack_amount ("expected", |
1173 | TALER_JSON_from_amount (amount))); | 1190 | &final_amount), |
1191 | TALER_JSON_pack_amount ("claimed", | ||
1192 | amount))); | ||
1174 | if (TALER_ARL_do_abort ()) | 1193 | if (TALER_ARL_do_abort ()) |
1175 | return GNUNET_SYSERR; | 1194 | return GNUNET_SYSERR; |
1176 | return GNUNET_OK; | 1195 | return GNUNET_OK; |
@@ -1323,8 +1342,6 @@ run (void *cls, | |||
1323 | const char *cfgfile, | 1342 | const char *cfgfile, |
1324 | const struct GNUNET_CONFIGURATION_Handle *c) | 1343 | const struct GNUNET_CONFIGURATION_Handle *c) |
1325 | { | 1344 | { |
1326 | json_t *report; | ||
1327 | |||
1328 | (void) cls; | 1345 | (void) cls; |
1329 | (void) args; | 1346 | (void) args; |
1330 | (void) cfgfile; | 1347 | (void) cfgfile; |
@@ -1333,7 +1350,7 @@ run (void *cls, | |||
1333 | if (GNUNET_OK != | 1350 | if (GNUNET_OK != |
1334 | TALER_ARL_init (c)) | 1351 | TALER_ARL_init (c)) |
1335 | { | 1352 | { |
1336 | global_ret = 1; | 1353 | global_ret = EXIT_FAILURE; |
1337 | return; | 1354 | return; |
1338 | } | 1355 | } |
1339 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1356 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -1387,71 +1404,71 @@ run (void *cls, | |||
1387 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1404 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1388 | "Audit failed\n"); | 1405 | "Audit failed\n"); |
1389 | TALER_ARL_done (NULL); | 1406 | TALER_ARL_done (NULL); |
1390 | global_ret = 1; | 1407 | global_ret = EXIT_FAILURE; |
1391 | return; | 1408 | return; |
1392 | } | 1409 | } |
1393 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1410 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1394 | "Audit complete\n"); | 1411 | "Audit complete\n"); |
1395 | report = json_pack ("{s:o, s:o, s:o, s:o, s:o," | 1412 | TALER_ARL_done (GNUNET_JSON_PACK ( |
1396 | " s:o, s:o, s:o, s:o, s:o," | 1413 | /* blocks #1 */ |
1397 | " s:o, s:o, s:o, s:I, s:I," | 1414 | GNUNET_JSON_pack_array_steal ( |
1398 | " s:o, s:o, s:o }", | ||
1399 | /* blocks #1 */ | ||
1400 | "wire_out_inconsistencies", | 1415 | "wire_out_inconsistencies", |
1401 | report_wire_out_inconsistencies, | 1416 | report_wire_out_inconsistencies), |
1402 | /* Tested in test-auditor.sh #23 */ | 1417 | /* Tested in test-auditor.sh #23 */ |
1418 | TALER_JSON_pack_amount ( | ||
1403 | "total_wire_out_delta_plus", | 1419 | "total_wire_out_delta_plus", |
1404 | TALER_JSON_from_amount ( | 1420 | &total_wire_out_delta_plus), |
1405 | &total_wire_out_delta_plus), | 1421 | /* Tested in test-auditor.sh #23 */ |
1406 | /* Tested in test-auditor.sh #23 */ | 1422 | TALER_JSON_pack_amount ( |
1407 | "total_wire_out_delta_minus", | 1423 | "total_wire_out_delta_minus", |
1408 | TALER_JSON_from_amount ( | 1424 | &total_wire_out_delta_minus), |
1409 | &total_wire_out_delta_minus), | 1425 | /* Tested in test-auditor.sh #28/32 */ |
1410 | /* Tested in test-auditor.sh #28/32 */ | 1426 | GNUNET_JSON_pack_array_steal ("bad_sig_losses", |
1411 | "bad_sig_losses", | 1427 | report_bad_sig_losses), |
1412 | report_bad_sig_losses, | 1428 | /* Tested in test-auditor.sh #28/32 */ |
1413 | /* Tested in test-auditor.sh #28/32 */ | 1429 | TALER_JSON_pack_amount ("total_bad_sig_loss", |
1414 | "total_bad_sig_loss", | 1430 | &total_bad_sig_loss), |
1415 | TALER_JSON_from_amount (&total_bad_sig_loss), | 1431 | /* block #2 */ |
1416 | /* block #2 */ | 1432 | /* Tested in test-auditor.sh #15 */ |
1417 | /* Tested in test-auditor.sh #15 */ | 1433 | GNUNET_JSON_pack_array_steal ( |
1418 | "row_inconsistencies", | 1434 | "row_inconsistencies", |
1419 | report_row_inconsistencies, | 1435 | report_row_inconsistencies), |
1436 | GNUNET_JSON_pack_array_steal ( | ||
1420 | "coin_inconsistencies", | 1437 | "coin_inconsistencies", |
1421 | report_coin_inconsistencies, | 1438 | report_coin_inconsistencies), |
1422 | "total_coin_delta_plus", | 1439 | TALER_JSON_pack_amount ("total_coin_delta_plus", |
1423 | TALER_JSON_from_amount (&total_coin_delta_plus), | 1440 | &total_coin_delta_plus), |
1424 | "total_coin_delta_minus", | 1441 | TALER_JSON_pack_amount ("total_coin_delta_minus", |
1425 | TALER_JSON_from_amount ( | 1442 | &total_coin_delta_minus), |
1426 | &total_coin_delta_minus), | 1443 | GNUNET_JSON_pack_array_steal ( |
1427 | "amount_arithmetic_inconsistencies", | 1444 | "amount_arithmetic_inconsistencies", |
1428 | report_amount_arithmetic_inconsistencies, | 1445 | report_amount_arithmetic_inconsistencies), |
1429 | /* block #3 */ | 1446 | /* block #3 */ |
1447 | TALER_JSON_pack_amount ( | ||
1430 | "total_arithmetic_delta_plus", | 1448 | "total_arithmetic_delta_plus", |
1431 | TALER_JSON_from_amount ( | 1449 | &total_arithmetic_delta_plus), |
1432 | &total_arithmetic_delta_plus), | 1450 | TALER_JSON_pack_amount ( |
1433 | "total_arithmetic_delta_minus", | 1451 | "total_arithmetic_delta_minus", |
1434 | TALER_JSON_from_amount ( | 1452 | &total_arithmetic_delta_minus), |
1435 | &total_arithmetic_delta_minus), | 1453 | TALER_JSON_pack_amount ( |
1436 | "total_aggregation_fee_income", | 1454 | "total_aggregation_fee_income", |
1437 | TALER_JSON_from_amount ( | 1455 | &total_aggregation_fee_income), |
1438 | &total_aggregation_fee_income), | 1456 | GNUNET_JSON_pack_uint64 ( |
1439 | "start_ppa_wire_out_serial_id", | 1457 | "start_ppa_wire_out_serial_id", |
1440 | (json_int_t) ppa_start.last_wire_out_serial_id, | 1458 | ppa_start.last_wire_out_serial_id), |
1459 | GNUNET_JSON_pack_uint64 ( | ||
1441 | "end_ppa_wire_out_serial_id", | 1460 | "end_ppa_wire_out_serial_id", |
1442 | (json_int_t) ppa.last_wire_out_serial_id, | 1461 | ppa.last_wire_out_serial_id), |
1443 | /* block #4 */ | 1462 | /* block #4 */ |
1463 | TALER_JSON_pack_time_abs_human ( | ||
1444 | "auditor_start_time", | 1464 | "auditor_start_time", |
1445 | TALER_ARL_json_from_time_abs ( | 1465 | start_time), |
1446 | start_time), | 1466 | TALER_JSON_pack_time_abs_human ( |
1447 | "auditor_end_time", | 1467 | "auditor_end_time", |
1448 | TALER_ARL_json_from_time_abs ( | 1468 | GNUNET_TIME_absolute_get ()), |
1449 | GNUNET_TIME_absolute_get ()), | 1469 | GNUNET_JSON_pack_array_steal ( |
1450 | "wire_fee_time_inconsistencies", | 1470 | "wire_fee_time_inconsistencies", |
1451 | report_fee_time_inconsistencies | 1471 | report_fee_time_inconsistencies))); |
1452 | ); | ||
1453 | GNUNET_break (NULL != report); | ||
1454 | TALER_ARL_done (report); | ||
1455 | } | 1472 | } |
1456 | 1473 | ||
1457 | 1474 | ||
@@ -1489,7 +1506,7 @@ main (int argc, | |||
1489 | if (GNUNET_OK != | 1506 | if (GNUNET_OK != |
1490 | GNUNET_STRINGS_get_utf8_args (argc, argv, | 1507 | GNUNET_STRINGS_get_utf8_args (argc, argv, |
1491 | &argc, &argv)) | 1508 | &argc, &argv)) |
1492 | return 4; | 1509 | return EXIT_INVALIDARGUMENT; |
1493 | ret = GNUNET_PROGRAM_run ( | 1510 | ret = GNUNET_PROGRAM_run ( |
1494 | argc, | 1511 | argc, |
1495 | argv, | 1512 | argv, |
@@ -1500,9 +1517,9 @@ main (int argc, | |||
1500 | NULL); | 1517 | NULL); |
1501 | GNUNET_free_nz ((void *) argv); | 1518 | GNUNET_free_nz ((void *) argv); |
1502 | if (GNUNET_SYSERR == ret) | 1519 | if (GNUNET_SYSERR == ret) |
1503 | return 3; | 1520 | return EXIT_INVALIDARGUMENT; |
1504 | if (GNUNET_NO == ret) | 1521 | if (GNUNET_NO == ret) |
1505 | return 0; | 1522 | return EXIT_SUCCESS; |
1506 | return global_ret; | 1523 | return global_ret; |
1507 | } | 1524 | } |
1508 | 1525 | ||
diff --git a/src/auditor/taler-helper-auditor-coins.c b/src/auditor/taler-helper-auditor-coins.c index 58c06bed0..40b68c4ad 100644 --- a/src/auditor/taler-helper-auditor-coins.c +++ b/src/auditor/taler-helper-auditor-coins.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of TALER | 2 | This file is part of TALER |
3 | Copyright (C) 2016-2020 Taler Systems SA | 3 | Copyright (C) 2016-2021 Taler Systems SA |
4 | 4 | ||
5 | TALER is free software; you can redistribute it and/or modify it under the | 5 | TALER is free software; you can redistribute it and/or modify it under the |
6 | terms of the GNU Affero Public License as published by the Free Software | 6 | terms of the GNU Affero Public License as published by the Free Software |
@@ -285,21 +285,19 @@ report_emergency_by_amount ( | |||
285 | GNUNET_h2s (&issue->denom_hash), | 285 | GNUNET_h2s (&issue->denom_hash), |
286 | TALER_amount2s (loss)); | 286 | TALER_amount2s (loss)); |
287 | TALER_ARL_report (report_emergencies, | 287 | TALER_ARL_report (report_emergencies, |
288 | json_pack ("{s:o, s:o, s:o, s:o, s:o, s:o}", | 288 | GNUNET_JSON_PACK ( |
289 | "denompub_hash", | 289 | GNUNET_JSON_pack_data_auto ("denompub_hash", |
290 | GNUNET_JSON_from_data_auto (&issue->denom_hash), | 290 | &issue->denom_hash), |
291 | "denom_risk", | 291 | TALER_JSON_pack_amount ("denom_risk", |
292 | TALER_JSON_from_amount (risk), | 292 | risk), |
293 | "denom_loss", | 293 | TALER_JSON_pack_amount ("denom_loss", |
294 | TALER_JSON_from_amount (loss), | 294 | loss), |
295 | "start", | 295 | TALER_JSON_pack_time_abs_nbo_human ("start", |
296 | TALER_ARL_json_from_time_abs_nbo ( | 296 | issue->start), |
297 | issue->start), | 297 | TALER_JSON_pack_time_abs_nbo_human ("deposit_end", |
298 | "deposit_end", | 298 | issue->expire_deposit), |
299 | TALER_ARL_json_from_time_abs_nbo ( | 299 | TALER_JSON_pack_amount_nbo ("value", |
300 | issue->expire_deposit), | 300 | &issue->value))); |
301 | "value", | ||
302 | TALER_JSON_from_amount_nbo (&issue->value))); | ||
303 | TALER_ARL_amount_add (&reported_emergency_risk_by_amount, | 301 | TALER_ARL_amount_add (&reported_emergency_risk_by_amount, |
304 | &reported_emergency_risk_by_amount, | 302 | &reported_emergency_risk_by_amount, |
305 | risk); | 303 | risk); |
@@ -333,23 +331,21 @@ report_emergency_by_count ( | |||
333 | struct TALER_Amount denom_value; | 331 | struct TALER_Amount denom_value; |
334 | 332 | ||
335 | TALER_ARL_report (report_emergencies_by_count, | 333 | TALER_ARL_report (report_emergencies_by_count, |
336 | json_pack ("{s:o, s:I, s:I, s:o, s:o, s:o, s:o}", | 334 | GNUNET_JSON_PACK ( |
337 | "denompub_hash", | 335 | GNUNET_JSON_pack_data_auto ("denompub_hash", |
338 | GNUNET_JSON_from_data_auto (&issue->denom_hash), | 336 | &issue->denom_hash), |
339 | "num_issued", | 337 | GNUNET_JSON_pack_uint64 ("num_issued", |
340 | (json_int_t) num_issued, | 338 | num_issued), |
341 | "num_known", | 339 | GNUNET_JSON_pack_uint64 ("num_known", |
342 | (json_int_t) num_known, | 340 | num_known), |
343 | "denom_risk", | 341 | TALER_JSON_pack_amount ("denom_risk", |
344 | TALER_JSON_from_amount (risk), | 342 | risk), |
345 | "start", | 343 | TALER_JSON_pack_time_abs_nbo_human ("start", |
346 | TALER_ARL_json_from_time_abs_nbo ( | 344 | issue->start), |
347 | issue->start), | 345 | TALER_JSON_pack_time_abs_nbo_human ("deposit_end", |
348 | "deposit_end", | 346 | issue->expire_deposit), |
349 | TALER_ARL_json_from_time_abs_nbo ( | 347 | TALER_JSON_pack_amount_nbo ("value", |
350 | issue->expire_deposit), | 348 | &issue->value))); |
351 | "value", | ||
352 | TALER_JSON_from_amount_nbo (&issue->value))); | ||
353 | TALER_ARL_amount_add (&reported_emergency_risk_by_count, | 349 | TALER_ARL_amount_add (&reported_emergency_risk_by_count, |
354 | &reported_emergency_risk_by_count, | 350 | &reported_emergency_risk_by_count, |
355 | risk); | 351 | risk); |
@@ -406,12 +402,17 @@ report_amount_arithmetic_inconsistency ( | |||
406 | exchange); | 402 | exchange); |
407 | } | 403 | } |
408 | TALER_ARL_report (report_amount_arithmetic_inconsistencies, | 404 | TALER_ARL_report (report_amount_arithmetic_inconsistencies, |
409 | json_pack ("{s:s, s:I, s:o, s:o, s:I}", | 405 | GNUNET_JSON_PACK ( |
410 | "operation", operation, | 406 | GNUNET_JSON_pack_string ("operation", |
411 | "rowid", (json_int_t) rowid, | 407 | operation), |
412 | "exchange", TALER_JSON_from_amount (exchange), | 408 | GNUNET_JSON_pack_uint64 ("rowid", |
413 | "auditor", TALER_JSON_from_amount (auditor), | 409 | rowid), |
414 | "profitable", (json_int_t) profitable)); | 410 | TALER_JSON_pack_amount ("exchange", |
411 | exchange), | ||
412 | TALER_JSON_pack_amount ("auditor", | ||
413 | auditor), | ||
414 | GNUNET_JSON_pack_int64 ("profitable", | ||
415 | profitable))); | ||
415 | if (0 != profitable) | 416 | if (0 != profitable) |
416 | { | 417 | { |
417 | target = (1 == profitable) | 418 | target = (1 == profitable) |
@@ -437,10 +438,13 @@ report_row_inconsistency (const char *table, | |||
437 | const char *diagnostic) | 438 | const char *diagnostic) |
438 | { | 439 | { |
439 | TALER_ARL_report (report_row_inconsistencies, | 440 | TALER_ARL_report (report_row_inconsistencies, |
440 | json_pack ("{s:s, s:I, s:s}", | 441 | GNUNET_JSON_PACK ( |
441 | "table", table, | 442 | GNUNET_JSON_pack_string ("table", |
442 | "row", (json_int_t) rowid, | 443 | table), |
443 | "diagnostic", diagnostic)); | 444 | GNUNET_JSON_pack_uint64 ("row", |
445 | rowid), | ||
446 | GNUNET_JSON_pack_string ("diagnostic", | ||
447 | diagnostic))); | ||
444 | } | 448 | } |
445 | 449 | ||
446 | 450 | ||
@@ -1196,13 +1200,15 @@ check_known_coin (const char *operation, | |||
1196 | denom_pub)) | 1200 | denom_pub)) |
1197 | { | 1201 | { |
1198 | TALER_ARL_report (report_bad_sig_losses, | 1202 | TALER_ARL_report (report_bad_sig_losses, |
1199 | json_pack ("{s:s, s:I, s:o, s:o}", | 1203 | GNUNET_JSON_PACK ( |
1200 | "operation", operation, | 1204 | GNUNET_JSON_pack_string ("operation", |
1201 | "row", (json_int_t) rowid, | 1205 | operation), |
1202 | "loss", TALER_JSON_from_amount ( | 1206 | GNUNET_JSON_pack_uint64 ("row", |
1203 | loss_potential), | 1207 | rowid), |
1204 | "coin_pub", GNUNET_JSON_from_data_auto ( | 1208 | TALER_JSON_pack_amount ("loss", |
1205 | coin_pub))); | 1209 | loss_potential), |
1210 | GNUNET_JSON_pack_data_auto ("coin_pub", | ||
1211 | coin_pub))); | ||
1206 | TALER_ARL_amount_add (&total_bad_sig_loss, | 1212 | TALER_ARL_amount_add (&total_bad_sig_loss, |
1207 | &total_bad_sig_loss, | 1213 | &total_bad_sig_loss, |
1208 | loss_potential); | 1214 | loss_potential); |
@@ -1302,13 +1308,15 @@ refresh_session_cb (void *cls, | |||
1302 | &coin_pub->eddsa_pub)) | 1308 | &coin_pub->eddsa_pub)) |
1303 | { | 1309 | { |
1304 | TALER_ARL_report (report_bad_sig_losses, | 1310 | TALER_ARL_report (report_bad_sig_losses, |
1305 | json_pack ("{s:s, s:I, s:o, s:o}", | 1311 | GNUNET_JSON_PACK ( |
1306 | "operation", "melt", | 1312 | GNUNET_JSON_pack_string ("operation", |
1307 | "row", (json_int_t) rowid, | 1313 | "melt"), |
1308 | "loss", TALER_JSON_from_amount ( | 1314 | GNUNET_JSON_pack_uint64 ("row", |
1309 | amount_with_fee), | 1315 | rowid), |
1310 | "coin_pub", GNUNET_JSON_from_data_auto ( | 1316 | TALER_JSON_pack_amount ("loss", |
1311 | coin_pub))); | 1317 | amount_with_fee), |
1318 | GNUNET_JSON_pack_data_auto ("coin_pub", | ||
1319 | coin_pub))); | ||
1312 | TALER_ARL_amount_add (&total_bad_sig_loss, | 1320 | TALER_ARL_amount_add (&total_bad_sig_loss, |
1313 | &total_bad_sig_loss, | 1321 | &total_bad_sig_loss, |
1314 | amount_with_fee); | 1322 | amount_with_fee); |
@@ -1345,12 +1353,13 @@ refresh_session_cb (void *cls, | |||
1345 | with invalid data, even if the exchange is correctly operating. We | 1353 | with invalid data, even if the exchange is correctly operating. We |
1346 | still report it. */ | 1354 | still report it. */ |
1347 | TALER_ARL_report (report_refreshs_hanging, | 1355 | TALER_ARL_report (report_refreshs_hanging, |
1348 | json_pack ("{s:I, s:o, s:o}", | 1356 | GNUNET_JSON_PACK ( |
1349 | "row", (json_int_t) rowid, | 1357 | GNUNET_JSON_pack_uint64 ("row", |
1350 | "amount", TALER_JSON_from_amount ( | 1358 | rowid), |
1351 | amount_with_fee), | 1359 | TALER_JSON_pack_amount ("amount", |
1352 | "coin_pub", GNUNET_JSON_from_data_auto ( | 1360 | amount_with_fee), |
1353 | coin_pub))); | 1361 | GNUNET_JSON_pack_data_auto ("coin_pub", |
1362 | coin_pub))); | ||
1354 | TALER_ARL_amount_add (&total_refresh_hanging, | 1363 | TALER_ARL_amount_add (&total_refresh_hanging, |
1355 | &total_refresh_hanging, | 1364 | &total_refresh_hanging, |
1356 | amount_with_fee); | 1365 | amount_with_fee); |
@@ -1653,13 +1662,15 @@ deposit_cb (void *cls, | |||
1653 | &dr.h_wire)) | 1662 | &dr.h_wire)) |
1654 | { | 1663 | { |
1655 | TALER_ARL_report (report_bad_sig_losses, | 1664 | TALER_ARL_report (report_bad_sig_losses, |
1656 | json_pack ("{s:s, s:I, s:o, s:o}", | 1665 | GNUNET_JSON_PACK ( |
1657 | "operation", "deposit", | 1666 | GNUNET_JSON_pack_string ("operation", |
1658 | "row", (json_int_t) rowid, | 1667 | "deposit"), |
1659 | "loss", TALER_JSON_from_amount ( | 1668 | GNUNET_JSON_pack_uint64 ("row", |
1660 | amount_with_fee), | 1669 | rowid), |
1661 | "coin_pub", GNUNET_JSON_from_data_auto ( | 1670 | TALER_JSON_pack_amount ("loss", |
1662 | coin_pub))); | 1671 | amount_with_fee), |
1672 | GNUNET_JSON_pack_data_auto ("coin_pub", | ||
1673 | coin_pub))); | ||
1663 | TALER_ARL_amount_add (&total_bad_sig_loss, | 1674 | TALER_ARL_amount_add (&total_bad_sig_loss, |
1664 | &total_bad_sig_loss, | 1675 | &total_bad_sig_loss, |
1665 | amount_with_fee); | 1676 | amount_with_fee); |
@@ -1679,13 +1690,15 @@ deposit_cb (void *cls, | |||
1679 | &coin_pub->eddsa_pub)) | 1690 | &coin_pub->eddsa_pub)) |
1680 | { | 1691 | { |
1681 | TALER_ARL_report (report_bad_sig_losses, | 1692 | TALER_ARL_report (report_bad_sig_losses, |
1682 | json_pack ("{s:s, s:I, s:o, s:o}", | 1693 | GNUNET_JSON_PACK ( |
1683 | "operation", "deposit", | 1694 | GNUNET_JSON_pack_string ("operation", |
1684 | "row", (json_int_t) rowid, | 1695 | "deposit"), |
1685 | "loss", TALER_JSON_from_amount ( | 1696 | GNUNET_JSON_pack_uint64 ("row", |
1686 | amount_with_fee), | 1697 | rowid), |
1687 | "coin_pub", GNUNET_JSON_from_data_auto ( | 1698 | TALER_JSON_pack_amount ("loss", |
1688 | coin_pub))); | 1699 | amount_with_fee), |
1700 | GNUNET_JSON_pack_data_auto ("coin_pub", | ||
1701 | coin_pub))); | ||
1689 | TALER_ARL_amount_add (&total_bad_sig_loss, | 1702 | TALER_ARL_amount_add (&total_bad_sig_loss, |
1690 | &total_bad_sig_loss, | 1703 | &total_bad_sig_loss, |
1691 | amount_with_fee); | 1704 | amount_with_fee); |
@@ -1850,13 +1863,15 @@ refund_cb (void *cls, | |||
1850 | &merchant_pub->eddsa_pub)) | 1863 | &merchant_pub->eddsa_pub)) |
1851 | { | 1864 | { |
1852 | TALER_ARL_report (report_bad_sig_losses, | 1865 | TALER_ARL_report (report_bad_sig_losses, |
1853 | json_pack ("{s:s, s:I, s:o, s:o}", | 1866 | GNUNET_JSON_PACK ( |
1854 | "operation", "refund", | 1867 | GNUNET_JSON_pack_string ("operation", |
1855 | "row", (json_int_t) rowid, | 1868 | "refund"), |
1856 | "loss", TALER_JSON_from_amount ( | 1869 | GNUNET_JSON_pack_uint64 ("row", |
1857 | amount_with_fee), | 1870 | rowid), |
1858 | "coin_pub", GNUNET_JSON_from_data_auto ( | 1871 | TALER_JSON_pack_amount ("loss", |
1859 | coin_pub))); | 1872 | amount_with_fee), |
1873 | GNUNET_JSON_pack_data_auto ("coin_pub", | ||
1874 | coin_pub))); | ||
1860 | TALER_ARL_amount_add (&total_bad_sig_loss, | 1875 | TALER_ARL_amount_add (&total_bad_sig_loss, |
1861 | &total_bad_sig_loss, | 1876 | &total_bad_sig_loss, |
1862 | amount_with_fee); | 1877 | amount_with_fee); |
@@ -1961,12 +1976,15 @@ check_recoup (struct CoinContext *cc, | |||
1961 | denom_pub)) | 1976 | denom_pub)) |
1962 | { | 1977 | { |
1963 | TALER_ARL_report (report_bad_sig_losses, | 1978 | TALER_ARL_report (report_bad_sig_losses, |
1964 | json_pack ("{s:s, s:I, s:o, s:o}", | 1979 | GNUNET_JSON_PACK ( |
1965 | "operation", operation, | 1980 | GNUNET_JSON_pack_string ("operation", |
1966 | "row", (json_int_t) rowid, | 1981 | operation), |
1967 | "loss", TALER_JSON_from_amount (amount), | 1982 | GNUNET_JSON_pack_uint64 ("row", |
1968 | "coin_pub", GNUNET_JSON_from_data_auto ( | 1983 | rowid), |
1969 | &coin->denom_pub_hash))); | 1984 | TALER_JSON_pack_amount ("loss", |
1985 | amount), | ||
1986 | GNUNET_JSON_pack_data_auto ("coin_pub", | ||
1987 | &coin->denom_pub_hash))); | ||
1970 | TALER_ARL_amount_add (&total_bad_sig_loss, | 1988 | TALER_ARL_amount_add (&total_bad_sig_loss, |
1971 | &total_bad_sig_loss, | 1989 | &total_bad_sig_loss, |
1972 | amount); | 1990 | amount); |
@@ -2018,12 +2036,15 @@ check_recoup (struct CoinContext *cc, | |||
2018 | &coin->coin_pub.eddsa_pub)) | 2036 | &coin->coin_pub.eddsa_pub)) |
2019 | { | 2037 | { |
2020 | TALER_ARL_report (report_bad_sig_losses, | 2038 | TALER_ARL_report (report_bad_sig_losses, |
2021 | json_pack ("{s:s, s:I, s:o, s:o}", | 2039 | GNUNET_JSON_PACK ( |
2022 | "operation", operation, | 2040 | GNUNET_JSON_pack_string ("operation", |
2023 | "row", (json_int_t) rowid, | 2041 | operation), |
2024 | "loss", TALER_JSON_from_amount (amount), | 2042 | GNUNET_JSON_pack_uint64 ("row", |
2025 | "coin_pub", GNUNET_JSON_from_data_auto ( | 2043 | rowid), |
2026 | &coin->coin_pub))); | 2044 | TALER_JSON_pack_amount ("loss", |
2045 | amount), | ||
2046 | GNUNET_JSON_pack_data_auto ("coin_pub", | ||
2047 | &coin->coin_pub))); | ||
2027 | TALER_ARL_amount_add (&total_bad_sig_loss, | 2048 | TALER_ARL_amount_add (&total_bad_sig_loss, |
2028 | &total_bad_sig_loss, | 2049 | &total_bad_sig_loss, |
2029 | amount); | 2050 | amount); |
@@ -2047,15 +2068,17 @@ check_recoup (struct CoinContext *cc, | |||
2047 | { | 2068 | { |
2048 | /* Woopsie, we allowed recoup on non-revoked denomination!? */ | 2069 | /* Woopsie, we allowed recoup on non-revoked denomination!? */ |
2049 | TALER_ARL_report (report_bad_sig_losses, | 2070 | TALER_ARL_report (report_bad_sig_losses, |
2050 | json_pack ("{s:s, s:s, s:I, s:o, s:o}", | 2071 | GNUNET_JSON_PACK ( |
2051 | "operation", | 2072 | GNUNET_JSON_pack_string ("operation", |
2052 | operation, | 2073 | operation), |
2053 | "hint", | 2074 | GNUNET_JSON_pack_string ("hint", |
2054 | "denomination not revoked", | 2075 | "denomination not revoked"), |
2055 | "row", (json_int_t) rowid, | 2076 | GNUNET_JSON_pack_uint64 ("row", |
2056 | "loss", TALER_JSON_from_amount (amount), | 2077 | rowid), |
2057 | "coin_pub", GNUNET_JSON_from_data_auto ( | 2078 | TALER_JSON_pack_amount ("loss", |
2058 | &coin->coin_pub))); | 2079 | amount), |
2080 | GNUNET_JSON_pack_data_auto ("coin_pub", | ||
2081 | &coin->coin_pub))); | ||
2059 | TALER_ARL_amount_add (&total_bad_sig_loss, | 2082 | TALER_ARL_amount_add (&total_bad_sig_loss, |
2060 | &total_bad_sig_loss, | 2083 | &total_bad_sig_loss, |
2061 | amount); | 2084 | amount); |
@@ -2273,18 +2296,16 @@ check_denomination ( | |||
2273 | &auditor_sig)) | 2296 | &auditor_sig)) |
2274 | { | 2297 | { |
2275 | TALER_ARL_report (report_denominations_without_sigs, | 2298 | TALER_ARL_report (report_denominations_without_sigs, |
2276 | json_pack ("{s:o, s:o, s:o, s:o}", | 2299 | GNUNET_JSON_PACK ( |
2277 | "denomination", | 2300 | GNUNET_JSON_pack_data_auto ("denomination", |
2278 | GNUNET_JSON_from_data_auto ( | 2301 | &issue->denom_hash), |
2279 | &issue->denom_hash), | 2302 | TALER_JSON_pack_amount ("value", |
2280 | "value", | 2303 | &coin_value), |
2281 | TALER_JSON_from_amount (&coin_value), | 2304 | TALER_JSON_pack_time_abs_nbo_human ("start_time", |
2282 | "start_time", | 2305 | issue->start), |
2283 | TALER_ARL_json_from_time_abs_nbo ( | 2306 | TALER_JSON_pack_time_abs_nbo_human ("end_time", |
2284 | issue->start), | 2307 | issue-> |
2285 | "end_time", | 2308 | expire_legal))); |
2286 | TALER_ARL_json_from_time_abs_nbo ( | ||
2287 | issue->expire_legal))); | ||
2288 | } | 2309 | } |
2289 | } | 2310 | } |
2290 | } | 2311 | } |
@@ -2533,8 +2554,6 @@ run (void *cls, | |||
2533 | const char *cfgfile, | 2554 | const char *cfgfile, |
2534 | const struct GNUNET_CONFIGURATION_Handle *c) | 2555 | const struct GNUNET_CONFIGURATION_Handle *c) |
2535 | { | 2556 | { |
2536 | json_t *report; | ||
2537 | |||
2538 | (void) cls; | 2557 | (void) cls; |
2539 | (void) args; | 2558 | (void) args; |
2540 | (void) cfgfile; | 2559 | (void) cfgfile; |
@@ -2543,7 +2562,7 @@ run (void *cls, | |||
2543 | if (GNUNET_OK != | 2562 | if (GNUNET_OK != |
2544 | TALER_ARL_init (c)) | 2563 | TALER_ARL_init (c)) |
2545 | { | 2564 | { |
2546 | global_ret = 1; | 2565 | global_ret = EXIT_FAILURE; |
2547 | return; | 2566 | return; |
2548 | } | 2567 | } |
2549 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2568 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -2617,121 +2636,92 @@ run (void *cls, | |||
2617 | } | 2636 | } |
2618 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2637 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2619 | "Audit complete\n"); | 2638 | "Audit complete\n"); |
2620 | report = json_pack ("{s:o, s:o, s:o, s:o, s:o," | 2639 | TALER_ARL_done ( |
2621 | " s:o, s:o, s:o, s:o, s:o," | 2640 | GNUNET_JSON_PACK ( |
2622 | " s:o, s:o, s:o, s:o, s:o," | 2641 | TALER_JSON_pack_amount ("total_escrow_balance", |
2623 | " s:o, s:o, s:o, s:o, s:o," | 2642 | &total_escrow_balance), |
2624 | " s:I, s:I, s:I, s:I, s:I," | 2643 | TALER_JSON_pack_amount ("total_active_risk", |
2625 | " s:I, s:I, s:I, s:I, s:I," | 2644 | &total_risk), |
2626 | " s:I, s:I, s:o, s:o, s:o," | 2645 | TALER_JSON_pack_amount ("total_deposit_fee_income", |
2627 | " s:o}", | 2646 | &total_deposit_fee_income), |
2628 | /* Block #1 */ | 2647 | TALER_JSON_pack_amount ("total_melt_fee_income", |
2629 | "total_escrow_balance", | 2648 | &total_melt_fee_income), |
2630 | TALER_JSON_from_amount (&total_escrow_balance), | 2649 | TALER_JSON_pack_amount ("total_refund_fee_income", |
2631 | "total_active_risk", | 2650 | &total_refund_fee_income), |
2632 | TALER_JSON_from_amount (&total_risk), | 2651 | /* Tested in test-auditor.sh #18 */ |
2633 | "total_deposit_fee_income", | 2652 | GNUNET_JSON_pack_array_steal ("emergencies", |
2634 | TALER_JSON_from_amount ( | 2653 | report_emergencies), |
2635 | &total_deposit_fee_income), | 2654 | /* Tested in test-auditor.sh #18 */ |
2636 | "total_melt_fee_income", | 2655 | TALER_JSON_pack_amount ("emergencies_risk_by_amount", |
2637 | TALER_JSON_from_amount (&total_melt_fee_income), | 2656 | &reported_emergency_risk_by_amount), |
2638 | "total_refund_fee_income", | 2657 | /* Tested in test-auditor.sh #4/#5/#6/#13/#26 */ |
2639 | TALER_JSON_from_amount ( | 2658 | GNUNET_JSON_pack_array_steal ("bad_sig_losses", |
2640 | &total_refund_fee_income), | 2659 | report_bad_sig_losses), |
2641 | /* Block #2 */ | 2660 | /* Tested in test-auditor.sh #4/#5/#6/#13/#26 */ |
2642 | /* Tested in test-auditor.sh #18 */ | 2661 | TALER_JSON_pack_amount ("total_bad_sig_loss", |
2643 | "emergencies", | 2662 | &total_bad_sig_loss), |
2644 | report_emergencies, | 2663 | /* Tested in test-auditor.sh #31 */ |
2645 | /* Tested in test-auditor.sh #18 */ | 2664 | GNUNET_JSON_pack_array_steal ("row_inconsistencies", |
2646 | "emergencies_risk_by_amount", | 2665 | report_row_inconsistencies), |
2647 | TALER_JSON_from_amount ( | 2666 | /* Tested in test-auditor.sh #18 */ |
2648 | &reported_emergency_risk_by_amount), | 2667 | GNUNET_JSON_pack_array_steal ("amount_arithmetic_inconsistencies", |
2649 | /* Tested in test-auditor.sh #4/#5/#6/#13/#26 */ | 2668 | report_amount_arithmetic_inconsistencies), |
2650 | "bad_sig_losses", | 2669 | TALER_JSON_pack_amount ("total_arithmetic_delta_plus", |
2651 | report_bad_sig_losses, | 2670 | &total_arithmetic_delta_plus), |
2652 | /* Tested in test-auditor.sh #4/#5/#6/#13/#26 */ | 2671 | TALER_JSON_pack_amount ("total_arithmetic_delta_minus", |
2653 | "total_bad_sig_loss", | 2672 | &total_arithmetic_delta_minus), |
2654 | TALER_JSON_from_amount (&total_bad_sig_loss), | 2673 | TALER_JSON_pack_amount ("total_refresh_hanging", |
2655 | /* Tested in test-auditor.sh #31 */ | 2674 | &total_refresh_hanging), |
2656 | "row_inconsistencies", | 2675 | /* Tested in test-auditor.sh #12 */ |
2657 | report_row_inconsistencies, | 2676 | GNUNET_JSON_pack_array_steal ("refresh_hanging", |
2658 | /* Block #3 */ | 2677 | report_refreshs_hanging), |
2659 | /* Tested in test-auditor.sh #18 */ | 2678 | TALER_JSON_pack_amount ("total_recoup_loss", |
2660 | "amount_arithmetic_inconsistencies", | 2679 | &total_recoup_loss), |
2661 | report_amount_arithmetic_inconsistencies, | 2680 | /* Tested in test-auditor.sh #18 */ |
2662 | "total_arithmetic_delta_plus", | 2681 | GNUNET_JSON_pack_array_steal ("emergencies_by_count", |
2663 | TALER_JSON_from_amount ( | 2682 | report_emergencies_by_count), |
2664 | &total_arithmetic_delta_plus), | 2683 | /* Tested in test-auditor.sh #18 */ |
2665 | "total_arithmetic_delta_minus", | 2684 | TALER_JSON_pack_amount ("emergencies_risk_by_count", |
2666 | TALER_JSON_from_amount ( | 2685 | &reported_emergency_risk_by_count), |
2667 | &total_arithmetic_delta_minus), | 2686 | /* Tested in test-auditor.sh #18 */ |
2668 | /* Tested in test-auditor.sh #12 */ | 2687 | TALER_JSON_pack_amount ("emergencies_loss", |
2669 | "total_refresh_hanging", | 2688 | &reported_emergency_loss), |
2670 | TALER_JSON_from_amount (&total_refresh_hanging), | 2689 | /* Tested in test-auditor.sh #18 */ |
2671 | /* Tested in test-auditor.sh #12 */ | 2690 | TALER_JSON_pack_amount ("emergencies_loss_by_count", |
2672 | "refresh_hanging", | 2691 | &reported_emergency_loss_by_count), |
2673 | report_refreshs_hanging, | 2692 | GNUNET_JSON_pack_uint64 ("start_ppc_withdraw_serial_id", |
2674 | /* Block #4 */ | 2693 | ppc_start.last_withdraw_serial_id), |
2675 | "total_recoup_loss", | 2694 | GNUNET_JSON_pack_uint64 ("start_ppc_deposit_serial_id", |
2676 | TALER_JSON_from_amount (&total_recoup_loss), | 2695 | ppc_start.last_deposit_serial_id), |
2677 | /* Tested in test-auditor.sh #18 */ | 2696 | GNUNET_JSON_pack_uint64 ("start_ppc_melt_serial_id", |
2678 | "emergencies_by_count", | 2697 | ppc_start.last_melt_serial_id), |
2679 | report_emergencies_by_count, | 2698 | GNUNET_JSON_pack_uint64 ("start_ppc_refund_serial_id", |
2680 | /* Tested in test-auditor.sh #18 */ | 2699 | ppc_start.last_refund_serial_id), |
2681 | "emergencies_risk_by_count", | 2700 | GNUNET_JSON_pack_uint64 ("start_ppc_recoup_serial_id", |
2682 | TALER_JSON_from_amount ( | 2701 | ppc_start.last_recoup_serial_id), |
2683 | &reported_emergency_risk_by_count), | 2702 | GNUNET_JSON_pack_uint64 ("start_ppc_recoup_refresh_serial_id", |
2684 | /* Tested in test-auditor.sh #18 */ | 2703 | ppc_start. |
2685 | "emergencies_loss", | 2704 | last_recoup_refresh_serial_id), |
2686 | TALER_JSON_from_amount ( | 2705 | GNUNET_JSON_pack_uint64 ("end_ppc_withdraw_serial_id", |
2687 | &reported_emergency_loss), | 2706 | ppc.last_withdraw_serial_id), |
2688 | /* Tested in test-auditor.sh #18 */ | 2707 | GNUNET_JSON_pack_uint64 ("end_ppc_deposit_serial_id", |
2689 | "emergencies_loss_by_count", | 2708 | ppc.last_deposit_serial_id), |
2690 | TALER_JSON_from_amount ( | 2709 | GNUNET_JSON_pack_uint64 ("end_ppc_melt_serial_id", |
2691 | &reported_emergency_loss_by_count), | 2710 | ppc.last_melt_serial_id), |
2692 | /* Block #5 */ | 2711 | GNUNET_JSON_pack_uint64 ("end_ppc_refund_serial_id", |
2693 | "start_ppc_withdraw_serial_id", | 2712 | ppc.last_refund_serial_id), |
2694 | (json_int_t) ppc_start.last_withdraw_serial_id, | 2713 | GNUNET_JSON_pack_uint64 ("end_ppc_recoup_serial_id", |
2695 | "start_ppc_deposit_serial_id", | 2714 | ppc.last_recoup_serial_id), |
2696 | (json_int_t) ppc_start.last_deposit_serial_id, | 2715 | GNUNET_JSON_pack_uint64 ("end_ppc_recoup_refresh_serial_id", |
2697 | "start_ppc_melt_serial_id", | 2716 | ppc.last_recoup_refresh_serial_id), |
2698 | (json_int_t) ppc_start.last_melt_serial_id, | 2717 | TALER_JSON_pack_time_abs_human ("auditor_start_time", |
2699 | "start_ppc_refund_serial_id", | 2718 | start_time), |
2700 | (json_int_t) ppc_start.last_refund_serial_id, | 2719 | TALER_JSON_pack_time_abs_human ("auditor_end_time", |
2701 | "start_ppc_recoup_serial_id", | 2720 | GNUNET_TIME_absolute_get ()), |
2702 | (json_int_t) ppc_start.last_recoup_serial_id, | 2721 | TALER_JSON_pack_amount ("total_irregular_recoups", |
2703 | /* Block #6 */ | 2722 | &total_irregular_recoups), |
2704 | "start_ppc_recoup_refresh_serial_id", | 2723 | GNUNET_JSON_pack_array_steal ("unsigned_denominations", |
2705 | (json_int_t) ppc_start. | 2724 | report_denominations_without_sigs))); |
2706 | last_recoup_refresh_serial_id, | ||
2707 | "end_ppc_withdraw_serial_id", | ||
2708 | (json_int_t) ppc.last_withdraw_serial_id, | ||
2709 | "end_ppc_deposit_serial_id", | ||
2710 | (json_int_t) ppc.last_deposit_serial_id, | ||
2711 | "end_ppc_melt_serial_id", | ||
2712 | (json_int_t) ppc.last_melt_serial_id, | ||
2713 | "end_ppc_refund_serial_id", | ||
2714 | (json_int_t) ppc.last_refund_serial_id, | ||
2715 | /* Block #7 */ | ||
2716 | "end_ppc_recoup_serial_id", | ||
2717 | (json_int_t) ppc.last_recoup_serial_id, | ||
2718 | "end_ppc_recoup_refresh_serial_id", | ||
2719 | (json_int_t) ppc.last_recoup_refresh_serial_id, | ||
2720 | "auditor_start_time", | ||
2721 | TALER_ARL_json_from_time_abs ( | ||
2722 | start_time), | ||
2723 | "auditor_end_time", | ||
2724 | TALER_ARL_json_from_time_abs ( | ||
2725 | GNUNET_TIME_absolute_get ()), | ||
2726 | "total_irregular_recoups", | ||
2727 | TALER_JSON_from_amount ( | ||
2728 | &total_irregular_recoups), | ||
2729 | /* Block #8 */ | ||
2730 | "unsigned_denominations", | ||
2731 | report_denominations_without_sigs | ||
2732 | ); | ||
2733 | GNUNET_break (NULL != report); | ||
2734 | TALER_ARL_done (report); | ||
2735 | } | 2725 | } |
2736 | 2726 | ||
2737 | 2727 | ||
@@ -2769,7 +2759,7 @@ main (int argc, | |||
2769 | if (GNUNET_OK != | 2759 | if (GNUNET_OK != |
2770 | GNUNET_STRINGS_get_utf8_args (argc, argv, | 2760 | GNUNET_STRINGS_get_utf8_args (argc, argv, |
2771 | &argc, &argv)) | 2761 | &argc, &argv)) |
2772 | return 4; | 2762 | return EXIT_INVALIDARGUMENT; |
2773 | ret = GNUNET_PROGRAM_run ( | 2763 | ret = GNUNET_PROGRAM_run ( |
2774 | argc, | 2764 | argc, |
2775 | argv, | 2765 | argv, |
@@ -2780,9 +2770,9 @@ main (int argc, | |||
2780 | NULL); | 2770 | NULL); |
2781 | GNUNET_free_nz ((void *) argv); | 2771 | GNUNET_free_nz ((void *) argv); |
2782 | if (GNUNET_SYSERR == ret) | 2772 | if (GNUNET_SYSERR == ret) |
2783 | return 3; | 2773 | return EXIT_INVALIDARGUMENT; |
2784 | if (GNUNET_NO == ret) | 2774 | if (GNUNET_NO == ret) |
2785 | return 0; | 2775 | return EXIT_SUCCESS; |
2786 | return global_ret; | 2776 | return global_ret; |
2787 | } | 2777 | } |
2788 | 2778 | ||
diff --git a/src/auditor/taler-helper-auditor-deposits.c b/src/auditor/taler-helper-auditor-deposits.c index a0a86540f..17b32f25e 100644 --- a/src/auditor/taler-helper-auditor-deposits.c +++ b/src/auditor/taler-helper-auditor-deposits.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of TALER | 2 | This file is part of TALER |
3 | Copyright (C) 2016-2020 Taler Systems SA | 3 | Copyright (C) 2016-2021 Taler Systems SA |
4 | 4 | ||
5 | TALER is free software; you can redistribute it and/or modify it under the | 5 | TALER is free software; you can redistribute it and/or modify it under the |
6 | terms of the GNU Affero Public License as published by the Free Software | 6 | terms of the GNU Affero Public License as published by the Free Software |
@@ -146,16 +146,15 @@ test_dc (void *cls, | |||
146 | } | 146 | } |
147 | /* deposit confirmation missing! report! */ | 147 | /* deposit confirmation missing! report! */ |
148 | TALER_ARL_report (report_deposit_confirmation_inconsistencies, | 148 | TALER_ARL_report (report_deposit_confirmation_inconsistencies, |
149 | json_pack ("{s:o, s:o, s:I, s:o}", | 149 | GNUNET_JSON_PACK ( |
150 | "timestamp", | 150 | TALER_JSON_pack_time_abs_human ("timestamp", |
151 | TALER_ARL_json_from_time_abs ( | 151 | dc->exchange_timestamp), |
152 | dc->exchange_timestamp), | 152 | TALER_JSON_pack_amount ("amount", |
153 | "amount", | 153 | &dc->amount_without_fee), |
154 | TALER_JSON_from_amount (&dc->amount_without_fee), | 154 | GNUNET_JSON_pack_uint64 ("rowid", |
155 | "rowid", | 155 | serial_id), |
156 | (json_int_t) serial_id, | 156 | GNUNET_JSON_pack_data_auto ("account", |
157 | "account", | 157 | &dc->h_wire))); |
158 | GNUNET_JSON_from_data_auto (&dc->h_wire))); | ||
159 | dcc->first_missed_coin_serial = GNUNET_MIN (dcc->first_missed_coin_serial, | 158 | dcc->first_missed_coin_serial = GNUNET_MIN (dcc->first_missed_coin_serial, |
160 | serial_id); | 159 | serial_id); |
161 | dcc->missed_count++; | 160 | dcc->missed_count++; |
@@ -295,7 +294,7 @@ run (void *cls, | |||
295 | if (GNUNET_OK != | 294 | if (GNUNET_OK != |
296 | TALER_ARL_init (c)) | 295 | TALER_ARL_init (c)) |
297 | { | 296 | { |
298 | global_ret = 1; | 297 | global_ret = EXIT_FAILURE; |
299 | return; | 298 | return; |
300 | } | 299 | } |
301 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 300 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -306,32 +305,23 @@ run (void *cls, | |||
306 | TALER_ARL_setup_sessions_and_run (&analyze_deposit_confirmations, | 305 | TALER_ARL_setup_sessions_and_run (&analyze_deposit_confirmations, |
307 | NULL)) | 306 | NULL)) |
308 | { | 307 | { |
309 | global_ret = 1; | 308 | global_ret = EXIT_FAILURE; |
310 | return; | 309 | return; |
311 | } | 310 | } |
312 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 311 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
313 | "Deposit audit complete\n"); | 312 | "Deposit audit complete\n"); |
314 | { | 313 | TALER_ARL_done ( |
315 | json_t *report; | 314 | GNUNET_JSON_PACK ( |
316 | 315 | GNUNET_JSON_pack_array_steal ("deposit_confirmation_inconsistencies", | |
317 | report = json_pack ("{s:o, s:I, s:o, s:o, s:o}", | 316 | report_deposit_confirmation_inconsistencies), |
318 | "deposit_confirmation_inconsistencies", | 317 | GNUNET_JSON_pack_uint64 ("missing_deposit_confirmation_count", |
319 | report_deposit_confirmation_inconsistencies, | 318 | number_missed_deposit_confirmations), |
320 | "missing_deposit_confirmation_count", | 319 | TALER_JSON_pack_amount ("missing_deposit_confirmation_total", |
321 | (json_int_t) number_missed_deposit_confirmations, | 320 | &total_missed_deposit_confirmations), |
322 | "missing_deposit_confirmation_total", | 321 | TALER_JSON_pack_time_abs_human ("auditor_start_time", |
323 | TALER_JSON_from_amount ( | 322 | start_time), |
324 | &total_missed_deposit_confirmations), | 323 | TALER_JSON_pack_time_abs_human ("auditor_end_time", |
325 | "auditor_start_time", | 324 | GNUNET_TIME_absolute_get ()))); |
326 | TALER_ARL_json_from_time_abs ( | ||
327 | start_time), | ||
328 | "auditor_end_time", | ||
329 | TALER_ARL_json_from_time_abs ( | ||
330 | GNUNET_TIME_absolute_get ()) | ||
331 | ); | ||
332 | GNUNET_break (NULL != report); | ||
333 | TALER_ARL_done (report); | ||
334 | } | ||
335 | } | 325 | } |
336 | 326 | ||
337 | 327 | ||
@@ -369,7 +359,7 @@ main (int argc, | |||
369 | if (GNUNET_OK != | 359 | if (GNUNET_OK != |
370 | GNUNET_STRINGS_get_utf8_args (argc, argv, | 360 | GNUNET_STRINGS_get_utf8_args (argc, argv, |
371 | &argc, &argv)) | 361 | &argc, &argv)) |
372 | return 4; | 362 | return EXIT_INVALIDARGUMENT; |
373 | ret = GNUNET_PROGRAM_run ( | 363 | ret = GNUNET_PROGRAM_run ( |
374 | argc, | 364 | argc, |
375 | argv, | 365 | argv, |
@@ -381,9 +371,9 @@ main (int argc, | |||
381 | NULL); | 371 | NULL); |
382 | GNUNET_free_nz ((void *) argv); | 372 | GNUNET_free_nz ((void *) argv); |
383 | if (GNUNET_SYSERR == ret) | 373 | if (GNUNET_SYSERR == ret) |
384 | return 3; | 374 | return EXIT_INVALIDARGUMENT; |
385 | if (GNUNET_NO == ret) | 375 | if (GNUNET_NO == ret) |
386 | return 0; | 376 | return EXIT_SUCCESS; |
387 | return global_ret; | 377 | return global_ret; |
388 | } | 378 | } |
389 | 379 | ||
diff --git a/src/auditor/taler-helper-auditor-reserves.c b/src/auditor/taler-helper-auditor-reserves.c index 41580e0c7..22d7f5c27 100644 --- a/src/auditor/taler-helper-auditor-reserves.c +++ b/src/auditor/taler-helper-auditor-reserves.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of TALER | 2 | This file is part of TALER |
3 | Copyright (C) 2016-2020 Taler Systems SA | 3 | Copyright (C) 2016-2021 Taler Systems SA |
4 | 4 | ||
5 | TALER is free software; you can redistribute it and/or modify it under the | 5 | TALER is free software; you can redistribute it and/or modify it under the |
6 | terms of the GNU Affero Public License as published by the Free Software | 6 | terms of the GNU Affero Public License as published by the Free Software |
@@ -191,12 +191,17 @@ report_amount_arithmetic_inconsistency ( | |||
191 | exchange); | 191 | exchange); |
192 | } | 192 | } |
193 | TALER_ARL_report (report_amount_arithmetic_inconsistencies, | 193 | TALER_ARL_report (report_amount_arithmetic_inconsistencies, |
194 | json_pack ("{s:s, s:I, s:o, s:o, s:I}", | 194 | GNUNET_JSON_PACK ( |
195 | "operation", operation, | 195 | GNUNET_JSON_pack_string ("operation", |
196 | "rowid", (json_int_t) rowid, | 196 | operation), |
197 | "exchange", TALER_JSON_from_amount (exchange), | 197 | GNUNET_JSON_pack_uint64 ("rowid", |
198 | "auditor", TALER_JSON_from_amount (auditor), | 198 | rowid), |
199 | "profitable", (json_int_t) profitable)); | 199 | TALER_JSON_pack_amount ("exchange", |
200 | exchange), | ||
201 | TALER_JSON_pack_amount ("auditor", | ||
202 | auditor), | ||
203 | GNUNET_JSON_pack_int64 ("profitable", | ||
204 | profitable))); | ||
200 | if (0 != profitable) | 205 | if (0 != profitable) |
201 | { | 206 | { |
202 | target = (1 == profitable) | 207 | target = (1 == profitable) |
@@ -222,10 +227,13 @@ report_row_inconsistency (const char *table, | |||
222 | const char *diagnostic) | 227 | const char *diagnostic) |
223 | { | 228 | { |
224 | TALER_ARL_report (report_row_inconsistencies, | 229 | TALER_ARL_report (report_row_inconsistencies, |
225 | json_pack ("{s:s, s:I, s:s}", | 230 | GNUNET_JSON_PACK ( |
226 | "table", table, | 231 | GNUNET_JSON_pack_string ("table", |
227 | "row", (json_int_t) rowid, | 232 | table), |
228 | "diagnostic", diagnostic)); | 233 | GNUNET_JSON_pack_uint64 ("row", |
234 | rowid), | ||
235 | GNUNET_JSON_pack_string ("diagnostic", | ||
236 | diagnostic))); | ||
229 | } | 237 | } |
230 | 238 | ||
231 | 239 | ||
@@ -549,14 +557,15 @@ handle_reserve_out (void *cls, | |||
549 | (expire_withdraw.abs_value_us < execution_date.abs_value_us) ) | 557 | (expire_withdraw.abs_value_us < execution_date.abs_value_us) ) |
550 | { | 558 | { |
551 | TALER_ARL_report (denomination_key_validity_withdraw_inconsistencies, | 559 | TALER_ARL_report (denomination_key_validity_withdraw_inconsistencies, |
552 | json_pack ("{s:I, s:o, s:o, s:o}", | 560 | GNUNET_JSON_PACK ( |
553 | "row", (json_int_t) rowid, | 561 | GNUNET_JSON_pack_uint64 ("row", |
554 | "execution_date", | 562 | rowid), |
555 | TALER_ARL_json_from_time_abs (execution_date), | 563 | TALER_JSON_pack_time_abs_human ("execution_date", |
556 | "reserve_pub", GNUNET_JSON_from_data_auto ( | 564 | execution_date), |
557 | reserve_pub), | 565 | GNUNET_JSON_pack_data_auto ("reserve_pub", |
558 | "denompub_h", GNUNET_JSON_from_data_auto ( | 566 | reserve_pub), |
559 | &wsrd.h_denomination_pub))); | 567 | GNUNET_JSON_pack_data_auto ("denompub_h", |
568 | &wsrd.h_denomination_pub))); | ||
560 | } | 569 | } |
561 | 570 | ||
562 | /* check reserve_sig (first: setup remaining members of wsrd) */ | 571 | /* check reserve_sig (first: setup remaining members of wsrd) */ |
@@ -569,13 +578,15 @@ handle_reserve_out (void *cls, | |||
569 | &reserve_pub->eddsa_pub)) | 578 | &reserve_pub->eddsa_pub)) |
570 | { | 579 | { |
571 | TALER_ARL_report (report_bad_sig_losses, | 580 | TALER_ARL_report (report_bad_sig_losses, |
572 | json_pack ("{s:s, s:I, s:o, s:o}", | 581 | GNUNET_JSON_PACK ( |
573 | "operation", "withdraw", | 582 | GNUNET_JSON_pack_string ("operation", |
574 | "row", (json_int_t) rowid, | 583 | "withdraw"), |
575 | "loss", TALER_JSON_from_amount ( | 584 | GNUNET_JSON_pack_uint64 ("row", |
576 | amount_with_fee), | 585 | rowid), |
577 | "key_pub", GNUNET_JSON_from_data_auto ( | 586 | TALER_JSON_pack_amount ("loss", |
578 | reserve_pub))); | 587 | amount_with_fee), |
588 | GNUNET_JSON_pack_data_auto ("key_pub", | ||
589 | reserve_pub))); | ||
579 | TALER_ARL_amount_add (&total_bad_sig_loss, | 590 | TALER_ARL_amount_add (&total_bad_sig_loss, |
580 | &total_bad_sig_loss, | 591 | &total_bad_sig_loss, |
581 | amount_with_fee); | 592 | amount_with_fee); |
@@ -712,12 +723,15 @@ handle_recoup_by_reserve ( | |||
712 | &coin->coin_pub.eddsa_pub)) | 723 | &coin->coin_pub.eddsa_pub)) |
713 | { | 724 | { |
714 | TALER_ARL_report (report_bad_sig_losses, | 725 | TALER_ARL_report (report_bad_sig_losses, |
715 | json_pack ("{s:s, s:I, s:o, s:o}", | 726 | GNUNET_JSON_PACK ( |
716 | "operation", "recoup", | 727 | GNUNET_JSON_pack_string ("operation", |
717 | "row", (json_int_t) rowid, | 728 | "recoup"), |
718 | "loss", TALER_JSON_from_amount (amount), | 729 | GNUNET_JSON_pack_uint64 ("row", |
719 | "key_pub", GNUNET_JSON_from_data_auto ( | 730 | rowid), |
720 | &coin->coin_pub))); | 731 | TALER_JSON_pack_amount ("loss", |
732 | amount), | ||
733 | GNUNET_JSON_pack_data_auto ("key_pub", | ||
734 | &coin->coin_pub))); | ||
721 | TALER_ARL_amount_add (&total_bad_sig_loss, | 735 | TALER_ARL_amount_add (&total_bad_sig_loss, |
722 | &total_bad_sig_loss, | 736 | &total_bad_sig_loss, |
723 | amount); | 737 | amount); |
@@ -778,12 +792,15 @@ handle_recoup_by_reserve ( | |||
778 | (0 == strcmp (rev, "master signature invalid")) ) | 792 | (0 == strcmp (rev, "master signature invalid")) ) |
779 | { | 793 | { |
780 | TALER_ARL_report (report_bad_sig_losses, | 794 | TALER_ARL_report (report_bad_sig_losses, |
781 | json_pack ("{s:s, s:I, s:o, s:o}", | 795 | GNUNET_JSON_PACK ( |
782 | "operation", "recoup-master", | 796 | GNUNET_JSON_pack_string ("operation", |
783 | "row", (json_int_t) rev_rowid, | 797 | "recoup-master"), |
784 | "loss", TALER_JSON_from_amount (amount), | 798 | GNUNET_JSON_pack_uint64 ("row", |
785 | "key_pub", GNUNET_JSON_from_data_auto ( | 799 | rev_rowid), |
786 | &TALER_ARL_master_pub))); | 800 | TALER_JSON_pack_amount ("loss", |
801 | amount), | ||
802 | GNUNET_JSON_pack_data_auto ("key_pub", | ||
803 | &TALER_ARL_master_pub))); | ||
787 | TALER_ARL_amount_add (&total_bad_sig_loss, | 804 | TALER_ARL_amount_add (&total_bad_sig_loss, |
788 | &total_bad_sig_loss, | 805 | &total_bad_sig_loss, |
789 | amount); | 806 | amount); |
@@ -1051,11 +1068,11 @@ verify_reserve_balance (void *cls, | |||
1051 | &total_balance_insufficient_loss, | 1068 | &total_balance_insufficient_loss, |
1052 | &loss); | 1069 | &loss); |
1053 | TALER_ARL_report (report_reserve_balance_insufficient_inconsistencies, | 1070 | TALER_ARL_report (report_reserve_balance_insufficient_inconsistencies, |
1054 | json_pack ("{s:o, s:o}", | 1071 | GNUNET_JSON_PACK ( |
1055 | "reserve_pub", | 1072 | GNUNET_JSON_pack_data_auto ("reserve_pub", |
1056 | GNUNET_JSON_from_data_auto (&rs->reserve_pub), | 1073 | &rs->reserve_pub), |
1057 | "loss", | 1074 | TALER_JSON_pack_amount ("loss", |
1058 | TALER_JSON_from_amount (&loss))); | 1075 | &loss))); |
1059 | /* Continue with a reserve balance of zero */ | 1076 | /* Continue with a reserve balance of zero */ |
1060 | GNUNET_assert (GNUNET_OK == | 1077 | GNUNET_assert (GNUNET_OK == |
1061 | TALER_amount_set_zero (balance.currency, | 1078 | TALER_amount_set_zero (balance.currency, |
@@ -1083,12 +1100,11 @@ verify_reserve_balance (void *cls, | |||
1083 | not an actualized gain and could be trivially corrected by | 1100 | not an actualized gain and could be trivially corrected by |
1084 | restoring the summary. */// | 1101 | restoring the summary. */// |
1085 | TALER_ARL_report (report_reserve_balance_insufficient_inconsistencies, | 1102 | TALER_ARL_report (report_reserve_balance_insufficient_inconsistencies, |
1086 | json_pack ("{s:o, s:o}", | 1103 | GNUNET_JSON_PACK ( |
1087 | "reserve_pub", | 1104 | GNUNET_JSON_pack_data_auto ("reserve_pub", |
1088 | GNUNET_JSON_from_data_auto ( | 1105 | &rs->reserve_pub), |
1089 | &rs->reserve_pub), | 1106 | TALER_JSON_pack_amount ("gain", |
1090 | "gain", | 1107 | &nbalance))); |
1091 | TALER_JSON_from_amount (&nbalance))); | ||
1092 | if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs) | 1108 | if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs) |
1093 | { | 1109 | { |
1094 | GNUNET_break (0); | 1110 | GNUNET_break (0); |
@@ -1126,14 +1142,13 @@ verify_reserve_balance (void *cls, | |||
1126 | &delta); | 1142 | &delta); |
1127 | } | 1143 | } |
1128 | TALER_ARL_report (report_reserve_balance_summary_wrong_inconsistencies, | 1144 | TALER_ARL_report (report_reserve_balance_summary_wrong_inconsistencies, |
1129 | json_pack ("{s:o, s:o, s:o}", | 1145 | GNUNET_JSON_PACK ( |
1130 | "reserve_pub", | 1146 | GNUNET_JSON_pack_data_auto ("reserve_pub", |
1131 | GNUNET_JSON_from_data_auto ( | 1147 | &rs->reserve_pub), |
1132 | &rs->reserve_pub), | 1148 | TALER_JSON_pack_amount ("exchange", |
1133 | "exchange", | 1149 | &reserve.balance), |
1134 | TALER_JSON_from_amount (&reserve.balance), | 1150 | TALER_JSON_pack_amount ("auditor", |
1135 | "auditor", | 1151 | &nbalance))); |
1136 | TALER_JSON_from_amount (&nbalance))); | ||
1137 | } | 1152 | } |
1138 | } | 1153 | } |
1139 | } /* end of 'if (internal_checks)' */ | 1154 | } /* end of 'if (internal_checks)' */ |
@@ -1160,16 +1175,15 @@ verify_reserve_balance (void *cls, | |||
1160 | TALER_ARL_amount_add (&total_balance_reserve_not_closed, | 1175 | TALER_ARL_amount_add (&total_balance_reserve_not_closed, |
1161 | &total_balance_reserve_not_closed, | 1176 | &total_balance_reserve_not_closed, |
1162 | &nbalance); | 1177 | &nbalance); |
1163 | TALER_ARL_report (report_reserve_not_closed_inconsistencies, | 1178 | TALER_ARL_report ( |
1164 | json_pack ("{s:o, s:o, s:o}", | 1179 | report_reserve_not_closed_inconsistencies, |
1165 | "reserve_pub", | 1180 | GNUNET_JSON_PACK ( |
1166 | GNUNET_JSON_from_data_auto ( | 1181 | GNUNET_JSON_pack_data_auto ("reserve_pub", |
1167 | &rs->reserve_pub), | 1182 | &rs->reserve_pub), |
1168 | "balance", | 1183 | TALER_JSON_pack_amount ("balance", |
1169 | TALER_JSON_from_amount (&nbalance), | 1184 | &nbalance), |
1170 | "expiration_time", | 1185 | TALER_JSON_pack_time_abs_human ("expiration_time", |
1171 | TALER_ARL_json_from_time_abs ( | 1186 | rs->a_expiration_date))); |
1172 | rs->a_expiration_date))); | ||
1173 | } | 1187 | } |
1174 | } | 1188 | } |
1175 | else | 1189 | else |
@@ -1179,17 +1193,15 @@ verify_reserve_balance (void *cls, | |||
1179 | &total_balance_reserve_not_closed, | 1193 | &total_balance_reserve_not_closed, |
1180 | &nbalance); | 1194 | &nbalance); |
1181 | TALER_ARL_report (report_reserve_not_closed_inconsistencies, | 1195 | TALER_ARL_report (report_reserve_not_closed_inconsistencies, |
1182 | json_pack ("{s:o, s:o, s:o, s:s}", | 1196 | GNUNET_JSON_PACK ( |
1183 | "reserve_pub", | 1197 | GNUNET_JSON_pack_data_auto ("reserve_pub", |
1184 | GNUNET_JSON_from_data_auto ( | 1198 | &rs->reserve_pub), |
1185 | &rs->reserve_pub), | 1199 | TALER_JSON_pack_amount ("balance", |
1186 | "balance", | 1200 | &nbalance), |
1187 | TALER_JSON_from_amount (&nbalance), | 1201 | TALER_JSON_pack_time_abs_human ("expiration_time", |
1188 | "expiration_time", | 1202 | rs->a_expiration_date), |
1189 | TALER_ARL_json_from_time_abs ( | 1203 | GNUNET_JSON_pack_string ("diagnostic", |
1190 | rs->a_expiration_date), | 1204 | "could not determine closing fee"))); |
1191 | "diagnostic", | ||
1192 | "could not determine closing fee")); | ||
1193 | } | 1205 | } |
1194 | } | 1206 | } |
1195 | 1207 | ||
@@ -1489,7 +1501,7 @@ run (void *cls, | |||
1489 | if (GNUNET_OK != | 1501 | if (GNUNET_OK != |
1490 | TALER_ARL_init (c)) | 1502 | TALER_ARL_init (c)) |
1491 | { | 1503 | { |
1492 | global_ret = 1; | 1504 | global_ret = EXIT_FAILURE; |
1493 | return; | 1505 | return; |
1494 | } | 1506 | } |
1495 | if (GNUNET_OK != | 1507 | if (GNUNET_OK != |
@@ -1501,7 +1513,7 @@ run (void *cls, | |||
1501 | GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, | 1513 | GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, |
1502 | "exchangedb", | 1514 | "exchangedb", |
1503 | "IDLE_RESERVE_EXPIRATION_TIME"); | 1515 | "IDLE_RESERVE_EXPIRATION_TIME"); |
1504 | global_ret = 1; | 1516 | global_ret = EXIT_FAILURE; |
1505 | return; | 1517 | return; |
1506 | } | 1518 | } |
1507 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1519 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -1559,103 +1571,77 @@ run (void *cls, | |||
1559 | TALER_ARL_setup_sessions_and_run (&analyze_reserves, | 1571 | TALER_ARL_setup_sessions_and_run (&analyze_reserves, |
1560 | NULL)) | 1572 | NULL)) |
1561 | { | 1573 | { |
1562 | global_ret = 1; | 1574 | global_ret = EXIT_FAILURE; |
1563 | return; | 1575 | return; |
1564 | } | 1576 | } |
1565 | { | 1577 | TALER_ARL_done ( |
1566 | json_t *report; | 1578 | GNUNET_JSON_PACK ( |
1567 | 1579 | GNUNET_JSON_pack_array_steal ( | |
1568 | report = json_pack ("{s:o, s:o, s:o, s:o, s:o," | 1580 | "reserve_balance_insufficient_inconsistencies", |
1569 | " s:o, s:o, s:o, s:o, s:o," | 1581 | report_reserve_balance_insufficient_inconsistencies), |
1570 | " s:o, s:o, s:o, s:o, s:o," | 1582 | /* Tested in test-auditor.sh #3 */ |
1571 | " s:o, s:o, s:o, s:o, s:I," | 1583 | TALER_JSON_pack_amount ("total_loss_balance_insufficient", |
1572 | " s:I, s:I, s:I, s:I, s:I," | 1584 | &total_balance_insufficient_loss), |
1573 | " s:I, s:I }", | 1585 | /* Tested in test-auditor.sh #3 */ |
1574 | /* blocks #1 */ | 1586 | GNUNET_JSON_pack_array_steal ( |
1575 | "reserve_balance_insufficient_inconsistencies", | 1587 | "reserve_balance_summary_wrong_inconsistencies", |
1576 | report_reserve_balance_insufficient_inconsistencies, | 1588 | report_reserve_balance_summary_wrong_inconsistencies), |
1577 | /* Tested in test-auditor.sh #3 */ | 1589 | TALER_JSON_pack_amount ("total_balance_summary_delta_plus", |
1578 | "total_loss_balance_insufficient", | 1590 | &total_balance_summary_delta_plus), |
1579 | TALER_JSON_from_amount ( | 1591 | TALER_JSON_pack_amount ("total_balance_summary_delta_minus", |
1580 | &total_balance_insufficient_loss), | 1592 | &total_balance_summary_delta_minus), |
1581 | /* Tested in test-auditor.sh #3 */ | 1593 | /* blocks #2 */ |
1582 | "reserve_balance_summary_wrong_inconsistencies", | 1594 | TALER_JSON_pack_amount ("total_escrow_balance", |
1583 | report_reserve_balance_summary_wrong_inconsistencies, | 1595 | &total_escrow_balance), |
1584 | "total_balance_summary_delta_plus", | 1596 | TALER_JSON_pack_amount ("total_withdraw_fee_income", |
1585 | TALER_JSON_from_amount ( | 1597 | &total_withdraw_fee_income), |
1586 | &total_balance_summary_delta_plus), | 1598 | /* Tested in test-auditor.sh #21 */ |
1587 | "total_balance_summary_delta_minus", | 1599 | GNUNET_JSON_pack_array_steal ("reserve_not_closed_inconsistencies", |
1588 | TALER_JSON_from_amount ( | 1600 | report_reserve_not_closed_inconsistencies), |
1589 | &total_balance_summary_delta_minus), | 1601 | /* Tested in test-auditor.sh #21 */ |
1590 | /* blocks #2 */ | 1602 | TALER_JSON_pack_amount ("total_balance_reserve_not_closed", |
1591 | "total_escrow_balance", | 1603 | &total_balance_reserve_not_closed), |
1592 | TALER_JSON_from_amount (&total_escrow_balance), | 1604 | /* Tested in test-auditor.sh #7 */ |
1593 | "total_withdraw_fee_income", | 1605 | GNUNET_JSON_pack_array_steal ("bad_sig_losses", |
1594 | TALER_JSON_from_amount ( | 1606 | report_bad_sig_losses), |
1595 | &total_withdraw_fee_income), | 1607 | /* Tested in test-auditor.sh #7 */ |
1596 | /* Tested in test-auditor.sh #21 */ | 1608 | TALER_JSON_pack_amount ("total_bad_sig_loss", |
1597 | "reserve_not_closed_inconsistencies", | 1609 | &total_bad_sig_loss), |
1598 | report_reserve_not_closed_inconsistencies, | 1610 | /* Tested in test-revocation.sh #4 */ |
1599 | /* Tested in test-auditor.sh #21 */ | 1611 | GNUNET_JSON_pack_array_steal ("row_inconsistencies", |
1600 | "total_balance_reserve_not_closed", | 1612 | report_row_inconsistencies), |
1601 | TALER_JSON_from_amount ( | 1613 | /* Tested in test-auditor.sh #23 */ |
1602 | &total_balance_reserve_not_closed), | 1614 | GNUNET_JSON_pack_array_steal ( |
1603 | /* Tested in test-auditor.sh #7 */ | 1615 | "denomination_key_validity_withdraw_inconsistencies", |
1604 | "bad_sig_losses", | 1616 | denomination_key_validity_withdraw_inconsistencies), |
1605 | report_bad_sig_losses, | 1617 | GNUNET_JSON_pack_array_steal ("amount_arithmetic_inconsistencies", |
1606 | /* blocks #3 */ | 1618 | report_amount_arithmetic_inconsistencies), |
1607 | /* Tested in test-auditor.sh #7 */ | 1619 | TALER_JSON_pack_amount ("total_arithmetic_delta_plus", |
1608 | "total_bad_sig_loss", | 1620 | &total_arithmetic_delta_plus), |
1609 | TALER_JSON_from_amount (&total_bad_sig_loss), | 1621 | TALER_JSON_pack_amount ("total_arithmetic_delta_minus", |
1610 | /* Tested in test-revocation.sh #4 */ | 1622 | &total_arithmetic_delta_minus), |
1611 | "row_inconsistencies", | 1623 | TALER_JSON_pack_time_abs_human ("auditor_start_time", |
1612 | report_row_inconsistencies, | 1624 | start_time), |
1613 | /* Tested in test-auditor.sh #23 */ | 1625 | TALER_JSON_pack_time_abs_human ("auditor_end_time", |
1614 | "denomination_key_validity_withdraw_inconsistencies", | 1626 | GNUNET_TIME_absolute_get ()), |
1615 | denomination_key_validity_withdraw_inconsistencies, | 1627 | TALER_JSON_pack_amount ("total_irregular_recoups", |
1616 | "amount_arithmetic_inconsistencies", | 1628 | &total_irregular_recoups), |
1617 | report_amount_arithmetic_inconsistencies, | 1629 | GNUNET_JSON_pack_uint64 ("start_ppr_reserve_in_serial_id", |
1618 | "total_arithmetic_delta_plus", | 1630 | ppr_start.last_reserve_in_serial_id), |
1619 | TALER_JSON_from_amount ( | 1631 | GNUNET_JSON_pack_uint64 ("start_ppr_reserve_out_serial_id", |
1620 | &total_arithmetic_delta_plus), | 1632 | ppr_start.last_reserve_out_serial_id), |
1621 | /* blocks #4 */ | 1633 | GNUNET_JSON_pack_uint64 ("start_ppr_reserve_recoup_serial_id", |
1622 | "total_arithmetic_delta_minus", | 1634 | ppr_start.last_reserve_recoup_serial_id), |
1623 | TALER_JSON_from_amount ( | 1635 | GNUNET_JSON_pack_uint64 ("start_ppr_reserve_close_serial_id", |
1624 | &total_arithmetic_delta_minus), | 1636 | ppr_start.last_reserve_close_serial_id), |
1625 | "auditor_start_time", | 1637 | GNUNET_JSON_pack_uint64 ("end_ppr_reserve_in_serial_id", |
1626 | TALER_ARL_json_from_time_abs ( | 1638 | ppr.last_reserve_in_serial_id), |
1627 | start_time), | 1639 | GNUNET_JSON_pack_uint64 ("end_ppr_reserve_out_serial_id", |
1628 | "auditor_end_time", | 1640 | ppr.last_reserve_out_serial_id), |
1629 | TALER_ARL_json_from_time_abs ( | 1641 | GNUNET_JSON_pack_uint64 ("end_ppr_reserve_recoup_serial_id", |
1630 | GNUNET_TIME_absolute_get ()), | 1642 | ppr.last_reserve_recoup_serial_id), |
1631 | "total_irregular_recoups", | 1643 | GNUNET_JSON_pack_uint64 ("end_ppr_reserve_close_serial_id", |
1632 | TALER_JSON_from_amount ( | 1644 | ppr.last_reserve_close_serial_id))); |
1633 | &total_irregular_recoups), | ||
1634 | "start_ppr_reserve_in_serial_id", | ||
1635 | (json_int_t) ppr_start.last_reserve_in_serial_id, | ||
1636 | /* blocks #5 */ | ||
1637 | "start_ppr_reserve_out_serial_id", | ||
1638 | (json_int_t) ppr_start. | ||
1639 | last_reserve_out_serial_id, | ||
1640 | "start_ppr_reserve_recoup_serial_id", | ||
1641 | (json_int_t) ppr_start. | ||
1642 | last_reserve_recoup_serial_id, | ||
1643 | "start_ppr_reserve_close_serial_id", | ||
1644 | (json_int_t) ppr_start. | ||
1645 | last_reserve_close_serial_id, | ||
1646 | "end_ppr_reserve_in_serial_id", | ||
1647 | (json_int_t) ppr.last_reserve_in_serial_id, | ||
1648 | "end_ppr_reserve_out_serial_id", | ||
1649 | (json_int_t) ppr.last_reserve_out_serial_id, | ||
1650 | /* blocks #6 */ | ||
1651 | "end_ppr_reserve_recoup_serial_id", | ||
1652 | (json_int_t) ppr.last_reserve_recoup_serial_id, | ||
1653 | "end_ppr_reserve_close_serial_id", | ||
1654 | (json_int_t) ppr.last_reserve_close_serial_id | ||
1655 | ); | ||
1656 | GNUNET_break (NULL != report); | ||
1657 | TALER_ARL_done (report); | ||
1658 | } | ||
1659 | } | 1645 | } |
1660 | 1646 | ||
1661 | 1647 | ||
@@ -1693,7 +1679,7 @@ main (int argc, | |||
1693 | if (GNUNET_OK != | 1679 | if (GNUNET_OK != |
1694 | GNUNET_STRINGS_get_utf8_args (argc, argv, | 1680 | GNUNET_STRINGS_get_utf8_args (argc, argv, |
1695 | &argc, &argv)) | 1681 | &argc, &argv)) |
1696 | return 4; | 1682 | return EXIT_INVALIDARGUMENT; |
1697 | ret = GNUNET_PROGRAM_run ( | 1683 | ret = GNUNET_PROGRAM_run ( |
1698 | argc, | 1684 | argc, |
1699 | argv, | 1685 | argv, |
@@ -1704,9 +1690,9 @@ main (int argc, | |||
1704 | NULL); | 1690 | NULL); |
1705 | GNUNET_free_nz ((void *) argv); | 1691 | GNUNET_free_nz ((void *) argv); |
1706 | if (GNUNET_SYSERR == ret) | 1692 | if (GNUNET_SYSERR == ret) |
1707 | return 3; | 1693 | return EXIT_INVALIDARGUMENT; |
1708 | if (GNUNET_NO == ret) | 1694 | if (GNUNET_NO == ret) |
1709 | return 0; | 1695 | return EXIT_SUCCESS; |
1710 | return global_ret; | 1696 | return global_ret; |
1711 | } | 1697 | } |
1712 | 1698 | ||
diff --git a/src/auditor/taler-helper-auditor-wire.c b/src/auditor/taler-helper-auditor-wire.c index 93834f46f..c0b25eed6 100644 --- a/src/auditor/taler-helper-auditor-wire.c +++ b/src/auditor/taler-helper-auditor-wire.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of TALER | 2 | This file is part of TALER |
3 | Copyright (C) 2017-2020 Taler Systems SA | 3 | Copyright (C) 2017-2021 Taler Systems SA |
4 | 4 | ||
5 | TALER is free software; you can redistribute it and/or modify it under the | 5 | TALER is free software; you can redistribute it and/or modify it under the |
6 | terms of the GNU General Public License as published by the Free Software | 6 | terms of the GNU General Public License as published by the Free Software |
@@ -457,93 +457,69 @@ do_shutdown (void *cls) | |||
457 | (void) cls; | 457 | (void) cls; |
458 | if (NULL != report_row_inconsistencies) | 458 | if (NULL != report_row_inconsistencies) |
459 | { | 459 | { |
460 | json_t *report; | ||
461 | |||
462 | GNUNET_assert (NULL != report_row_minor_inconsistencies); | 460 | GNUNET_assert (NULL != report_row_minor_inconsistencies); |
463 | report = json_pack ("{s:o, s:o, s:o, s:o, s:o," | 461 | TALER_ARL_done ( |
464 | " s:o, s:o, s:o, s:o, s:o," | 462 | GNUNET_JSON_PACK ( |
465 | " s:o, s:o, s:o, s:o, s:o," | 463 | /* Tested in test-auditor.sh #11, #15, #20 */ |
466 | " s:o, s:o, s:o, s:I, s:I," | 464 | GNUNET_JSON_pack_array_steal ("wire_out_amount_inconsistencies", |
467 | " s:o, s:o, s:o }", | 465 | report_wire_out_inconsistencies), |
468 | /* blocks of 5 */ | 466 | TALER_JSON_pack_amount ("total_wire_out_delta_plus", |
469 | /* Tested in test-auditor.sh #11, #15, #20 */ | 467 | &total_bad_amount_out_plus), |
470 | "wire_out_amount_inconsistencies", | 468 | /* Tested in test-auditor.sh #11, #15, #19 */ |
471 | report_wire_out_inconsistencies, | 469 | TALER_JSON_pack_amount ("total_wire_out_delta_minus", |
472 | "total_wire_out_delta_plus", | 470 | &total_bad_amount_out_minus), |
473 | TALER_JSON_from_amount ( | 471 | /* Tested in test-auditor.sh #2 */ |
474 | &total_bad_amount_out_plus), | 472 | GNUNET_JSON_pack_array_steal ("reserve_in_amount_inconsistencies", |
475 | /* Tested in test-auditor.sh #11, #15, #19 */ | 473 | report_reserve_in_inconsistencies), |
476 | "total_wire_out_delta_minus", | 474 | /* Tested in test-auditor.sh #2 */ |
477 | TALER_JSON_from_amount ( | 475 | TALER_JSON_pack_amount ("total_wire_in_delta_plus", |
478 | &total_bad_amount_out_minus), | 476 | &total_bad_amount_in_plus), |
479 | /* Tested in test-auditor.sh #2 */ | 477 | /* Tested in test-auditor.sh #3 */ |
480 | "reserve_in_amount_inconsistencies", | 478 | TALER_JSON_pack_amount ("total_wire_in_delta_minus", |
481 | report_reserve_in_inconsistencies, | 479 | &total_bad_amount_in_minus), |
482 | /* Tested in test-auditor.sh #2 */ | 480 | /* Tested in test-auditor.sh #9 */ |
483 | "total_wire_in_delta_plus", | 481 | GNUNET_JSON_pack_array_steal ("missattribution_in_inconsistencies", |
484 | TALER_JSON_from_amount ( | 482 | report_missattribution_in_inconsistencies), |
485 | &total_bad_amount_in_plus), | 483 | /* Tested in test-auditor.sh #9 */ |
486 | /* block */ | 484 | TALER_JSON_pack_amount ("total_missattribution_in", |
487 | /* Tested in test-auditor.sh #3 */ | 485 | &total_missattribution_in), |
488 | "total_wire_in_delta_minus", | 486 | GNUNET_JSON_pack_array_steal ("row_inconsistencies", |
489 | TALER_JSON_from_amount ( | 487 | report_row_inconsistencies), |
490 | &total_bad_amount_in_minus), | 488 | /* Tested in test-auditor.sh #10/#17 */ |
491 | /* Tested in test-auditor.sh #9 */ | 489 | GNUNET_JSON_pack_array_steal ("row_minor_inconsistencies", |
492 | "missattribution_in_inconsistencies", | 490 | report_row_minor_inconsistencies), |
493 | report_missattribution_in_inconsistencies, | 491 | /* Tested in test-auditor.sh #19 */ |
494 | /* Tested in test-auditor.sh #9 */ | 492 | TALER_JSON_pack_amount ("total_wire_format_amount", |
495 | "total_missattribution_in", | 493 | &total_wire_format_amount), |
496 | TALER_JSON_from_amount ( | 494 | /* Tested in test-auditor.sh #19 */ |
497 | &total_missattribution_in), | 495 | GNUNET_JSON_pack_array_steal ("wire_format_inconsistencies", |
498 | "row_inconsistencies", | 496 | report_wire_format_inconsistencies), |
499 | report_row_inconsistencies, | 497 | /* Tested in test-auditor.sh #1 */ |
500 | /* Tested in test-auditor.sh #10/#17 */ | 498 | TALER_JSON_pack_amount ("total_amount_lag", |
501 | "row_minor_inconsistencies", | 499 | &total_amount_lag), |
502 | report_row_minor_inconsistencies, | 500 | /* Tested in test-auditor.sh #1 */ |
503 | /* block */ | 501 | GNUNET_JSON_pack_array_steal ("lag_details", |
504 | /* Tested in test-auditor.sh #19 */ | 502 | report_lags), |
505 | "total_wire_format_amount", | 503 | /* Tested in test-auditor.sh #22 */ |
506 | TALER_JSON_from_amount ( | 504 | TALER_JSON_pack_amount ("total_closure_amount_lag", |
507 | &total_wire_format_amount), | 505 | &total_closure_amount_lag), |
508 | /* Tested in test-auditor.sh #19 */ | 506 | /* Tested in test-auditor.sh #22 */ |
509 | "wire_format_inconsistencies", | 507 | GNUNET_JSON_pack_array_steal ("reserve_lag_details", |
510 | report_wire_format_inconsistencies, | 508 | report_closure_lags), |
511 | /* Tested in test-auditor.sh #1 */ | 509 | TALER_JSON_pack_time_abs_human ("wire_auditor_start_time", |
512 | "total_amount_lag", | 510 | start_time), |
513 | TALER_JSON_from_amount (&total_amount_lag), | 511 | TALER_JSON_pack_time_abs_human ("wire_auditor_end_time", |
514 | /* Tested in test-auditor.sh #1 */ | 512 | GNUNET_TIME_absolute_get ()), |
515 | "lag_details", | 513 | GNUNET_JSON_pack_uint64 ("start_pp_reserve_close_uuid", |
516 | report_lags, | 514 | start_pp.last_reserve_close_uuid), |
517 | /* Tested in test-auditor.sh #22 */ | 515 | GNUNET_JSON_pack_uint64 ("end_pp_reserve_close_uuid", |
518 | "total_closure_amount_lag", | 516 | pp.last_reserve_close_uuid), |
519 | TALER_JSON_from_amount ( | 517 | TALER_JSON_pack_time_abs_human ("start_pp_last_timestamp", |
520 | &total_closure_amount_lag), | 518 | start_pp.last_timestamp), |
521 | /* blocks of 5 */ | 519 | TALER_JSON_pack_time_abs_human ("end_pp_last_timestamp", |
522 | /* Tested in test-auditor.sh #22 */ | 520 | pp.last_timestamp), |
523 | "reserve_lag_details", | 521 | GNUNET_JSON_pack_array_steal ("account_progress", |
524 | report_closure_lags, | 522 | report_account_progress))); |
525 | "wire_auditor_start_time", | ||
526 | TALER_ARL_json_from_time_abs ( | ||
527 | start_time), | ||
528 | "wire_auditor_end_time", | ||
529 | TALER_ARL_json_from_time_abs ( | ||
530 | GNUNET_TIME_absolute_get ()), | ||
531 | "start_pp_reserve_close_uuid", | ||
532 | (json_int_t) start_pp.last_reserve_close_uuid, | ||
533 | "end_pp_reserve_close_uuid", | ||
534 | (json_int_t) pp.last_reserve_close_uuid, | ||
535 | /* blocks of 5 */ | ||
536 | "start_pp_last_timestamp", | ||
537 | TALER_ARL_json_from_time_abs ( | ||
538 | start_pp.last_timestamp), | ||
539 | "end_pp_last_timestamp", | ||
540 | TALER_ARL_json_from_time_abs ( | ||
541 | pp.last_timestamp), | ||
542 | "account_progress", | ||
543 | report_account_progress | ||
544 | ); | ||
545 | GNUNET_break (NULL != report); | ||
546 | TALER_ARL_done (report); | ||
547 | report_wire_out_inconsistencies = NULL; | 523 | report_wire_out_inconsistencies = NULL; |
548 | report_reserve_in_inconsistencies = NULL; | 524 | report_reserve_in_inconsistencies = NULL; |
549 | report_row_inconsistencies = NULL; | 525 | report_row_inconsistencies = NULL; |
@@ -639,13 +615,17 @@ check_pending_rc (void *cls, | |||
639 | if ( (0 != rc->amount.value) || | 615 | if ( (0 != rc->amount.value) || |
640 | (0 != rc->amount.fraction) ) | 616 | (0 != rc->amount.fraction) ) |
641 | TALER_ARL_report (report_closure_lags, | 617 | TALER_ARL_report (report_closure_lags, |
642 | json_pack ("{s:I, s:o, s:o, s:o, s:s}", | 618 | GNUNET_JSON_PACK ( |
643 | "row", (json_int_t) rc->rowid, | 619 | GNUNET_JSON_pack_uint64 ("row", |
644 | "amount", TALER_JSON_from_amount (&rc->amount), | 620 | rc->rowid), |
645 | "deadline", TALER_ARL_json_from_time_abs ( | 621 | TALER_JSON_pack_amount ("amount", |
646 | rc->execution_date), | 622 | &rc->amount), |
647 | "wtid", GNUNET_JSON_from_data_auto (&rc->wtid), | 623 | TALER_JSON_pack_time_abs_human ("deadline", |
648 | "account", rc->receiver_account)); | 624 | rc->execution_date), |
625 | GNUNET_JSON_pack_data_auto ("wtid", | ||
626 | &rc->wtid), | ||
627 | GNUNET_JSON_pack_string ("account", | ||
628 | rc->receiver_account))); | ||
649 | pp.last_reserve_close_uuid | 629 | pp.last_reserve_close_uuid |
650 | = GNUNET_MIN (pp.last_reserve_close_uuid, | 630 | = GNUNET_MIN (pp.last_reserve_close_uuid, |
651 | rc->rowid); | 631 | rc->rowid); |
@@ -711,20 +691,19 @@ commit (enum GNUNET_DB_QueryStatus qs) | |||
711 | GNUNET_assert (0 == | 691 | GNUNET_assert (0 == |
712 | json_array_append_new ( | 692 | json_array_append_new ( |
713 | report_account_progress, | 693 | report_account_progress, |
714 | json_pack ( | 694 | GNUNET_JSON_PACK ( |
715 | "{s:s, s:I, s:I, s:I, s:I}", | 695 | GNUNET_JSON_pack_string ("account", |
716 | "account", | 696 | wa->section_name), |
717 | wa->section_name, | 697 | GNUNET_JSON_pack_uint64 ("start_reserve_in", |
718 | "start_reserve_in", | 698 | wa->start_pp. |
719 | (json_int_t) wa->start_pp.last_reserve_in_serial_id, | 699 | last_reserve_in_serial_id), |
720 | "end_reserve_in", | 700 | GNUNET_JSON_pack_uint64 ("end_reserve_in", |
721 | (json_int_t) wa->pp.last_reserve_in_serial_id, | 701 | wa->pp.last_reserve_in_serial_id), |
722 | "start_wire_out", | 702 | GNUNET_JSON_pack_uint64 ("start_wire_out", |
723 | (json_int_t) wa->start_pp.last_wire_out_serial_id, | 703 | wa->start_pp. |
724 | "end_wire_out", | 704 | last_wire_out_serial_id), |
725 | (json_int_t) wa->pp.last_wire_out_serial_id | 705 | GNUNET_JSON_pack_uint64 ("end_wire_out", |
726 | )) | 706 | wa->pp.last_wire_out_serial_id)))); |
727 | ); | ||
728 | if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == wa->qsx) | 707 | if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == wa->qsx) |
729 | qs = TALER_ARL_adb->update_wire_auditor_account_progress ( | 708 | qs = TALER_ARL_adb->update_wire_auditor_account_progress ( |
730 | TALER_ARL_adb->cls, | 709 | TALER_ARL_adb->cls, |
@@ -862,22 +841,24 @@ wire_missing_cb (void *cls, | |||
862 | &tiny_amount)) | 841 | &tiny_amount)) |
863 | return; /* acceptable, amount was tiny */ | 842 | return; /* acceptable, amount was tiny */ |
864 | } | 843 | } |
865 | rep = json_pack ("{s:I, s:o, s:o, s:o, s:O}", | 844 | rep = GNUNET_JSON_PACK ( |
866 | "row", (json_int_t) rowid, | 845 | GNUNET_JSON_pack_uint64 ("row", |
867 | "amount", TALER_JSON_from_amount (amount), | 846 | rowid), |
868 | "deadline", TALER_ARL_json_from_time_abs ( | 847 | TALER_JSON_pack_amount ("amount", |
869 | deadline), | 848 | amount), |
870 | "coin_pub", GNUNET_JSON_from_data_auto ( | 849 | TALER_JSON_pack_time_abs_human ("deadline", |
871 | coin_pub), | 850 | deadline), |
872 | "account", wire); | 851 | GNUNET_JSON_pack_data_auto ("coin_pub", |
873 | GNUNET_break (NULL != rep); | 852 | coin_pub), |
853 | GNUNET_JSON_pack_object_incref ("account", | ||
854 | (json_t *) wire)); | ||
874 | if (internal_checks) | 855 | if (internal_checks) |
875 | { | 856 | { |
876 | /* the 'done' bit is only useful in 'internal' mode */ | 857 | /* the 'done' bit is only useful in 'internal' mode */ |
877 | GNUNET_break (0 == | 858 | GNUNET_assert (0 == |
878 | json_object_set (rep, | 859 | json_object_set (rep, |
879 | "claimed_done", | 860 | "claimed_done", |
880 | json_string ((done) ? "yes" : "no"))); | 861 | json_string ((done) ? "yes" : "no"))); |
881 | } | 862 | } |
882 | TALER_ARL_report (report_lags, | 863 | TALER_ARL_report (report_lags, |
883 | rep); | 864 | rep); |
@@ -969,10 +950,13 @@ check_time_difference (const char *table, | |||
969 | GNUNET_STRINGS_relative_time_to_string (delta, | 950 | GNUNET_STRINGS_relative_time_to_string (delta, |
970 | GNUNET_YES)); | 951 | GNUNET_YES)); |
971 | TALER_ARL_report (report_row_minor_inconsistencies, | 952 | TALER_ARL_report (report_row_minor_inconsistencies, |
972 | json_pack ("{s:s, s:I, s:s}", | 953 | GNUNET_JSON_PACK ( |
973 | "table", table, | 954 | GNUNET_JSON_pack_string ("table", |
974 | "row", (json_int_t) rowid, | 955 | table), |
975 | "diagnostic", details)); | 956 | GNUNET_JSON_pack_uint64 ("row", |
957 | rowid), | ||
958 | GNUNET_JSON_pack_string ("diagnostic", | ||
959 | details))); | ||
976 | GNUNET_free (details); | 960 | GNUNET_free (details); |
977 | } | 961 | } |
978 | 962 | ||
@@ -1018,16 +1002,21 @@ wire_out_cb (void *cls, | |||
1018 | This is moderately harmless, it might just be that the aggreator | 1002 | This is moderately harmless, it might just be that the aggreator |
1019 | has not yet fully caught up with the transfers it should do. */ | 1003 | has not yet fully caught up with the transfers it should do. */ |
1020 | TALER_ARL_report (report_wire_out_inconsistencies, | 1004 | TALER_ARL_report (report_wire_out_inconsistencies, |
1021 | json_pack ("{s:I, s:o, s:o, s:o, s:o, s:s, s:s}", | 1005 | GNUNET_JSON_PACK ( |
1022 | "row", (json_int_t) rowid, | 1006 | GNUNET_JSON_pack_uint64 ("row", |
1023 | "amount_wired", TALER_JSON_from_amount (&zero), | 1007 | rowid), |
1024 | "amount_justified", TALER_JSON_from_amount ( | 1008 | TALER_JSON_pack_amount ("amount_wired", |
1025 | amount), | 1009 | &zero), |
1026 | "wtid", GNUNET_JSON_from_data_auto (wtid), | 1010 | TALER_JSON_pack_amount ("amount_justified", |
1027 | "timestamp", TALER_ARL_json_from_time_abs ( | 1011 | amount), |
1028 | date), | 1012 | GNUNET_JSON_pack_data_auto ("wtid", |
1029 | "diagnostic", "wire transfer not made (yet?)", | 1013 | wtid), |
1030 | "account_section", wa->section_name)); | 1014 | TALER_JSON_pack_time_abs_human ("timestamp", |
1015 | date), | ||
1016 | GNUNET_JSON_pack_string ("diagnostic", | ||
1017 | "wire transfer not made (yet?)"), | ||
1018 | GNUNET_JSON_pack_string ("account_section", | ||
1019 | wa->section_name))); | ||
1031 | TALER_ARL_amount_add (&total_bad_amount_out_minus, | 1020 | TALER_ARL_amount_add (&total_bad_amount_out_minus, |
1032 | &total_bad_amount_out_minus, | 1021 | &total_bad_amount_out_minus, |
1033 | amount); | 1022 | amount); |
@@ -1046,34 +1035,44 @@ wire_out_cb (void *cls, | |||
1046 | we should count the wire transfer as entirely spurious, and | 1035 | we should count the wire transfer as entirely spurious, and |
1047 | additionally consider the justified wire transfer as missing. */ | 1036 | additionally consider the justified wire transfer as missing. */ |
1048 | TALER_ARL_report (report_wire_out_inconsistencies, | 1037 | TALER_ARL_report (report_wire_out_inconsistencies, |
1049 | json_pack ("{s:I, s:o, s:o, s:o, s:o, s:s, s:s, s:s}", | 1038 | GNUNET_JSON_PACK ( |
1050 | "row", (json_int_t) rowid, | 1039 | GNUNET_JSON_pack_uint64 ("row", |
1051 | "amount_wired", TALER_JSON_from_amount ( | 1040 | rowid), |
1052 | &roi->details.amount), | 1041 | TALER_JSON_pack_amount ("amount_wired", |
1053 | "amount_justified", TALER_JSON_from_amount ( | 1042 | &roi->details.amount), |
1054 | &zero), | 1043 | TALER_JSON_pack_amount ("amount_justified", |
1055 | "wtid", GNUNET_JSON_from_data_auto (wtid), | 1044 | &zero), |
1056 | "timestamp", TALER_ARL_json_from_time_abs ( | 1045 | GNUNET_JSON_pack_data_auto ("wtid", wtid), |
1057 | date), | 1046 | TALER_JSON_pack_time_abs_human ("timestamp", |
1058 | "diagnostic", "receiver account mismatch", | 1047 | date), |
1059 | "target", payto_uri, | 1048 | GNUNET_JSON_pack_string ("diagnostic", |
1060 | "account_section", wa->section_name)); | 1049 | "receiver account mismatch"), |
1050 | GNUNET_JSON_pack_string ("target", | ||
1051 | payto_uri), | ||
1052 | GNUNET_JSON_pack_string ("account_section", | ||
1053 | wa->section_name))); | ||
1061 | TALER_ARL_amount_add (&total_bad_amount_out_plus, | 1054 | TALER_ARL_amount_add (&total_bad_amount_out_plus, |
1062 | &total_bad_amount_out_plus, | 1055 | &total_bad_amount_out_plus, |
1063 | &roi->details.amount); | 1056 | &roi->details.amount); |
1064 | TALER_ARL_report (report_wire_out_inconsistencies, | 1057 | TALER_ARL_report (report_wire_out_inconsistencies, |
1065 | json_pack ("{s:I, s:o, s:o, s:o, s:o, s:s, s:s, s:s}", | 1058 | GNUNET_JSON_PACK ( |
1066 | "row", (json_int_t) rowid, | 1059 | GNUNET_JSON_pack_uint64 ("row", |
1067 | "amount_wired", TALER_JSON_from_amount ( | 1060 | rowid), |
1068 | &zero), | 1061 | TALER_JSON_pack_amount ("amount_wired", |
1069 | "amount_justified", TALER_JSON_from_amount ( | 1062 | &zero), |
1070 | amount), | 1063 | TALER_JSON_pack_amount ("amount_justified", |
1071 | "wtid", GNUNET_JSON_from_data_auto (wtid), | 1064 | amount), |
1072 | "timestamp", TALER_ARL_json_from_time_abs ( | 1065 | GNUNET_JSON_pack_data_auto ("wtid", |
1073 | date), | 1066 | wtid), |
1074 | "diagnostic", "receiver account mismatch", | 1067 | TALER_JSON_pack_time_abs_human ("timestamp", |
1075 | "target", roi->details.credit_account_url, | 1068 | date), |
1076 | "account_section", wa->section_name)); | 1069 | GNUNET_JSON_pack_string ("diagnostic", |
1070 | "receiver account mismatch"), | ||
1071 | GNUNET_JSON_pack_string ("target", | ||
1072 | roi->details. | ||
1073 | credit_account_url), | ||
1074 | GNUNET_JSON_pack_string ("account_section", | ||
1075 | wa->section_name))); | ||
1077 | TALER_ARL_amount_add (&total_bad_amount_out_minus, | 1076 | TALER_ARL_amount_add (&total_bad_amount_out_minus, |
1078 | &total_bad_amount_out_minus, | 1077 | &total_bad_amount_out_minus, |
1079 | amount); | 1078 | amount); |
@@ -1086,17 +1085,21 @@ wire_out_cb (void *cls, | |||
1086 | amount)) | 1085 | amount)) |
1087 | { | 1086 | { |
1088 | TALER_ARL_report (report_wire_out_inconsistencies, | 1087 | TALER_ARL_report (report_wire_out_inconsistencies, |
1089 | json_pack ("{s:I, s:o, s:o, s:o, s:o, s:s, s:s}", | 1088 | GNUNET_JSON_PACK ( |
1090 | "row", (json_int_t) rowid, | 1089 | GNUNET_JSON_pack_uint64 ("row", |
1091 | "amount_justified", TALER_JSON_from_amount ( | 1090 | rowid), |
1092 | amount), | 1091 | TALER_JSON_pack_amount ("amount_justified", |
1093 | "amount_wired", TALER_JSON_from_amount ( | 1092 | amount), |
1094 | &roi->details.amount), | 1093 | TALER_JSON_pack_amount ("amount_wired", |
1095 | "wtid", GNUNET_JSON_from_data_auto (wtid), | 1094 | &roi->details.amount), |
1096 | "timestamp", TALER_ARL_json_from_time_abs ( | 1095 | GNUNET_JSON_pack_data_auto ("wtid", |
1097 | date), | 1096 | wtid), |
1098 | "diagnostic", "wire amount does not match", | 1097 | TALER_JSON_pack_time_abs_human ("timestamp", |
1099 | "account_section", wa->section_name)); | 1098 | date), |
1099 | GNUNET_JSON_pack_string ("diagnostic", | ||
1100 | "wire amount does not match"), | ||
1101 | GNUNET_JSON_pack_string ("account_section", | ||
1102 | wa->section_name))); | ||
1100 | if (0 < TALER_amount_cmp (amount, | 1103 | if (0 < TALER_amount_cmp (amount, |
1101 | &roi->details.amount)) | 1104 | &roi->details.amount)) |
1102 | { | 1105 | { |
@@ -1229,20 +1232,22 @@ complain_out_not_found (void *cls, | |||
1229 | if (GNUNET_YES == ctx.found) | 1232 | if (GNUNET_YES == ctx.found) |
1230 | return GNUNET_OK; | 1233 | return GNUNET_OK; |
1231 | TALER_ARL_report (report_wire_out_inconsistencies, | 1234 | TALER_ARL_report (report_wire_out_inconsistencies, |
1232 | json_pack ("{s:I, s:o, s:o, s:o, s:o, s:s, s:s}", | 1235 | GNUNET_JSON_PACK ( |
1233 | "row", (json_int_t) 0, | 1236 | GNUNET_JSON_pack_uint64 ("row", |
1234 | "amount_wired", TALER_JSON_from_amount ( | 1237 | 0), |
1235 | &roi->details.amount), | 1238 | TALER_JSON_pack_amount ("amount_wired", |
1236 | "amount_justified", TALER_JSON_from_amount ( | 1239 | &roi->details.amount), |
1237 | &zero), | 1240 | TALER_JSON_pack_amount ("amount_justified", |
1238 | "wtid", GNUNET_JSON_from_data_auto ( | 1241 | &zero), |
1239 | &roi->details.wtid), | 1242 | GNUNET_JSON_pack_data_auto ("wtid", |
1240 | "timestamp", TALER_ARL_json_from_time_abs ( | 1243 | &roi->details.wtid), |
1241 | roi->details.execution_date), | 1244 | TALER_JSON_pack_time_abs_human ("timestamp", |
1242 | "account_section", | 1245 | roi->details. |
1243 | wa->section_name, | 1246 | execution_date), |
1244 | "diagnostic", | 1247 | GNUNET_JSON_pack_string ("account_section", |
1245 | "justification for wire transfer not found")); | 1248 | wa->section_name), |
1249 | GNUNET_JSON_pack_string ("diagnostic", | ||
1250 | "justification for wire transfer not found"))); | ||
1246 | TALER_ARL_amount_add (&total_bad_amount_out_plus, | 1251 | TALER_ARL_amount_add (&total_bad_amount_out_plus, |
1247 | &total_bad_amount_out_plus, | 1252 | &total_bad_amount_out_plus, |
1248 | &roi->details.amount); | 1253 | &roi->details.amount); |
@@ -1379,11 +1384,13 @@ history_debit_cb (void *cls, | |||
1379 | &total_wire_format_amount, | 1384 | &total_wire_format_amount, |
1380 | &details->amount); | 1385 | &details->amount); |
1381 | TALER_ARL_report (report_wire_format_inconsistencies, | 1386 | TALER_ARL_report (report_wire_format_inconsistencies, |
1382 | json_pack ("{s:o, s:I, s:s}", | 1387 | GNUNET_JSON_PACK ( |
1383 | "amount", TALER_JSON_from_amount ( | 1388 | TALER_JSON_pack_amount ("amount", |
1384 | &details->amount), | 1389 | &details->amount), |
1385 | "wire_offset", (json_int_t) row_off, | 1390 | GNUNET_JSON_pack_uint64 ("wire_offset", |
1386 | "diagnostic", diagnostic)); | 1391 | row_off), |
1392 | GNUNET_JSON_pack_string ("diagnostic", | ||
1393 | diagnostic))); | ||
1387 | GNUNET_free (diagnostic); | 1394 | GNUNET_free (diagnostic); |
1388 | return GNUNET_OK; | 1395 | return GNUNET_OK; |
1389 | } | 1396 | } |
@@ -1518,13 +1525,15 @@ reserve_in_cb (void *cls, | |||
1518 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)) | 1525 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)) |
1519 | { | 1526 | { |
1520 | TALER_ARL_report (report_row_inconsistencies, | 1527 | TALER_ARL_report (report_row_inconsistencies, |
1521 | json_pack ("{s:s, s:I, s:o, s:s}", | 1528 | GNUNET_JSON_PACK ( |
1522 | "table", "reserves_in", | 1529 | GNUNET_JSON_pack_string ("table", |
1523 | "row", (json_int_t) rowid, | 1530 | "reserves_in"), |
1524 | "wire_offset_hash", | 1531 | GNUNET_JSON_pack_uint64 ("row", |
1525 | GNUNET_JSON_from_data_auto ( | 1532 | rowid), |
1526 | &rii->row_off_hash), | 1533 | GNUNET_JSON_pack_data_auto ("wire_offset_hash", |
1527 | "diagnostic", "duplicate wire offset")); | 1534 | &rii->row_off_hash), |
1535 | GNUNET_JSON_pack_string ("diagnostic", | ||
1536 | "duplicate wire offset"))); | ||
1528 | GNUNET_free (rii); | 1537 | GNUNET_free (rii); |
1529 | if (TALER_ARL_do_abort ()) | 1538 | if (TALER_ARL_do_abort ()) |
1530 | return GNUNET_SYSERR; | 1539 | return GNUNET_SYSERR; |
@@ -1555,19 +1564,22 @@ complain_in_not_found (void *cls, | |||
1555 | 1564 | ||
1556 | (void) key; | 1565 | (void) key; |
1557 | TALER_ARL_report (report_reserve_in_inconsistencies, | 1566 | TALER_ARL_report (report_reserve_in_inconsistencies, |
1558 | json_pack ("{s:I, s:o, s:o, s:o, s:o, s:s, s:s}", | 1567 | GNUNET_JSON_PACK ( |
1559 | "row", (json_int_t) rii->rowid, | 1568 | GNUNET_JSON_pack_uint64 ("row", |
1560 | "amount_exchange_expected", | 1569 | rii->rowid), |
1561 | TALER_JSON_from_amount ( | 1570 | TALER_JSON_pack_amount ("amount_exchange_expected", |
1562 | &rii->details.amount), | 1571 | &rii->details.amount), |
1563 | "amount_wired", TALER_JSON_from_amount (&zero), | 1572 | TALER_JSON_pack_amount ("amount_wired", |
1564 | "reserve_pub", GNUNET_JSON_from_data_auto ( | 1573 | &zero), |
1565 | &rii->details.reserve_pub), | 1574 | GNUNET_JSON_pack_data_auto ("reserve_pub", |
1566 | "timestamp", TALER_ARL_json_from_time_abs ( | 1575 | &rii->details.reserve_pub), |
1567 | rii->details.execution_date), | 1576 | TALER_JSON_pack_time_abs_human ("timestamp", |
1568 | "account", wa->section_name, | 1577 | rii->details. |
1569 | "diagnostic", | 1578 | execution_date), |
1570 | "incoming wire transfer claimed by exchange not found")); | 1579 | GNUNET_JSON_pack_string ("account", |
1580 | wa->section_name), | ||
1581 | GNUNET_JSON_pack_string ("diagnostic", | ||
1582 | "incoming wire transfer claimed by exchange not found"))); | ||
1571 | TALER_ARL_amount_add (&total_bad_amount_in_minus, | 1583 | TALER_ARL_amount_add (&total_bad_amount_in_minus, |
1572 | &total_bad_amount_in_minus, | 1584 | &total_bad_amount_in_minus, |
1573 | &rii->details.amount); | 1585 | &rii->details.amount); |
@@ -1668,35 +1680,41 @@ history_credit_cb (void *cls, | |||
1668 | &rii->details.reserve_pub)) | 1680 | &rii->details.reserve_pub)) |
1669 | { | 1681 | { |
1670 | TALER_ARL_report (report_reserve_in_inconsistencies, | 1682 | TALER_ARL_report (report_reserve_in_inconsistencies, |
1671 | json_pack ("{s:I, s:I, s:o, s:o, s:o, s:o, s:s}", | 1683 | GNUNET_JSON_PACK ( |
1672 | "row", (json_int_t) rii->rowid, | 1684 | GNUNET_JSON_pack_uint64 ("row", |
1673 | "bank_row", (json_int_t) row_off, | 1685 | rii->rowid), |
1674 | "amount_exchange_expected", | 1686 | GNUNET_JSON_pack_uint64 ("bank_row", |
1675 | TALER_JSON_from_amount ( | 1687 | row_off), |
1676 | &rii->details.amount), | 1688 | TALER_JSON_pack_amount ("amount_exchange_expected", |
1677 | "amount_wired", TALER_JSON_from_amount (&zero), | 1689 | &rii->details.amount), |
1678 | "reserve_pub", GNUNET_JSON_from_data_auto ( | 1690 | TALER_JSON_pack_amount ("amount_wired", |
1679 | &rii->details.reserve_pub), | 1691 | &zero), |
1680 | "timestamp", TALER_ARL_json_from_time_abs ( | 1692 | GNUNET_JSON_pack_data_auto ("reserve_pub", |
1681 | rii->details.execution_date), | 1693 | &rii->details.reserve_pub), |
1682 | "diagnostic", "wire subject does not match")); | 1694 | TALER_JSON_pack_time_abs_human ("timestamp", |
1695 | rii->details. | ||
1696 | execution_date), | ||
1697 | GNUNET_JSON_pack_string ("diagnostic", | ||
1698 | "wire subject does not match"))); | ||
1683 | TALER_ARL_amount_add (&total_bad_amount_in_minus, | 1699 | TALER_ARL_amount_add (&total_bad_amount_in_minus, |
1684 | &total_bad_amount_in_minus, | 1700 | &total_bad_amount_in_minus, |
1685 | &rii->details.amount); | 1701 | &rii->details.amount); |
1686 | TALER_ARL_report (report_reserve_in_inconsistencies, | 1702 | TALER_ARL_report (report_reserve_in_inconsistencies, |
1687 | json_pack ("{s:I, s:I, s:o, s:o, s:o, s:o, s:s}", | 1703 | GNUNET_JSON_PACK ( |
1688 | "row", (json_int_t) rii->rowid, | 1704 | GNUNET_JSON_pack_uint64 ("row", |
1689 | "bank_row", (json_int_t) row_off, | 1705 | rii->rowid), |
1690 | "amount_exchange_expected", | 1706 | GNUNET_JSON_pack_uint64 ("bank_row", |
1691 | TALER_JSON_from_amount ( | 1707 | row_off), |
1692 | &zero), | 1708 | TALER_JSON_pack_amount ("amount_exchange_expected", |
1693 | "amount_wired", TALER_JSON_from_amount ( | 1709 | &zero), |
1694 | &details->amount), | 1710 | TALER_JSON_pack_amount ("amount_wired", |
1695 | "reserve_pub", GNUNET_JSON_from_data_auto ( | 1711 | &details->amount), |
1696 | &details->reserve_pub), | 1712 | GNUNET_JSON_pack_data_auto ("reserve_pub", |
1697 | "timestamp", TALER_ARL_json_from_time_abs ( | 1713 | &details->reserve_pub), |
1698 | details->execution_date), | 1714 | TALER_JSON_pack_time_abs_human ("timestamp", |
1699 | "diagnostic", "wire subject does not match")); | 1715 | details->execution_date), |
1716 | GNUNET_JSON_pack_string ("diagnostic", | ||
1717 | "wire subject does not match"))); | ||
1700 | 1718 | ||
1701 | TALER_ARL_amount_add (&total_bad_amount_in_plus, | 1719 | TALER_ARL_amount_add (&total_bad_amount_in_plus, |
1702 | &total_bad_amount_in_plus, | 1720 | &total_bad_amount_in_plus, |
@@ -1707,19 +1725,21 @@ history_credit_cb (void *cls, | |||
1707 | &details->amount)) | 1725 | &details->amount)) |
1708 | { | 1726 | { |
1709 | TALER_ARL_report (report_reserve_in_inconsistencies, | 1727 | TALER_ARL_report (report_reserve_in_inconsistencies, |
1710 | json_pack ("{s:I, s:I, s:o, s:o, s:o, s:o, s:s}", | 1728 | GNUNET_JSON_PACK ( |
1711 | "row", (json_int_t) rii->rowid, | 1729 | GNUNET_JSON_pack_uint64 ("row", |
1712 | "bank_row", (json_int_t) row_off, | 1730 | rii->rowid), |
1713 | "amount_exchange_expected", | 1731 | GNUNET_JSON_pack_uint64 ("bank_row", |
1714 | TALER_JSON_from_amount ( | 1732 | row_off), |
1715 | &rii->details.amount), | 1733 | TALER_JSON_pack_amount ("amount_exchange_expected", |
1716 | "amount_wired", TALER_JSON_from_amount ( | 1734 | &rii->details.amount), |
1717 | &details->amount), | 1735 | TALER_JSON_pack_amount ("amount_wired", |
1718 | "reserve_pub", GNUNET_JSON_from_data_auto ( | 1736 | &details->amount), |
1719 | &details->reserve_pub), | 1737 | GNUNET_JSON_pack_data_auto ("reserve_pub", |
1720 | "timestamp", TALER_ARL_json_from_time_abs ( | 1738 | &details->reserve_pub), |
1721 | details->execution_date), | 1739 | TALER_JSON_pack_time_abs_human ("timestamp", |
1722 | "diagnostic", "wire amount does not match")); | 1740 | details->execution_date), |
1741 | GNUNET_JSON_pack_string ("diagnostic", | ||
1742 | "wire amount does not match"))); | ||
1723 | if (0 < TALER_amount_cmp (&details->amount, | 1743 | if (0 < TALER_amount_cmp (&details->amount, |
1724 | &rii->details.amount)) | 1744 | &rii->details.amount)) |
1725 | { | 1745 | { |
@@ -1751,13 +1771,16 @@ history_credit_cb (void *cls, | |||
1751 | rii->details.debit_account_url)) | 1771 | rii->details.debit_account_url)) |
1752 | { | 1772 | { |
1753 | TALER_ARL_report (report_missattribution_in_inconsistencies, | 1773 | TALER_ARL_report (report_missattribution_in_inconsistencies, |
1754 | json_pack ("{s:o, s:I, s:I, s:o}", | 1774 | GNUNET_JSON_PACK ( |
1755 | "amount", TALER_JSON_from_amount ( | 1775 | TALER_JSON_pack_amount ("amount", |
1756 | &rii->details.amount), | 1776 | &rii->details.amount), |
1757 | "row", (json_int_t) rii->rowid, | 1777 | GNUNET_JSON_pack_uint64 ("row", |
1758 | "bank_row", (json_int_t) row_off, | 1778 | rii->rowid), |
1759 | "reserve_pub", GNUNET_JSON_from_data_auto ( | 1779 | GNUNET_JSON_pack_uint64 ("bank_row", |
1760 | &rii->details.reserve_pub))); | 1780 | row_off), |
1781 | GNUNET_JSON_pack_data_auto ( | ||
1782 | "reserve_pub", | ||
1783 | &rii->details.reserve_pub))); | ||
1761 | TALER_ARL_amount_add (&total_missattribution_in, | 1784 | TALER_ARL_amount_add (&total_missattribution_in, |
1762 | &total_missattribution_in, | 1785 | &total_missattribution_in, |
1763 | &rii->details.amount); | 1786 | &rii->details.amount); |
@@ -1766,11 +1789,15 @@ history_credit_cb (void *cls, | |||
1766 | rii->details.execution_date.abs_value_us) | 1789 | rii->details.execution_date.abs_value_us) |
1767 | { | 1790 | { |
1768 | TALER_ARL_report (report_row_minor_inconsistencies, | 1791 | TALER_ARL_report (report_row_minor_inconsistencies, |
1769 | json_pack ("{s:s, s:I, s:I, s:s}", | 1792 | GNUNET_JSON_PACK ( |
1770 | "table", "reserves_in", | 1793 | GNUNET_JSON_pack_string ("table", |
1771 | "row", (json_int_t) rii->rowid, | 1794 | "reserves_in"), |
1772 | "bank_row", (json_int_t) row_off, | 1795 | GNUNET_JSON_pack_uint64 ("row", |
1773 | "diagnostic", "execution date mismatch")); | 1796 | rii->rowid), |
1797 | GNUNET_JSON_pack_uint64 ("bank_row", | ||
1798 | row_off), | ||
1799 | GNUNET_JSON_pack_string ("diagnostic", | ||
1800 | "execution date mismatch"))); | ||
1774 | } | 1801 | } |
1775 | cleanup: | 1802 | cleanup: |
1776 | GNUNET_assert (GNUNET_OK == | 1803 | GNUNET_assert (GNUNET_OK == |
@@ -1893,17 +1920,19 @@ reserve_closed_cb (void *cls, | |||
1893 | closing_fee)) | 1920 | closing_fee)) |
1894 | { | 1921 | { |
1895 | TALER_ARL_report (report_row_inconsistencies, | 1922 | TALER_ARL_report (report_row_inconsistencies, |
1896 | json_pack ("{s:s, s:I, s:o, s:o, s:o, s:s}", | 1923 | GNUNET_JSON_PACK ( |
1897 | "table", "reserves_closures", | 1924 | GNUNET_JSON_pack_string ("table", |
1898 | "row", (json_int_t) rowid, | 1925 | "reserves_closures"), |
1899 | "reserve_pub", GNUNET_JSON_from_data_auto ( | 1926 | GNUNET_JSON_pack_uint64 ("row", |
1900 | reserve_pub), | 1927 | rowid), |
1901 | "amount_with_fee", TALER_JSON_from_amount ( | 1928 | GNUNET_JSON_pack_data_auto ("reserve_pub", |
1902 | amount_with_fee), | 1929 | reserve_pub), |
1903 | "closing_fee", TALER_JSON_from_amount ( | 1930 | TALER_JSON_pack_amount ("amount_with_fee", |
1904 | closing_fee), | 1931 | amount_with_fee), |
1905 | "diagnostic", | 1932 | TALER_JSON_pack_amount ("closing_fee", |
1906 | "closing fee above total amount")); | 1933 | closing_fee), |
1934 | GNUNET_JSON_pack_string ("diagnostic", | ||
1935 | "closing fee above total amount"))); | ||
1907 | GNUNET_free (rc); | 1936 | GNUNET_free (rc); |
1908 | if (TALER_ARL_do_abort ()) | 1937 | if (TALER_ARL_do_abort ()) |
1909 | return GNUNET_SYSERR; | 1938 | return GNUNET_SYSERR; |
diff --git a/src/include/taler_json_lib.h b/src/include/taler_json_lib.h index 0cbeba082..f338d44ae 100644 --- a/src/include/taler_json_lib.h +++ b/src/include/taler_json_lib.h | |||
@@ -54,6 +54,19 @@ TALER_JSON_pack_time_abs (const char *name, | |||
54 | 54 | ||
55 | /** | 55 | /** |
56 | * Generate packer instruction for a JSON field of type | 56 | * Generate packer instruction for a JSON field of type |
57 | * absolute time creating a human-readable timestamp. | ||
58 | * | ||
59 | * @param name name of the field to add to the object | ||
60 | * @param at absolute time to pack | ||
61 | * @return json pack specification | ||
62 | */ | ||
63 | struct GNUNET_JSON_PackSpec | ||
64 | TALER_JSON_pack_time_abs_human (const char *name, | ||
65 | struct GNUNET_TIME_Absolute at); | ||
66 | |||
67 | |||
68 | /** | ||
69 | * Generate packer instruction for a JSON field of type | ||
57 | * absolute time in network byte order. | 70 | * absolute time in network byte order. |
58 | * The absolute time value is expected to be already rounded. | 71 | * The absolute time value is expected to be already rounded. |
59 | * | 72 | * |
@@ -68,6 +81,19 @@ TALER_JSON_pack_time_abs_nbo (const char *name, | |||
68 | 81 | ||
69 | /** | 82 | /** |
70 | * Generate packer instruction for a JSON field of type | 83 | * Generate packer instruction for a JSON field of type |
84 | * absolute time creating a human-readable timestamp. | ||
85 | * | ||
86 | * @param name name of the field to add to the object | ||
87 | * @param at absolute time to pack | ||
88 | * @return json pack specification | ||
89 | */ | ||
90 | struct GNUNET_JSON_PackSpec | ||
91 | TALER_JSON_pack_time_abs_nbo_human (const char *name, | ||
92 | struct GNUNET_TIME_AbsoluteNBO at); | ||
93 | |||
94 | |||
95 | /** | ||
96 | * Generate packer instruction for a JSON field of type | ||
71 | * relative time. | 97 | * relative time. |
72 | * The relative time value is expected to be already rounded. | 98 | * The relative time value is expected to be already rounded. |
73 | * | 99 | * |
diff --git a/src/json/json_pack.c b/src/json/json_pack.c index 7a5d22ee2..1859e264a 100644 --- a/src/json/json_pack.c +++ b/src/json/json_pack.c | |||
@@ -36,6 +36,20 @@ TALER_JSON_pack_time_abs (const char *name, | |||
36 | 36 | ||
37 | 37 | ||
38 | struct GNUNET_JSON_PackSpec | 38 | struct GNUNET_JSON_PackSpec |
39 | TALER_JSON_pack_time_abs_human (const char *name, | ||
40 | struct GNUNET_TIME_Absolute at) | ||
41 | { | ||
42 | struct GNUNET_JSON_PackSpec ps = { | ||
43 | .field_name = name, | ||
44 | .object = json_string ( | ||
45 | GNUNET_STRINGS_absolute_time_to_string (at)) | ||
46 | }; | ||
47 | |||
48 | return ps; | ||
49 | } | ||
50 | |||
51 | |||
52 | struct GNUNET_JSON_PackSpec | ||
39 | TALER_JSON_pack_time_abs_nbo (const char *name, | 53 | TALER_JSON_pack_time_abs_nbo (const char *name, |
40 | struct GNUNET_TIME_AbsoluteNBO at) | 54 | struct GNUNET_TIME_AbsoluteNBO at) |
41 | { | 55 | { |
@@ -45,6 +59,15 @@ TALER_JSON_pack_time_abs_nbo (const char *name, | |||
45 | 59 | ||
46 | 60 | ||
47 | struct GNUNET_JSON_PackSpec | 61 | struct GNUNET_JSON_PackSpec |
62 | TALER_JSON_pack_time_abs_nbo_human (const char *name, | ||
63 | struct GNUNET_TIME_AbsoluteNBO at) | ||
64 | { | ||
65 | return TALER_JSON_pack_time_abs_human (name, | ||
66 | GNUNET_TIME_absolute_ntoh (at)); | ||
67 | } | ||
68 | |||
69 | |||
70 | struct GNUNET_JSON_PackSpec | ||
48 | TALER_JSON_pack_time_rel (const char *name, | 71 | TALER_JSON_pack_time_rel (const char *name, |
49 | struct GNUNET_TIME_Relative rt) | 72 | struct GNUNET_TIME_Relative rt) |
50 | { | 73 | { |