-more minor bugfixes
This commit is contained in:
parent
f0bcbf6586
commit
446761b602
@ -842,21 +842,17 @@ help_melt (struct CoinHistoryParseContext *pc,
|
|||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NULL != pc->dk)
|
/* check that melt fee matches our expectations from /keys! */
|
||||||
|
if ( (GNUNET_YES !=
|
||||||
|
TALER_amount_cmp_currency (&melt_fee,
|
||||||
|
&pc->dk->fees.refresh)) ||
|
||||||
|
(0 !=
|
||||||
|
TALER_amount_cmp (&melt_fee,
|
||||||
|
&pc->dk->fees.refresh)) )
|
||||||
{
|
{
|
||||||
/* check that melt fee matches our expectations from /keys! */
|
GNUNET_break_op (0);
|
||||||
if ( (GNUNET_YES !=
|
return GNUNET_SYSERR;
|
||||||
TALER_amount_cmp_currency (&melt_fee,
|
|
||||||
&pc->dk->fees.refresh)) ||
|
|
||||||
(0 !=
|
|
||||||
TALER_amount_cmp (&melt_fee,
|
|
||||||
&pc->dk->fees.refresh)) )
|
|
||||||
{
|
|
||||||
GNUNET_break_op (0);
|
|
||||||
return GNUNET_SYSERR;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
TALER_wallet_melt_verify (
|
TALER_wallet_melt_verify (
|
||||||
amount,
|
amount,
|
||||||
@ -938,26 +934,23 @@ help_refund (struct CoinHistoryParseContext *pc,
|
|||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
/* NOTE: theoretically, we could also check that the given
|
/* NOTE: theoretically, we could also check that the given
|
||||||
merchant_pub and h_contract_terms appear in the
|
merchant_pub and h_contract_terms appear in the
|
||||||
history under deposits. However, there is really no benefit
|
history under deposits. However, there is really no benefit
|
||||||
for the exchange to lie here, so not checking is probably OK
|
for the exchange to lie here, so not checking is probably OK
|
||||||
(an auditor ought to check, though). Then again, we similarly
|
(an auditor ought to check, though). Then again, we similarly
|
||||||
had no reason to check the merchant's signature (other than a
|
had no reason to check the merchant's signature (other than a
|
||||||
well-formendess check). */
|
well-formendess check). */
|
||||||
|
|
||||||
/* check that refund fee matches our expectations from /keys! */
|
/* check that refund fee matches our expectations from /keys! */
|
||||||
if (NULL != pc->dk)
|
if ( (GNUNET_YES !=
|
||||||
|
TALER_amount_cmp_currency (&refund_fee,
|
||||||
|
&pc->dk->fees.refund)) ||
|
||||||
|
(0 !=
|
||||||
|
TALER_amount_cmp (&refund_fee,
|
||||||
|
&pc->dk->fees.refund)) )
|
||||||
{
|
{
|
||||||
if ( (GNUNET_YES !=
|
GNUNET_break_op (0);
|
||||||
TALER_amount_cmp_currency (&refund_fee,
|
return GNUNET_SYSERR;
|
||||||
&pc->dk->fees.refund)) ||
|
|
||||||
(0 !=
|
|
||||||
TALER_amount_cmp (&refund_fee,
|
|
||||||
&pc->dk->fees.refund)) )
|
|
||||||
{
|
|
||||||
GNUNET_break_op (0);
|
|
||||||
return GNUNET_SYSERR;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return GNUNET_NO;
|
return GNUNET_NO;
|
||||||
}
|
}
|
||||||
|
@ -406,8 +406,9 @@ TALER_EXCHANGE_account_merge (
|
|||||||
{
|
{
|
||||||
struct TALER_Amount zero_purse_fee;
|
struct TALER_Amount zero_purse_fee;
|
||||||
|
|
||||||
TALER_amount_set_zero (purse_value_after_fees->currency,
|
GNUNET_assert (GNUNET_OK ==
|
||||||
&zero_purse_fee);
|
TALER_amount_set_zero (purse_value_after_fees->currency,
|
||||||
|
&zero_purse_fee));
|
||||||
TALER_wallet_account_merge_sign (merge_timestamp,
|
TALER_wallet_account_merge_sign (merge_timestamp,
|
||||||
purse_pub,
|
purse_pub,
|
||||||
purse_expiration,
|
purse_expiration,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
This file is part of TALER
|
This file is part of TALER
|
||||||
Copyright (C) 2014-2021 Taler Systems SA
|
Copyright (C) 2014-2022 Taler Systems SA
|
||||||
|
|
||||||
TALER is free software; you can redistribute it and/or modify it under the
|
TALER is free software; you can redistribute it and/or modify it under the
|
||||||
terms of the GNU General Public License as published by the Free Software
|
terms of the GNU General Public License as published by the Free Software
|
||||||
@ -445,17 +445,30 @@ verify_conflict_history_ok (struct TALER_EXCHANGE_RefundHandle *rh,
|
|||||||
{
|
{
|
||||||
rtotal = rh->refund_amount;
|
rtotal = rh->refund_amount;
|
||||||
}
|
}
|
||||||
if (-1 == TALER_amount_cmp (&dtotal,
|
if ( (have_refund) && (! have_deposit) )
|
||||||
|
{
|
||||||
|
GNUNET_break (0);
|
||||||
|
GNUNET_JSON_parse_free (spec);
|
||||||
|
return GNUNET_SYSERR;
|
||||||
|
}
|
||||||
|
if (! (have_refund && have_deposit))
|
||||||
|
{
|
||||||
|
/* need both for a refund-deposit conflict proof */
|
||||||
|
GNUNET_break (0);
|
||||||
|
GNUNET_JSON_parse_free (spec);
|
||||||
|
return GNUNET_SYSERR;
|
||||||
|
}
|
||||||
|
if (-1 != TALER_amount_cmp (&dtotal,
|
||||||
&rtotal))
|
&rtotal))
|
||||||
{
|
{
|
||||||
/* dtotal < rtotal: good! */
|
/* rtotal <= dtotal is fine, no conflict! */
|
||||||
|
GNUNET_break_op (0);
|
||||||
GNUNET_JSON_parse_free (spec);
|
GNUNET_JSON_parse_free (spec);
|
||||||
return GNUNET_OK;
|
return GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
/* this fails to prove a conflict */
|
/* dtotal < rtotal: that's a conflict! */
|
||||||
GNUNET_break_op (0);
|
|
||||||
GNUNET_JSON_parse_free (spec);
|
GNUNET_JSON_parse_free (spec);
|
||||||
return GNUNET_SYSERR;
|
return GNUNET_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -311,6 +311,7 @@ TALER_EXCHANGE_reserves_history (
|
|||||||
if (NULL == keys)
|
if (NULL == keys)
|
||||||
{
|
{
|
||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
|
curl_easy_cleanup (eh);
|
||||||
GNUNET_free (rsh->url);
|
GNUNET_free (rsh->url);
|
||||||
GNUNET_free (rsh);
|
GNUNET_free (rsh);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -320,6 +321,7 @@ TALER_EXCHANGE_reserves_history (
|
|||||||
if (NULL == gf)
|
if (NULL == gf)
|
||||||
{
|
{
|
||||||
GNUNET_break_op (0);
|
GNUNET_break_op (0);
|
||||||
|
curl_easy_cleanup (eh);
|
||||||
GNUNET_free (rsh->url);
|
GNUNET_free (rsh->url);
|
||||||
GNUNET_free (rsh);
|
GNUNET_free (rsh);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -164,14 +164,16 @@ insert_deposit_run (void *cls,
|
|||||||
0,
|
0,
|
||||||
sizeof (deposit));
|
sizeof (deposit));
|
||||||
|
|
||||||
GNUNET_CRYPTO_kdf (&merchant_priv,
|
GNUNET_assert (
|
||||||
sizeof (struct TALER_MerchantPrivateKeyP),
|
GNUNET_YES ==
|
||||||
"merchant-priv",
|
GNUNET_CRYPTO_kdf (&merchant_priv,
|
||||||
strlen ("merchant-priv"),
|
sizeof (struct TALER_MerchantPrivateKeyP),
|
||||||
ids->merchant_name,
|
"merchant-priv",
|
||||||
strlen (ids->merchant_name),
|
strlen ("merchant-priv"),
|
||||||
NULL,
|
ids->merchant_name,
|
||||||
0);
|
strlen (ids->merchant_name),
|
||||||
|
NULL,
|
||||||
|
0));
|
||||||
GNUNET_CRYPTO_eddsa_key_get_public (&merchant_priv.eddsa_priv,
|
GNUNET_CRYPTO_eddsa_key_get_public (&merchant_priv.eddsa_priv,
|
||||||
&deposit.merchant_pub.eddsa_pub);
|
&deposit.merchant_pub.eddsa_pub);
|
||||||
GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK,
|
GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK,
|
||||||
|
Loading…
Reference in New Issue
Block a user