diff options
author | Marcello Stanisci <marcello.stanisci@inria.fr> | 2017-03-29 00:23:46 +0200 |
---|---|---|
committer | Marcello Stanisci <marcello.stanisci@inria.fr> | 2017-03-29 00:23:46 +0200 |
commit | ab7198d130ea352824f7c3d6f0fa4a061df88dee (patch) | |
tree | 1c83eec4f29e7232561cb1dd3641b018ea53b646 | |
parent | c6e834ba63115a2d850e82dcfabab295d655369d (diff) | |
download | merchant-ab7198d130ea352824f7c3d6f0fa4a061df88dee.tar.gz merchant-ab7198d130ea352824f7c3d6f0fa4a061df88dee.tar.bz2 merchant-ab7198d130ea352824f7c3d6f0fa4a061df88dee.zip |
renaming variables
-rw-r--r-- | src/backend/taler-merchant-httpd_pay.c | 27 | ||||
-rw-r--r-- | src/backenddb/plugin_merchantdb_postgres.c | 3 |
2 files changed, 21 insertions, 9 deletions
diff --git a/src/backend/taler-merchant-httpd_pay.c b/src/backend/taler-merchant-httpd_pay.c index c3203ef6..8e835f18 100644 --- a/src/backend/taler-merchant-httpd_pay.c +++ b/src/backend/taler-merchant-httpd_pay.c @@ -269,7 +269,7 @@ struct PayContext * #GNUNET_SYSERR if the transaction ID is used for a different * transaction in our database. */ - int transaction_exits; + int transaction_exists; /** * Instance of the payment's instance (in JSON format) @@ -883,14 +883,23 @@ check_coin_paid (void *cls, for (i=0;i<pc->coins_cnt;i++) { struct DepositConfirmation *dc = &pc->dc[i]; - + /* Get matching coin from results*/ if ( (0 != memcmp (coin_pub, &dc->coin_pub, sizeof (struct TALER_CoinSpendPublicKeyP))) || (0 != TALER_amount_cmp (amount_with_fee, &dc->amount_with_fee)) ) continue; + + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Coin (%s) already found in our DB.\n", + TALER_b2s (coin_pub, sizeof (*coin_pub))); + dc->found_in_db = GNUNET_YES; + /** + * What happens if a (mad) wallet sends new coins on a + * contract that it already paid for? + */ pc->pending--; } } @@ -898,7 +907,7 @@ check_coin_paid (void *cls, /** * Check if the existing transaction matches our transaction. - * Update `transaction_exits` accordingly. + * Update `transaction_exists` accordingly. * * @param cls closure with the `struct PayContext` * @param transaction_id of the contract @@ -932,12 +941,12 @@ check_transaction_exists (void *cls, (0 == TALER_amount_cmp (total_amount, &pc->amount) ) ) { - pc->transaction_exits = GNUNET_YES; + pc->transaction_exists = GNUNET_YES; } else { GNUNET_break_op (0); - pc->transaction_exits = GNUNET_SYSERR; + pc->transaction_exists = GNUNET_SYSERR; } } @@ -949,7 +958,6 @@ get_instance (struct json_t *json); /** * Try to parse the pay request into the given pay context. - * * Schedules an error response in the connection on failure. * * @@ -1254,6 +1262,9 @@ handler_pay_json (struct MHD_Connection *connection, { struct MHD_Response *resp; int ret; + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Payment succeeded in the past; take short cut" + " and accept immediately.\n"); /* Payment succeeded in the past; take short cut and accept immediately */ @@ -1279,14 +1290,14 @@ handler_pay_json (struct MHD_Connection *connection, TALER_EC_PAY_DB_FETCH_TRANSACTION_ERROR, "Merchant database error"); } - if (GNUNET_SYSERR == pc->transaction_exits) + if (GNUNET_SYSERR == pc->transaction_exists) { GNUNET_break (0); return TMH_RESPONSE_reply_external_error (connection, TALER_EC_PAY_DB_TRANSACTION_ID_CONFLICT, "Transaction ID reused with different transaction details"); } - if (GNUNET_NO == pc->transaction_exits) + if (GNUNET_NO == pc->transaction_exists) { struct GNUNET_TIME_Absolute now; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, diff --git a/src/backenddb/plugin_merchantdb_postgres.c b/src/backenddb/plugin_merchantdb_postgres.c index cb05eebe..cad04cd2 100644 --- a/src/backenddb/plugin_merchantdb_postgres.c +++ b/src/backenddb/plugin_merchantdb_postgres.c @@ -1098,7 +1098,8 @@ postgres_find_transaction (void *cls, /** - * Lookup information about coin payments by transaction ID (and @a merchant_pub) + * Lookup information about coin payments by proposal data hash + * (and @a merchant_pub) * * @param cls closure * @param transaction_id key for the search |