indentation fixes

This commit is contained in:
Christian Grothoff 2019-07-21 20:15:16 +02:00
parent 721c1ee73e
commit 990e7ef348
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC

View File

@ -50,7 +50,7 @@ reply_payback_unknown (struct MHD_Connection *connection,
MHD_HTTP_NOT_FOUND, MHD_HTTP_NOT_FOUND,
"{s:s, s:I}", "{s:s, s:I}",
"error", "blinded coin unknown", "error", "blinded coin unknown",
"code", (json_int_t) ec); "code", (json_int_t) ec);
} }
@ -84,8 +84,8 @@ reply_payback_success (struct MHD_Connection *connection,
pc.reserve_pub = *reserve_pub; pc.reserve_pub = *reserve_pub;
if (GNUNET_OK != if (GNUNET_OK !=
TEH_KS_sign (&pc.purpose, TEH_KS_sign (&pc.purpose,
&pub, &pub,
&sig)) &sig))
{ {
return TEH_RESPONSE_reply_internal_error (connection, return TEH_RESPONSE_reply_internal_error (connection,
TALER_EC_EXCHANGE_BAD_CONFIGURATION, TALER_EC_EXCHANGE_BAD_CONFIGURATION,
@ -172,9 +172,9 @@ struct PaybackContext
*/ */
static enum GNUNET_DB_QueryStatus static enum GNUNET_DB_QueryStatus
payback_transaction (void *cls, payback_transaction (void *cls,
struct MHD_Connection *connection, struct MHD_Connection *connection,
struct TALER_EXCHANGEDB_Session *session, struct TALER_EXCHANGEDB_Session *session,
int *mhd_ret) int *mhd_ret)
{ {
struct PaybackContext *pc = cls; struct PaybackContext *pc = cls;
struct TALER_EXCHANGEDB_TransactionList *tl; struct TALER_EXCHANGEDB_TransactionList *tl;
@ -184,16 +184,16 @@ payback_transaction (void *cls,
/* Check whether a payback is allowed, and if so, to which /* Check whether a payback is allowed, and if so, to which
reserve / account the money should go */ reserve / account the money should go */
qs = TEH_plugin->get_reserve_by_h_blind (TEH_plugin->cls, qs = TEH_plugin->get_reserve_by_h_blind (TEH_plugin->cls,
session, session,
&pc->h_blind, &pc->h_blind,
&pc->reserve_pub); &pc->reserve_pub);
if (0 > qs) if (0 > qs)
{ {
if (GNUNET_DB_STATUS_HARD_ERROR == qs) if (GNUNET_DB_STATUS_HARD_ERROR == qs)
{ {
GNUNET_break (0); GNUNET_break (0);
*mhd_ret = TEH_RESPONSE_reply_internal_db_error (connection, *mhd_ret = TEH_RESPONSE_reply_internal_db_error (connection,
TALER_EC_PAYBACK_DB_FETCH_FAILED); TALER_EC_PAYBACK_DB_FETCH_FAILED);
} }
return qs; return qs;
} }
@ -201,7 +201,7 @@ payback_transaction (void *cls,
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
*mhd_ret = reply_payback_unknown (connection, *mhd_ret = reply_payback_unknown (connection,
TALER_EC_PAYBACK_WITHDRAW_NOT_FOUND); TALER_EC_PAYBACK_WITHDRAW_NOT_FOUND);
return GNUNET_DB_STATUS_HARD_ERROR; return GNUNET_DB_STATUS_HARD_ERROR;
} }
@ -210,14 +210,14 @@ payback_transaction (void *cls,
session, session,
&pc->coin->coin_pub, &pc->coin->coin_pub,
GNUNET_YES, GNUNET_YES,
&tl); &tl);
if (0 > qs) if (0 > qs)
{ {
if (GNUNET_DB_STATUS_HARD_ERROR == qs) if (GNUNET_DB_STATUS_HARD_ERROR == qs)
{ {
GNUNET_break (0); GNUNET_break (0);
*mhd_ret = TEH_RESPONSE_reply_internal_db_error (connection, *mhd_ret = TEH_RESPONSE_reply_internal_db_error (connection,
TALER_EC_PAYBACK_DB_FETCH_FAILED); TALER_EC_PAYBACK_DB_FETCH_FAILED);
} }
return qs; return qs;
} }
@ -226,14 +226,14 @@ payback_transaction (void *cls,
&spent)); &spent));
if (GNUNET_OK != if (GNUNET_OK !=
TEH_DB_calculate_transaction_list_totals (tl, TEH_DB_calculate_transaction_list_totals (tl,
&spent, &spent,
&spent)) &spent))
{ {
GNUNET_break (0); GNUNET_break (0);
TEH_plugin->free_coin_transaction_list (TEH_plugin->cls, TEH_plugin->free_coin_transaction_list (TEH_plugin->cls,
tl); tl);
*mhd_ret = TEH_RESPONSE_reply_internal_db_error (connection, *mhd_ret = TEH_RESPONSE_reply_internal_db_error (connection,
TALER_EC_PAYBACK_HISTORY_DB_ERROR); TALER_EC_PAYBACK_HISTORY_DB_ERROR);
return GNUNET_DB_STATUS_HARD_ERROR; return GNUNET_DB_STATUS_HARD_ERROR;
} }
if (GNUNET_SYSERR == if (GNUNET_SYSERR ==
@ -245,7 +245,7 @@ payback_transaction (void *cls,
TEH_plugin->free_coin_transaction_list (TEH_plugin->cls, TEH_plugin->free_coin_transaction_list (TEH_plugin->cls,
tl); tl);
*mhd_ret = TEH_RESPONSE_reply_internal_db_error (connection, *mhd_ret = TEH_RESPONSE_reply_internal_db_error (connection,
TALER_EC_PAYBACK_COIN_BALANCE_NEGATIVE); TALER_EC_PAYBACK_COIN_BALANCE_NEGATIVE);
return GNUNET_DB_STATUS_HARD_ERROR; return GNUNET_DB_STATUS_HARD_ERROR;
} }
if ( (0 == pc->amount.fraction) && if ( (0 == pc->amount.fraction) &&
@ -254,8 +254,8 @@ payback_transaction (void *cls,
TEH_plugin->rollback (TEH_plugin->cls, TEH_plugin->rollback (TEH_plugin->cls,
session); session);
*mhd_ret = TEH_RESPONSE_reply_coin_insufficient_funds (connection, *mhd_ret = TEH_RESPONSE_reply_coin_insufficient_funds (connection,
TALER_EC_PAYBACK_COIN_BALANCE_ZERO, TALER_EC_PAYBACK_COIN_BALANCE_ZERO,
tl); tl);
TEH_plugin->free_coin_transaction_list (TEH_plugin->cls, TEH_plugin->free_coin_transaction_list (TEH_plugin->cls,
tl); tl);
return GNUNET_DB_STATUS_HARD_ERROR; return GNUNET_DB_STATUS_HARD_ERROR;
@ -267,21 +267,41 @@ payback_transaction (void *cls,
/* add coin to list of wire transfers for payback */ /* add coin to list of wire transfers for payback */
qs = TEH_plugin->insert_payback_request (TEH_plugin->cls, qs = TEH_plugin->insert_payback_request (TEH_plugin->cls,
session, session,
&pc->reserve_pub, &pc->reserve_pub,
pc->coin, pc->coin,
pc->coin_sig, pc->coin_sig,
pc->coin_bks, pc->coin_bks,
&pc->amount, &pc->amount,
&pc->h_blind, &pc->h_blind,
pc->now); pc->now);
if (0 > qs) if (0 > qs)
{ {
if (GNUNET_DB_STATUS_HARD_ERROR == qs) if (GNUNET_DB_STATUS_HARD_ERROR == qs)
{ {
TALER_LOG_WARNING ("Failed to store /payback information in database\n"); TALER_LOG_WARNING ("Failed to store /payback information in database\n");
*mhd_ret = TEH_RESPONSE_reply_internal_db_error (connection, *mhd_ret = TEH_RESPONSE_reply_internal_db_error (connection,
TALER_EC_PAYBACK_DB_PUT_FAILED); TALER_EC_PAYBACK_DB_PUT_FAILED);
}
return qs;
}
/* increment reserve balance */
qs = TEH_plugin->increment_reserve_balance (TEH_plugin->cls,
session,
&pc->reserve_pub,
pc->coin,
pc->coin_sig,
pc->coin_bks,
&pc->amount,
&pc->h_blind,
pc->now);
if (0 > qs)
{
if (GNUNET_DB_STATUS_HARD_ERROR == qs)
{
TALER_LOG_WARNING ("Failed to store /payback information in database\n");
*mhd_ret = TEH_RESPONSE_reply_internal_db_error (connection,
TALER_EC_PAYBACK_DB_PUT_FAILED);
} }
return qs; return qs;
} }
@ -333,7 +353,7 @@ verify_and_execute_payback (struct MHD_Connection *connection,
TEH_KS_release (key_state); TEH_KS_release (key_state);
TALER_LOG_WARNING ("Denomination key in /payback request not in payback mode\n"); TALER_LOG_WARNING ("Denomination key in /payback request not in payback mode\n");
return TEH_RESPONSE_reply_arg_unknown (connection, return TEH_RESPONSE_reply_arg_unknown (connection,
TALER_EC_PAYBACK_DENOMINATION_KEY_UNKNOWN, TALER_EC_PAYBACK_DENOMINATION_KEY_UNKNOWN,
"denom_pub"); "denom_pub");
} }
TALER_amount_ntoh (&pc.value, TALER_amount_ntoh (&pc.value,
@ -347,7 +367,7 @@ verify_and_execute_payback (struct MHD_Connection *connection,
TALER_LOG_WARNING ("Invalid coin passed for /payback\n"); TALER_LOG_WARNING ("Invalid coin passed for /payback\n");
TEH_KS_release (key_state); TEH_KS_release (key_state);
return TEH_RESPONSE_reply_signature_invalid (connection, return TEH_RESPONSE_reply_signature_invalid (connection,
TALER_EC_PAYBACK_DENOMINATION_SIGNATURE_INVALID, TALER_EC_PAYBACK_DENOMINATION_SIGNATURE_INVALID,
"denom_sig"); "denom_sig");
} }
@ -367,7 +387,7 @@ verify_and_execute_payback (struct MHD_Connection *connection,
TALER_LOG_WARNING ("Invalid signature on /payback request\n"); TALER_LOG_WARNING ("Invalid signature on /payback request\n");
TEH_KS_release (key_state); TEH_KS_release (key_state);
return TEH_RESPONSE_reply_signature_invalid (connection, return TEH_RESPONSE_reply_signature_invalid (connection,
TALER_EC_PAYBACK_SIGNATURE_INVALID, TALER_EC_PAYBACK_SIGNATURE_INVALID,
"coin_sig"); "coin_sig");
} }