diff options
Diffstat (limited to 'src/auditor/taler-helper-auditor-wire.c')
-rw-r--r-- | src/auditor/taler-helper-auditor-wire.c | 569 |
1 files changed, 299 insertions, 270 deletions
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; |