scope reduction, mark possible places for improvement

This commit is contained in:
Christian Grothoff 2020-03-23 21:36:49 +01:00
parent 8acfca6718
commit 0bd53ed443
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC

View File

@ -1235,6 +1235,7 @@ refresh_session_cb (void *cls,
&issue->denom_hash); &issue->denom_hash);
if (NULL == dso) if (NULL == dso)
{ {
// FIXME: handle more nicely!?!
GNUNET_break (0); GNUNET_break (0);
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
@ -1440,6 +1441,7 @@ deposit_cb (void *cls,
if (NULL == ds) if (NULL == ds)
{ {
GNUNET_break (0); GNUNET_break (0);
// FIXME: handle/report more nicely!??!
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
if (GNUNET_SYSERR == if (GNUNET_SYSERR ==
@ -1534,7 +1536,6 @@ refund_cb (void *cls,
struct CoinContext *cc = cls; struct CoinContext *cc = cls;
const struct TALER_DenominationKeyValidityPS *issue; const struct TALER_DenominationKeyValidityPS *issue;
struct DenominationSummary *ds; struct DenominationSummary *ds;
struct TALER_RefundRequestPS rr;
struct TALER_Amount amount_without_fee; struct TALER_Amount amount_without_fee;
struct TALER_Amount refund_fee; struct TALER_Amount refund_fee;
enum GNUNET_DB_QueryStatus qs; enum GNUNET_DB_QueryStatus qs;
@ -1559,15 +1560,19 @@ refund_cb (void *cls,
} }
/* verify refund signature */ /* verify refund signature */
rr.purpose.purpose = htonl (TALER_SIGNATURE_MERCHANT_REFUND); {
rr.purpose.size = htonl (sizeof (rr)); struct TALER_RefundRequestPS rr = {
rr.h_contract_terms = *h_contract_terms; .purpose.purpose = htonl (TALER_SIGNATURE_MERCHANT_REFUND),
rr.coin_pub = *coin_pub; .purpose.size = htonl (sizeof (rr)),
rr.merchant = *merchant_pub; .h_contract_terms = *h_contract_terms,
rr.rtransaction_id = GNUNET_htonll (rtransaction_id); .coin_pub = *coin_pub,
.merchant = *merchant_pub,
.rtransaction_id = GNUNET_htonll (rtransaction_id),
.refund_fee = issue->fee_refund
};
TALER_amount_hton (&rr.refund_amount, TALER_amount_hton (&rr.refund_amount,
amount_with_fee); amount_with_fee);
rr.refund_fee = issue->fee_refund;
if (GNUNET_OK != if (GNUNET_OK !=
GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MERCHANT_REFUND, GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MERCHANT_REFUND,
&rr.purpose, &rr.purpose,
@ -1588,6 +1593,7 @@ refund_cb (void *cls,
amount_with_fee)); amount_with_fee));
return GNUNET_OK; return GNUNET_OK;
} }
}
TALER_amount_ntoh (&refund_fee, TALER_amount_ntoh (&refund_fee,
&issue->fee_refund); &issue->fee_refund);
@ -1617,6 +1623,7 @@ refund_cb (void *cls,
if (NULL == ds) if (NULL == ds)
{ {
GNUNET_break (0); GNUNET_break (0);
// FIXME: handle more nicely!?!?
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
GNUNET_assert (GNUNET_OK == GNUNET_assert (GNUNET_OK ==