scope reduction, mark possible places for improvement
This commit is contained in:
parent
8acfca6718
commit
0bd53ed443
@ -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,34 +1560,39 @@ refund_cb (void *cls,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* verify refund signature */
|
/* verify refund signature */
|
||||||
rr.purpose.purpose = htonl (TALER_SIGNATURE_MERCHANT_REFUND);
|
|
||||||
rr.purpose.size = htonl (sizeof (rr));
|
|
||||||
rr.h_contract_terms = *h_contract_terms;
|
|
||||||
rr.coin_pub = *coin_pub;
|
|
||||||
rr.merchant = *merchant_pub;
|
|
||||||
rr.rtransaction_id = GNUNET_htonll (rtransaction_id);
|
|
||||||
TALER_amount_hton (&rr.refund_amount,
|
|
||||||
amount_with_fee);
|
|
||||||
rr.refund_fee = issue->fee_refund;
|
|
||||||
if (GNUNET_OK !=
|
|
||||||
GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MERCHANT_REFUND,
|
|
||||||
&rr.purpose,
|
|
||||||
&merchant_sig->eddsa_sig,
|
|
||||||
&merchant_pub->eddsa_pub))
|
|
||||||
{
|
{
|
||||||
TALER_ARL_report (report_bad_sig_losses,
|
struct TALER_RefundRequestPS rr = {
|
||||||
json_pack ("{s:s, s:I, s:o, s:o}",
|
.purpose.purpose = htonl (TALER_SIGNATURE_MERCHANT_REFUND),
|
||||||
"operation", "refund",
|
.purpose.size = htonl (sizeof (rr)),
|
||||||
"row", (json_int_t) rowid,
|
.h_contract_terms = *h_contract_terms,
|
||||||
"loss", TALER_JSON_from_amount (
|
.coin_pub = *coin_pub,
|
||||||
amount_with_fee),
|
.merchant = *merchant_pub,
|
||||||
"key_pub", GNUNET_JSON_from_data_auto (
|
.rtransaction_id = GNUNET_htonll (rtransaction_id),
|
||||||
merchant_pub)));
|
.refund_fee = issue->fee_refund
|
||||||
GNUNET_assert (GNUNET_OK ==
|
};
|
||||||
TALER_amount_add (&total_bad_sig_loss,
|
|
||||||
&total_bad_sig_loss,
|
TALER_amount_hton (&rr.refund_amount,
|
||||||
amount_with_fee));
|
amount_with_fee);
|
||||||
return GNUNET_OK;
|
if (GNUNET_OK !=
|
||||||
|
GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MERCHANT_REFUND,
|
||||||
|
&rr.purpose,
|
||||||
|
&merchant_sig->eddsa_sig,
|
||||||
|
&merchant_pub->eddsa_pub))
|
||||||
|
{
|
||||||
|
TALER_ARL_report (report_bad_sig_losses,
|
||||||
|
json_pack ("{s:s, s:I, s:o, s:o}",
|
||||||
|
"operation", "refund",
|
||||||
|
"row", (json_int_t) rowid,
|
||||||
|
"loss", TALER_JSON_from_amount (
|
||||||
|
amount_with_fee),
|
||||||
|
"key_pub", GNUNET_JSON_from_data_auto (
|
||||||
|
merchant_pub)));
|
||||||
|
GNUNET_assert (GNUNET_OK ==
|
||||||
|
TALER_amount_add (&total_bad_sig_loss,
|
||||||
|
&total_bad_sig_loss,
|
||||||
|
amount_with_fee));
|
||||||
|
return GNUNET_OK;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TALER_amount_ntoh (&refund_fee,
|
TALER_amount_ntoh (&refund_fee,
|
||||||
@ -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 ==
|
||||||
|
Loading…
Reference in New Issue
Block a user