summaryrefslogtreecommitdiff
path: root/src/lib/exchange_api_common.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-12-25 13:56:33 +0100
committerChristian Grothoff <christian@grothoff.org>2021-12-25 13:56:40 +0100
commit87376e02eba3f5c2cf83a493446dee0c300565a4 (patch)
tree18103edb2bdf2b29a773cce2de596b06d8265abb /src/lib/exchange_api_common.c
parent2c14d338704f4574055c4b5c51d8a79dd2e22345 (diff)
downloadexchange-87376e02eba3f5c2cf83a493446dee0c300565a4.tar.gz
exchange-87376e02eba3f5c2cf83a493446dee0c300565a4.tar.bz2
exchange-87376e02eba3f5c2cf83a493446dee0c300565a4.zip
protocol v12 changes (/recoup split, signature changes) plus database sharding plus O(n^2)=>O(n) worst-case complexity reduction on coin balance checks
Diffstat (limited to 'src/lib/exchange_api_common.c')
-rw-r--r--src/lib/exchange_api_common.c38
1 files changed, 16 insertions, 22 deletions
diff --git a/src/lib/exchange_api_common.c b/src/lib/exchange_api_common.c
index 93b992e65..139b10665 100644
--- a/src/lib/exchange_api_common.c
+++ b/src/lib/exchange_api_common.c
@@ -546,17 +546,17 @@ TALER_EXCHANGE_verify_coin_history (
else if (0 == strcasecmp (type,
"MELT"))
{
- struct TALER_RefreshMeltCoinAffirmationPS rm;
struct TALER_CoinSpendSignatureP sig;
+ struct TALER_RefreshCommitmentP rc;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_fixed_auto ("coin_sig",
&sig),
GNUNET_JSON_spec_fixed_auto ("rc",
- &rm.rc),
+ &rc),
GNUNET_JSON_spec_fixed_auto ("h_denom_pub",
- &rm.h_denom_pub),
- TALER_JSON_spec_amount_any_nbo ("melt_fee",
- &rm.melt_fee),
+ h_denom_pub),
+ TALER_JSON_spec_amount_any ("melt_fee",
+ &fee),
GNUNET_JSON_spec_end ()
};
@@ -568,26 +568,9 @@ TALER_EXCHANGE_verify_coin_history (
GNUNET_break_op (0);
return GNUNET_SYSERR;
}
- rm.purpose.size = htonl (sizeof (rm));
- rm.purpose.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_MELT);
- TALER_amount_hton (&rm.amount_with_fee,
- &amount);
- rm.coin_pub = *coin_pub;
- if (GNUNET_OK !=
- GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_WALLET_COIN_MELT,
- &rm,
- &sig.eddsa_signature,
- &coin_pub->eddsa_pub))
- {
- GNUNET_break_op (0);
- return GNUNET_SYSERR;
- }
- *h_denom_pub = rm.h_denom_pub;
if (NULL != dk)
{
/* check that melt fee matches our expectations from /keys! */
- TALER_amount_ntoh (&fee,
- &rm.melt_fee);
if ( (GNUNET_YES !=
TALER_amount_cmp_currency (&fee,
&dk->fee_refresh)) ||
@@ -599,6 +582,17 @@ TALER_EXCHANGE_verify_coin_history (
return GNUNET_SYSERR;
}
}
+ if (GNUNET_OK !=
+ TALER_wallet_melt_verify (&amount,
+ &fee,
+ &rc,
+ h_denom_pub,
+ coin_pub,
+ &sig))
+ {
+ GNUNET_break_op (0);
+ return GNUNET_SYSERR;
+ }
add = GNUNET_YES;
}
else if (0 == strcasecmp (type,