fixing #4520: be more aggressive at asserting when API is violated
This commit is contained in:
parent
f471cfcec5
commit
079ef7cb6f
@ -406,42 +406,21 @@ TALER_EXCHANGE_deposit (struct TALER_EXCHANGE_Handle *exchange,
|
|||||||
|
|
||||||
(void) GNUNET_TIME_round_abs (&wire_deadline);
|
(void) GNUNET_TIME_round_abs (&wire_deadline);
|
||||||
(void) GNUNET_TIME_round_abs (&refund_deadline);
|
(void) GNUNET_TIME_round_abs (&refund_deadline);
|
||||||
if (refund_deadline.abs_value_us > wire_deadline.abs_value_us)
|
GNUNET_assert (refund_deadline.abs_value_us <= wire_deadline.abs_value_us);
|
||||||
{
|
GNUNET_assert (GNUNET_YES ==
|
||||||
GNUNET_break (0);
|
MAH_handle_is_ready (exchange));
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
if (GNUNET_YES !=
|
|
||||||
MAH_handle_is_ready (exchange))
|
|
||||||
{
|
|
||||||
GNUNET_break (0);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
/* initialize h_wire */
|
/* initialize h_wire */
|
||||||
if (GNUNET_OK !=
|
GNUNET_assert (GNUNET_OK ==
|
||||||
TALER_JSON_hash (wire_details,
|
TALER_JSON_hash (wire_details,
|
||||||
&h_wire))
|
&h_wire));
|
||||||
{
|
|
||||||
GNUNET_break (0);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
key_state = TALER_EXCHANGE_get_keys (exchange);
|
key_state = TALER_EXCHANGE_get_keys (exchange);
|
||||||
dki = TALER_EXCHANGE_get_denomination_key (key_state,
|
dki = TALER_EXCHANGE_get_denomination_key (key_state,
|
||||||
denom_pub);
|
denom_pub);
|
||||||
if (NULL == dki)
|
GNUNET_assert (NULL != dki);
|
||||||
{
|
GNUNET_assert (GNUNET_SYSERR !=
|
||||||
TALER_LOG_WARNING ("Denomination key unknown to exchange\n");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
if (GNUNET_SYSERR ==
|
|
||||||
TALER_amount_subtract (&amount_without_fee,
|
TALER_amount_subtract (&amount_without_fee,
|
||||||
amount,
|
amount,
|
||||||
&dki->fee_deposit))
|
&dki->fee_deposit));
|
||||||
{
|
|
||||||
GNUNET_break (0);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
verify_signatures (dki,
|
verify_signatures (dki,
|
||||||
amount,
|
amount,
|
||||||
|
@ -1277,12 +1277,8 @@ TALER_EXCHANGE_refresh_melt (struct TALER_EXCHANGE_Handle *exchange,
|
|||||||
unsigned int i;
|
unsigned int i;
|
||||||
unsigned int j;
|
unsigned int j;
|
||||||
|
|
||||||
if (GNUNET_YES !=
|
GNUNET_assert (GNUNET_YES ==
|
||||||
MAH_handle_is_ready (exchange))
|
MAH_handle_is_ready (exchange));
|
||||||
{
|
|
||||||
GNUNET_break (0);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
md = deserialize_melt_data (refresh_data,
|
md = deserialize_melt_data (refresh_data,
|
||||||
refresh_data_length);
|
refresh_data_length);
|
||||||
if (NULL == md)
|
if (NULL == md)
|
||||||
@ -1736,12 +1732,8 @@ TALER_EXCHANGE_refresh_reveal (struct TALER_EXCHANGE_Handle *exchange,
|
|||||||
struct MeltData *md;
|
struct MeltData *md;
|
||||||
unsigned int j;
|
unsigned int j;
|
||||||
|
|
||||||
if (GNUNET_YES !=
|
GNUNET_assert (GNUNET_YES ==
|
||||||
MAH_handle_is_ready (exchange))
|
MAH_handle_is_ready (exchange));
|
||||||
{
|
|
||||||
GNUNET_break (0);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
md = deserialize_melt_data (refresh_data,
|
md = deserialize_melt_data (refresh_data,
|
||||||
refresh_data_length);
|
refresh_data_length);
|
||||||
if (NULL == md)
|
if (NULL == md)
|
||||||
|
@ -243,12 +243,8 @@ TALER_EXCHANGE_refund (struct TALER_EXCHANGE_Handle *exchange,
|
|||||||
json_t *refund_obj;
|
json_t *refund_obj;
|
||||||
CURL *eh;
|
CURL *eh;
|
||||||
|
|
||||||
if (GNUNET_YES !=
|
GNUNET_assert (GNUNET_YES ==
|
||||||
MAH_handle_is_ready (exchange))
|
MAH_handle_is_ready (exchange));
|
||||||
{
|
|
||||||
GNUNET_break (0);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
rr.purpose.purpose = htonl (TALER_SIGNATURE_MERCHANT_REFUND);
|
rr.purpose.purpose = htonl (TALER_SIGNATURE_MERCHANT_REFUND);
|
||||||
rr.purpose.size = htonl (sizeof (struct TALER_RefundRequestPS));
|
rr.purpose.size = htonl (sizeof (struct TALER_RefundRequestPS));
|
||||||
rr.h_contract = *h_contract;
|
rr.h_contract = *h_contract;
|
||||||
|
Loading…
Reference in New Issue
Block a user