From 2faf102a05865b68e90ef48f292678dd1da6356e Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sat, 30 Oct 2021 21:26:40 +0200 Subject: -more dB work --- src/auditor/taler-helper-auditor-aggregation.c | 56 ++++--------- src/auditor/taler-helper-auditor-wire.c | 109 ++++++++++++------------- 2 files changed, 65 insertions(+), 100 deletions(-) (limited to 'src/auditor') diff --git a/src/auditor/taler-helper-auditor-aggregation.c b/src/auditor/taler-helper-auditor-aggregation.c index 99fe16e01..d4ad08aaa 100644 --- a/src/auditor/taler-helper-auditor-aggregation.c +++ b/src/auditor/taler-helper-auditor-aggregation.c @@ -358,9 +358,9 @@ struct WireCheckContext struct TALER_Amount total_deposits; /** - * Hash of the wire transfer details of the receiver. + * Target account details of the receiver. */ - struct TALER_MerchantWireHash h_wire; + const char *payto_uri; /** * Execution time of the wire transfer. @@ -682,8 +682,7 @@ check_transaction_history_for_deposit ( * @param[in,out] cls a `struct WireCheckContext` * @param rowid which row in the table is the information from (for diagnostics) * @param merchant_pub public key of the merchant (should be same for all callbacks with the same @e cls) - * @param h_wire hash of wire transfer details of the merchant (should be same for all callbacks with the same @e cls) - * @param account_details where did we transfer the funds? + * @param account_pay_uri where did we transfer the funds? * @param exec_time execution time of the wire transfer (should be same for all callbacks with the same @e cls) * @param h_contract_terms which proposal was this payment about * @param denom_pub denomination of @a coin_pub @@ -698,8 +697,7 @@ wire_transfer_information_cb ( void *cls, uint64_t rowid, const struct TALER_MerchantPublicKeyP *merchant_pub, - const struct TALER_MerchantWireHash *h_wire, - const json_t *account_details, + const char *account_pay_uri, struct GNUNET_TIME_Absolute exec_time, const struct TALER_PrivateContractHash *h_contract_terms, const struct TALER_DenominationPublicKey *denom_pub, @@ -714,24 +712,6 @@ wire_transfer_information_cb ( struct TALER_EXCHANGEDB_TransactionList *tl; struct TALER_CoinPublicInfo coin; enum GNUNET_DB_QueryStatus qs; - struct TALER_MerchantWireHash hw; - - if (GNUNET_OK != - TALER_JSON_merchant_wire_signature_hash (account_details, - &hw)) - { - report_row_inconsistency ("aggregation", - rowid, - "failed to compute hash of given wire data"); - } - else if (0 != - GNUNET_memcmp (&hw, - h_wire)) - { - report_row_inconsistency ("aggregation", - rowid, - "database contains wrong hash code for wire details"); - } /* Obtain coin's transaction history */ qs = TALER_ARL_edb->get_coin_transactions (TALER_ARL_edb->cls, @@ -857,14 +837,13 @@ wire_transfer_information_cb ( "aggregation (contribution)", rowid, &coin_value_without_fee, - & - total_deposit_without_refunds, + &total_deposit_without_refunds, -1); } } /* Check other details of wire transfer match */ - if (0 != GNUNET_memcmp (h_wire, - &wcc->h_wire)) + if (0 != strcmp (account_pay_uri, + wcc->payto_uri)) { report_row_inconsistency ("aggregation", rowid, @@ -1007,16 +986,16 @@ get_wire_fee (struct AggregationContext *ac, * @param rowid identifier of the respective row in the database * @param date timestamp of the wire transfer (roughly) * @param wtid wire transfer subject - * @param wire wire transfer details of the receiver + * @param payto_uri bank account details of the receiver * @param amount amount that was wired * @return #GNUNET_OK to continue, #GNUNET_SYSERR to stop iteration */ -static int +static enum GNUNET_GenericReturnValue check_wire_out_cb (void *cls, uint64_t rowid, struct GNUNET_TIME_Absolute date, const struct TALER_WireTransferIdentifierRawP *wtid, - const json_t *wire, + const char *payto_uri, const struct TALER_Amount *amount) { struct AggregationContext *ac = cls; @@ -1035,7 +1014,7 @@ check_wire_out_cb (void *cls, TALER_B2S (wtid), TALER_amount2s (amount), GNUNET_STRINGS_absolute_time_to_string (date)); - if (NULL == (method = TALER_JSON_wire_to_method (wire))) + if (NULL == (method = TALER_payto_get_method (payto_uri))) { report_row_inconsistency ("wire_out", rowid, @@ -1049,14 +1028,7 @@ check_wire_out_cb (void *cls, GNUNET_assert (GNUNET_OK == TALER_amount_set_zero (amount->currency, &wcc.total_deposits)); - if (GNUNET_OK != - TALER_JSON_merchant_wire_signature_hash (wire, - &wcc.h_wire)) - { - GNUNET_break (0); - GNUNET_free (method); - return GNUNET_SYSERR; - } + wcc.payto_uri = payto_uri; qs = TALER_ARL_edb->lookup_wire_transfer (TALER_ARL_edb->cls, wtid, &wire_transfer_information_cb, @@ -1156,8 +1128,8 @@ check_wire_out_cb (void *cls, TALER_ARL_report (report_wire_out_inconsistencies, GNUNET_JSON_PACK ( - GNUNET_JSON_pack_object_incref ("destination_account", - (json_t *) wire), + GNUNET_JSON_pack_string ("destination_account", + payto_uri), GNUNET_JSON_pack_uint64 ("rowid", rowid), TALER_JSON_pack_amount ("expected", diff --git a/src/auditor/taler-helper-auditor-wire.c b/src/auditor/taler-helper-auditor-wire.c index 80a4568ff..3d8b0d1fd 100644 --- a/src/auditor/taler-helper-auditor-wire.c +++ b/src/auditor/taler-helper-auditor-wire.c @@ -942,16 +942,16 @@ check_time_difference (const char *table, * @param rowid unique serial ID for the refresh session in our DB * @param date timestamp of the transfer (roughly) * @param wtid wire transfer subject - * @param wire wire transfer details of the receiver + * @param payto_uri wire transfer details of the receiver * @param amount amount that was wired * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop */ -static int +static enum GNUNET_GenericReturnValue wire_out_cb (void *cls, uint64_t rowid, struct GNUNET_TIME_Absolute date, const struct TALER_WireTransferIdentifierRawP *wtid, - const json_t *wire, + const char *payto_uri, const struct TALER_Amount *amount) { struct WireAccount *wa = cls; @@ -997,62 +997,55 @@ wire_out_cb (void *cls, return GNUNET_SYSERR; return GNUNET_OK; } + if (0 != strcasecmp (payto_uri, + roi->details.credit_account_uri)) { - char *payto_uri; - - payto_uri = TALER_JSON_wire_to_payto (wire); - if (0 != strcasecmp (payto_uri, - roi->details.credit_account_uri)) - { - /* Destination bank account is wrong in actual wire transfer, so - we should count the wire transfer as entirely spurious, and - additionally consider the justified wire transfer as missing. */ - TALER_ARL_report (report_wire_out_inconsistencies, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_uint64 ("row", - rowid), - TALER_JSON_pack_amount ("amount_wired", - &roi->details.amount), - TALER_JSON_pack_amount ("amount_justified", - &zero), - GNUNET_JSON_pack_data_auto ("wtid", wtid), - TALER_JSON_pack_time_abs_human ("timestamp", - date), - GNUNET_JSON_pack_string ("diagnostic", - "receiver account mismatch"), - GNUNET_JSON_pack_string ("target", - payto_uri), - GNUNET_JSON_pack_string ("account_section", - wa->ai->section_name))); - TALER_ARL_amount_add (&total_bad_amount_out_plus, - &total_bad_amount_out_plus, - &roi->details.amount); - TALER_ARL_report (report_wire_out_inconsistencies, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_uint64 ("row", - rowid), - TALER_JSON_pack_amount ("amount_wired", - &zero), - TALER_JSON_pack_amount ("amount_justified", - amount), - GNUNET_JSON_pack_data_auto ("wtid", - wtid), - TALER_JSON_pack_time_abs_human ("timestamp", - date), - GNUNET_JSON_pack_string ("diagnostic", - "receiver account mismatch"), - GNUNET_JSON_pack_string ("target", - roi->details. - credit_account_uri), - GNUNET_JSON_pack_string ("account_section", - wa->ai->section_name))); - TALER_ARL_amount_add (&total_bad_amount_out_minus, - &total_bad_amount_out_minus, - amount); - GNUNET_free (payto_uri); - goto cleanup; - } - GNUNET_free (payto_uri); + /* Destination bank account is wrong in actual wire transfer, so + we should count the wire transfer as entirely spurious, and + additionally consider the justified wire transfer as missing. */ + TALER_ARL_report (report_wire_out_inconsistencies, + GNUNET_JSON_PACK ( + GNUNET_JSON_pack_uint64 ("row", + rowid), + TALER_JSON_pack_amount ("amount_wired", + &roi->details.amount), + TALER_JSON_pack_amount ("amount_justified", + &zero), + GNUNET_JSON_pack_data_auto ("wtid", wtid), + TALER_JSON_pack_time_abs_human ("timestamp", + date), + GNUNET_JSON_pack_string ("diagnostic", + "receiver account mismatch"), + GNUNET_JSON_pack_string ("target", + payto_uri), + GNUNET_JSON_pack_string ("account_section", + wa->ai->section_name))); + TALER_ARL_amount_add (&total_bad_amount_out_plus, + &total_bad_amount_out_plus, + &roi->details.amount); + TALER_ARL_report (report_wire_out_inconsistencies, + GNUNET_JSON_PACK ( + GNUNET_JSON_pack_uint64 ("row", + rowid), + TALER_JSON_pack_amount ("amount_wired", + &zero), + TALER_JSON_pack_amount ("amount_justified", + amount), + GNUNET_JSON_pack_data_auto ("wtid", + wtid), + TALER_JSON_pack_time_abs_human ("timestamp", + date), + GNUNET_JSON_pack_string ("diagnostic", + "receiver account mismatch"), + GNUNET_JSON_pack_string ("target", + roi->details. + credit_account_uri), + GNUNET_JSON_pack_string ("account_section", + wa->ai->section_name))); + TALER_ARL_amount_add (&total_bad_amount_out_minus, + &total_bad_amount_out_minus, + amount); + goto cleanup; } if (0 != TALER_amount_cmp (&roi->details.amount, amount)) -- cgit v1.2.3