aboutsummaryrefslogtreecommitdiff
path: root/src/lib/exchange_api_refreshes_reveal.c
diff options
context:
space:
mode:
authorÖzgür Kesim <oec-taler@kesim.org>2022-02-17 12:23:06 +0100
committerÖzgür Kesim <oec-taler@kesim.org>2022-02-18 00:30:19 +0100
commita78b3345fbf017b1cddfd09afb4b2c29287b0bba (patch)
tree45752022adc8b1661fb1662df40af4d58ab7d5f4 /src/lib/exchange_api_refreshes_reveal.c
parent8bdf6ab19df70c16d335ecf82f2c3b2117eeb70e (diff)
[age restriction] progress 15/n - melt/refresh/reveal and recoup
Added age restriction support for - melt/refresh/reveal - recoup However, tests are not yet implemented for those flows. Also: minor fixes and refactoring.
Diffstat (limited to 'src/lib/exchange_api_refreshes_reveal.c')
-rw-r--r--src/lib/exchange_api_refreshes_reveal.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/lib/exchange_api_refreshes_reveal.c b/src/lib/exchange_api_refreshes_reveal.c
index 8d04c279a..d5f2265c4 100644
--- a/src/lib/exchange_api_refreshes_reveal.c
+++ b/src/lib/exchange_api_refreshes_reveal.c
@@ -142,7 +142,6 @@ refresh_reveal_ok (struct TALER_EXCHANGE_RefreshesRevealHandle *rrh,
&rcis[i];
const struct FreshCoinData *fcd = &rrh->md.fcds[i];
const struct TALER_DenominationPublicKey *pk;
- struct TALER_AgeCommitmentHash *ach = NULL;
json_t *jsonai;
struct TALER_BlindedDenominationSignature blind_sig;
struct TALER_CoinSpendPublicKeyP coin_pub;
@@ -157,14 +156,22 @@ refresh_reveal_ok (struct TALER_EXCHANGE_RefreshesRevealHandle *rrh,
rci->ps = fcd->ps[rrh->noreveal_index];
rci->bks = fcd->bks[rrh->noreveal_index];
+ rci->age_commitment = fcd->age_commitment[rrh->noreveal_index];
+ rci->h_age_commitment = NULL;
pk = &fcd->fresh_pk;
jsonai = json_array_get (jsona, i);
+
GNUNET_assert (NULL != jsonai);
+ GNUNET_assert (
+ (NULL != rrh->md.melted_coin.age_commitment) ==
+ (NULL != rci->age_commitment));
- if (! TALER_AgeCommitmentHash_isNullOrZero (
- &rrh->md.melted_coin.h_age_commitment))
+ if (NULL != rci->age_commitment)
{
- /* FIXME-oec: need to pull fresh_ach from somewhere */
+ rci->h_age_commitment = GNUNET_new (struct TALER_AgeCommitmentHash);
+ TALER_age_commitment_hash (
+ rci->age_commitment,
+ rci->h_age_commitment);
}
if (GNUNET_OK !=
@@ -188,14 +195,14 @@ refresh_reveal_ok (struct TALER_EXCHANGE_RefreshesRevealHandle *rrh,
GNUNET_CRYPTO_eddsa_key_get_public (&rci->coin_priv.eddsa_priv,
&coin_pub.eddsa_pub);
TALER_coin_pub_hash (&coin_pub,
- ach,
+ rci->h_age_commitment,
&coin_hash);
if (GNUNET_OK !=
TALER_planchet_to_coin (pk,
&blind_sig,
&bks,
&rci->coin_priv,
- ach,
+ rci->h_age_commitment,
&coin_hash,
&rrh->alg_values[i],
&coin))