aboutsummaryrefslogtreecommitdiff
path: root/src/exchange
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2022-04-05 17:15:50 +0200
committerChristian Grothoff <christian@grothoff.org>2022-04-05 17:15:50 +0200
commitf3a4b00907410444055f47d4ff2074b44f981ad3 (patch)
treecb8f191a285152649e0b780aad8154f5b819f924 /src/exchange
parent71916414069d18ec5b7d5901d52d62a2aaa1403d (diff)
adapt to latest GNUnet API: GNUNET_JSON_spec_mark_optional() changed
Diffstat (limited to 'src/exchange')
-rw-r--r--src/exchange/Makefile.am1
-rw-r--r--src/exchange/taler-exchange-httpd_deposit.c6
-rw-r--r--src/exchange/taler-exchange-httpd_melt.c19
-rw-r--r--src/exchange/taler-exchange-httpd_metrics.h3
-rw-r--r--src/exchange/taler-exchange-httpd_purses_create.c154
-rw-r--r--src/exchange/taler-exchange-httpd_purses_create.h47
-rw-r--r--src/exchange/taler-exchange-httpd_recoup-refresh.c6
-rw-r--r--src/exchange/taler-exchange-httpd_recoup.c6
-rw-r--r--src/exchange/taler-exchange-httpd_refreshes_reveal.c20
9 files changed, 189 insertions, 73 deletions
diff --git a/src/exchange/Makefile.am b/src/exchange/Makefile.am
index dd8edfb9..c4c1656a 100644
--- a/src/exchange/Makefile.am
+++ b/src/exchange/Makefile.am
@@ -103,6 +103,7 @@ taler_exchange_httpd_SOURCES = \
taler-exchange-httpd_melt.c taler-exchange-httpd_melt.h \
taler-exchange-httpd_metrics.c taler-exchange-httpd_metrics.h \
taler-exchange-httpd_mhd.c taler-exchange-httpd_mhd.h \
+ taler-exchange-httpd_purses_create.c taler-exchange-httpd_purses_create.h \
taler-exchange-httpd_recoup.c taler-exchange-httpd_recoup.h \
taler-exchange-httpd_recoup-refresh.c taler-exchange-httpd_recoup-refresh.h \
taler-exchange-httpd_refreshes_reveal.c taler-exchange-httpd_refreshes_reveal.h \
diff --git a/src/exchange/taler-exchange-httpd_deposit.c b/src/exchange/taler-exchange-httpd_deposit.c
index 011f5f15..0ce5add3 100644
--- a/src/exchange/taler-exchange-httpd_deposit.c
+++ b/src/exchange/taler-exchange-httpd_deposit.c
@@ -224,14 +224,16 @@ TEH_handler_deposit (struct MHD_Connection *connection,
&deposit.h_contract_terms),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_fixed_auto ("h_age_commitment",
- &deposit.coin.h_age_commitment)),
+ &deposit.coin.h_age_commitment),
+ &deposit.coin.no_age_commitment),
GNUNET_JSON_spec_fixed_auto ("coin_sig",
&deposit.csig),
GNUNET_JSON_spec_timestamp ("timestamp",
&deposit.timestamp),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_timestamp ("refund_deadline",
- &deposit.refund_deadline)),
+ &deposit.refund_deadline),
+ NULL),
GNUNET_JSON_spec_timestamp ("wire_transfer_deadline",
&deposit.wire_deadline),
GNUNET_JSON_spec_end ()
diff --git a/src/exchange/taler-exchange-httpd_melt.c b/src/exchange/taler-exchange-httpd_melt.c
index 2ff03023..3d6f05c0 100644
--- a/src/exchange/taler-exchange-httpd_melt.c
+++ b/src/exchange/taler-exchange-httpd_melt.c
@@ -120,9 +120,9 @@ struct MeltContext
bool coin_is_dirty;
/**
- * True if @e rms is set.
+ * True if @e rms is missing.
*/
- bool have_rms;
+ bool no_rms;
};
@@ -161,9 +161,9 @@ melt_transaction (void *cls,
if (0 >
(qs = TEH_plugin->do_melt (TEH_plugin->cls,
- rmc->have_rms
- ? &rmc->rms
- : NULL,
+ rmc->no_rms
+ ? NULL
+ : &rmc->rms,
&rmc->refresh_session,
rmc->known_coin_id,
&rmc->zombie_required,
@@ -443,7 +443,8 @@ TEH_handler_melt (struct MHD_Connection *connection,
&rmc.refresh_session.coin.denom_pub_hash),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_fixed_auto ("age_commitment_hash",
- &rmc.refresh_session.coin.h_age_commitment)),
+ &rmc.refresh_session.coin.h_age_commitment),
+ &rmc.refresh_session.coin.no_age_commitment),
GNUNET_JSON_spec_fixed_auto ("confirm_sig",
&rmc.refresh_session.coin_sig),
TALER_JSON_spec_amount ("value_with_fee",
@@ -453,7 +454,8 @@ TEH_handler_melt (struct MHD_Connection *connection,
&rmc.refresh_session.rc),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_fixed_auto ("rms",
- &rmc.rms)),
+ &rmc.rms),
+ &rmc.no_rms),
GNUNET_JSON_spec_end ()
};
@@ -469,9 +471,6 @@ TEH_handler_melt (struct MHD_Connection *connection,
return (GNUNET_SYSERR == ret) ? MHD_NO : MHD_YES;
}
- rmc.have_rms = (NULL != json_object_get (root,
- "rms"));
-
{
MHD_RESULT res;
diff --git a/src/exchange/taler-exchange-httpd_metrics.h b/src/exchange/taler-exchange-httpd_metrics.h
index a74fa44f..d1d20d9a 100644
--- a/src/exchange/taler-exchange-httpd_metrics.h
+++ b/src/exchange/taler-exchange-httpd_metrics.h
@@ -35,7 +35,8 @@ enum TEH_MetricTypeRequest
TEH_MT_REQUEST_DEPOSIT = 1,
TEH_MT_REQUEST_WITHDRAW = 2,
TEH_MT_REQUEST_MELT = 3,
- TEH_MT_REQUEST_COUNT = 4 /* MUST BE LAST! */
+ TEH_MT_REQUEST_PURSE_CREATE = 4,
+ TEH_MT_REQUEST_COUNT = 5 /* MUST BE LAST! */
};
/**
diff --git a/src/exchange/taler-exchange-httpd_purses_create.c b/src/exchange/taler-exchange-httpd_purses_create.c
index 326dad5c..610320da 100644
--- a/src/exchange/taler-exchange-httpd_purses_create.c
+++ b/src/exchange/taler-exchange-httpd_purses_create.c
@@ -63,6 +63,11 @@ struct Coin
* Amount to be put into the purse from this coin.
*/
struct TALER_Amount amount_minus_fee;
+
+ /**
+ * ID of the coin in known_coins.
+ */
+ uint64_t known_coin_id;
};
@@ -141,6 +146,10 @@ struct PurseCreateContext
*/
unsigned int num_coins;
+ /**
+ * Minimum age for deposits into this purse.
+ */
+ uint32_t min_age;
};
@@ -165,7 +174,7 @@ reply_create_success (struct MHD_Connection *connection,
pcc->exchange_timestamp,
pcc->purse_expiration,
&pcc->amount,
- &pcc->total_deposited,
+ &pcc->deposit_total,
pcc->purse_pub,
&pcc->merge_pub,
&pcc->h_contract_terms,
@@ -180,8 +189,8 @@ reply_create_success (struct MHD_Connection *connection,
return TALER_MHD_REPLY_JSON_PACK (
connection,
MHD_HTTP_OK,
- GNUNET_JSON_pack_amount ("total_deposited",
- &pcc->deposit_total),
+ TALER_JSON_pack_amount ("total_deposited",
+ &pcc->deposit_total),
GNUNET_JSON_pack_timestamp ("exchange_timestamp",
pcc->exchange_timestamp),
GNUNET_JSON_pack_data_auto ("exchange_sig",
@@ -215,7 +224,7 @@ create_transaction (void *cls,
/* 1) create purse */
qs = TEH_plugin->insert_purse_request (TEH_plugin->cls,
- &pcc->purse_pub,
+ pcc->purse_pub,
&pcc->merge_pub,
pcc->purse_expiration,
&pcc->h_contract_terms,
@@ -244,6 +253,7 @@ create_transaction (void *cls,
struct TALER_Amount target_amount;
struct TALER_Amount balance;
struct TALER_PurseContractSignatureP purse_sig;
+ uint32_t min_age;
TEH_plugin->rollback (TEH_plugin->cls);
qs = TEH_plugin->select_purse_request (TEH_plugin->cls,
@@ -251,6 +261,7 @@ create_transaction (void *cls,
&merge_pub,
&purse_expiration,
&h_contract_terms,
+ &min_age,
&target_amount,
&balance,
&purse_sig);
@@ -270,8 +281,10 @@ create_transaction (void *cls,
MHD_HTTP_CONFLICT,
TALER_JSON_pack_ec (
TALER_EC_EXCHANGE_PURSE_CREATE_CONFLICTING_META_DATA),
- GNUNET_JSON_pack_amount ("amount",
- &amount),
+ TALER_JSON_pack_amount ("amount",
+ &target_amount),
+ GNUNET_JSON_pack_uint64 ("min_age",
+ min_age),
GNUNET_JSON_pack_timestamp ("purse_expiration",
purse_expiration),
GNUNET_JSON_pack_data_auto ("purse_sig",
@@ -287,15 +300,17 @@ create_transaction (void *cls,
{
struct Coin *coin = &pcc->coins[i];
bool balance_ok = false;
+ bool conflict = true;
qs = TEH_plugin->do_purse_deposit (TEH_plugin->cls,
- &pcc->purse_pub,
+ pcc->purse_pub,
&coin->cpi.coin_pub,
&coin->amount,
&coin->coin_sig,
&coin->amount_minus_fee,
- &balance_ok);
- if (qs < 0)
+ &balance_ok,
+ &conflict);
+ if (qs <= 0)
{
if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
return qs;
@@ -313,14 +328,58 @@ create_transaction (void *cls,
= TEH_RESPONSE_reply_coin_insufficient_funds (
connection,
TALER_EC_EXCHANGE_GENERIC_INSUFFICIENT_FUNDS,
- &coin->pci.coin_pub);
+ &coin->cpi.coin_pub);
+ return GNUNET_DB_STATUS_HARD_ERROR;
+ }
+ if (conflict)
+ {
+ struct TALER_Amount amount;
+ struct TALER_CoinSpendPublicKeyP coin_pub;
+ struct TALER_CoinSpendSignatureP coin_sig;
+ char *partner_url = NULL;
+
+ TEH_plugin->rollback (TEH_plugin->cls);
+ qs = TEH_plugin->get_purse_deposit (TEH_plugin->cls,
+ pcc->purse_pub,
+ &coin->cpi.coin_pub,
+ &amount,
+ &coin_sig,
+ &partner_url);
+ if (qs < 0)
+ {
+ GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR != qs);
+ TALER_LOG_WARNING (
+ "Failed to fetch purse deposit information from database\n");
+ *mhd_ret = TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_DB_FETCH_FAILED,
+ "get purse deposit");
+ return GNUNET_DB_STATUS_HARD_ERROR;
+ }
+
+ *mhd_ret
+ = TALER_MHD_REPLY_JSON_PACK (
+ connection,
+ MHD_HTTP_CONFLICT,
+ TALER_JSON_pack_ec (
+ TALER_EC_EXCHANGE_PURSE_DEPOSIT_CONFLICTING_META_DATA),
+ GNUNET_JSON_pack_data_auto ("coin_pub",
+ &coin_pub),
+ GNUNET_JSON_pack_data_auto ("coin_sig",
+ &coin_sig),
+ GNUNET_JSON_pack_allow_null (
+ GNUNET_JSON_pack_string ("partner_url",
+ partner_url)),
+ TALER_JSON_pack_amount ("amount",
+ &amount));
+ GNUNET_free (partner_url);
return GNUNET_DB_STATUS_HARD_ERROR;
}
}
/* 3) if present, persist contract */
in_conflict = true;
qs = TEH_plugin->insert_contract (TEH_plugin->cls,
- &pcc->purse_pub,
+ pcc->purse_pub,
&pcc->contract_pub,
pcc->econtract_size,
pcc->econtract,
@@ -345,12 +404,12 @@ create_transaction (void *cls,
void *econtract;
struct GNUNET_HashCode h_econtract;
- qs = select_contract (cls,
- &pcc->purse_pub,
- &pub_ckey,
- &econtract_sig,
- &econtract_size,
- &econtract);
+ qs = TEH_plugin->select_contract (TEH_plugin->cls,
+ pcc->purse_pub,
+ &pub_ckey,
+ &econtract_sig,
+ &econtract_size,
+ &econtract);
if (qs <= 0)
{
if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
@@ -411,8 +470,8 @@ parse_coin (struct MHD_Connection *connection,
&coin->cpi.denom_sig),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_fixed_auto ("h_age_commitment",
- &coin->cpi.h_age_commitment)),
- &coin->cpi.no_age_commitment),
+ &coin->cpi.h_age_commitment),
+ &coin->cpi.no_age_commitment),
GNUNET_JSON_spec_fixed_auto ("coin_sig",
&coin->coin_sig),
GNUNET_JSON_spec_fixed_auto ("coin_pub",
@@ -432,10 +491,10 @@ parse_coin (struct MHD_Connection *connection,
if (GNUNET_OK !=
TALER_wallet_purse_deposit_verify (TEH_base_url,
- &pcc->purse_pub,
+ pcc->purse_pub,
&pcc->amount,
- &coin->coin_pub,
- &coin->csig))
+ &coin->cpi.coin_pub,
+ &coin->coin_sig))
{
TALER_LOG_WARNING ("Invalid signature on /purses/$PID/create request\n");
GNUNET_JSON_parse_free (spec);
@@ -451,13 +510,13 @@ parse_coin (struct MHD_Connection *connection,
struct TEH_DenominationKey *dk;
MHD_RESULT mret;
- dk = TEH_keys_denomination_by_hash (&coin->denom_pub_hash,
+ dk = TEH_keys_denomination_by_hash (&coin->cpi.denom_pub_hash,
connection,
&mret);
if (NULL == dk)
{
GNUNET_JSON_parse_free (spec);
- return (MHD_YES == mret) ? GNUNET_NO : GNUNET_SYSERR:
+ return (MHD_YES == mret) ? GNUNET_NO : GNUNET_SYSERR;
}
if (0 > TALER_amount_cmp (&dk->meta.value,
&coin->amount))
@@ -478,10 +537,10 @@ parse_coin (struct MHD_Connection *connection,
return (MHD_YES ==
TEH_RESPONSE_reply_expired_denom_pub_hash (
connection,
- &coin->denom_pub_hash,
+ &coin->cpi.denom_pub_hash,
TALER_EC_EXCHANGE_GENERIC_DENOMINATION_EXPIRED,
"PURSE CREATE"))
- ? GNUNET_NO : GNUNET_SYSERR:
+ ? GNUNET_NO : GNUNET_SYSERR;
}
if (GNUNET_TIME_absolute_is_future (dk->meta.start.abs_time))
{
@@ -490,7 +549,7 @@ parse_coin (struct MHD_Connection *connection,
return (MHD_YES ==
TEH_RESPONSE_reply_expired_denom_pub_hash (
connection,
- &coin->denom_pub_hash,
+ &coin->cpi.denom_pub_hash,
TALER_EC_EXCHANGE_GENERIC_DENOMINATION_VALIDITY_IN_FUTURE,
"PURSE CREATE"))
? GNUNET_NO : GNUNET_SYSERR;
@@ -502,12 +561,12 @@ parse_coin (struct MHD_Connection *connection,
return (MHD_YES ==
TEH_RESPONSE_reply_expired_denom_pub_hash (
connection,
- &deposit.coin.denom_pub_hash,
+ &coin->cpi.denom_pub_hash,
TALER_EC_EXCHANGE_GENERIC_DENOMINATION_REVOKED,
"PURSE CREATE"))
? GNUNET_NO : GNUNET_SYSERR;
}
- if (dk->denom_pub.cipher != deposit.coin.denom_sig.cipher)
+ if (dk->denom_pub.cipher != coin->cpi.denom_sig.cipher)
{
/* denomination cipher and denomination signature cipher not the same */
GNUNET_JSON_parse_free (spec);
@@ -531,9 +590,9 @@ parse_coin (struct MHD_Connection *connection,
NULL);
}
GNUNET_assert (0 <=
- TALER_amount_subtact (&coin->amount_minus_fee,
- &coin->amount,
- &coin->deposit_fee));
+ TALER_amount_subtract (&coin->amount_minus_fee,
+ &coin->amount,
+ &coin->deposit_fee));
/* check coin signature */
switch (dk->denom_pub.cipher)
{
@@ -547,7 +606,7 @@ parse_coin (struct MHD_Connection *connection,
break;
}
if (GNUNET_YES !=
- TALER_test_coin_valid (&deposit.coin,
+ TALER_test_coin_valid (&coin->cpi,
&dk->denom_pub))
{
TALER_LOG_WARNING ("Invalid coin passed for /deposit\n");
@@ -578,9 +637,9 @@ parse_coin (struct MHD_Connection *connection,
/* make sure coin is 'known' in database */
for (unsigned int tries = 0; tries<MAX_TRANSACTION_COMMIT_RETRIES; tries++)
{
- qs = TEH_make_coin_known (&deposit.coin,
+ qs = TEH_make_coin_known (&coin->cpi,
connection,
- &pcc.known_coin_id,
+ &coin->known_coin_id,
&mhd_ret);
/* no transaction => no serialization failures should be possible */
if (GNUNET_DB_STATUS_SOFT_ERROR != qs)
@@ -611,7 +670,7 @@ TEH_handler_purses_create (
{
struct PurseCreateContext pcc = {
.purse_pub = purse_pub,
- .exchange_timestamp = GNUNET_TIME_timestamp_get ();
+ .exchange_timestamp = GNUNET_TIME_timestamp_get ()
};
json_t *deposits;
json_t *deposit;
@@ -623,15 +682,18 @@ TEH_handler_purses_create (
GNUNET_JSON_spec_uint32 ("min_age",
&pcc.min_age),
GNUNET_JSON_spec_mark_optional (
- GNUNET_JSON_spec_var_size ("econtract",
- &pcc.econtract,
- &pcc.ecotract_size)),
+ GNUNET_JSON_spec_varsize ("econtract",
+ &pcc.econtract,
+ &pcc.econtract_size),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_fixed_auto ("econtract_sig",
- &pcc.econtract_sig)),
+ &pcc.econtract_sig),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_fixed_auto ("contract_pub",
- &pcc.contract_pub)),
+ &pcc.contract_pub),
+ NULL),
GNUNET_JSON_spec_fixed_auto ("merge_pub",
&pcc.merge_pub),
GNUNET_JSON_spec_fixed_auto ("purse_sig",
@@ -694,7 +756,7 @@ TEH_handler_purses_create (
GNUNET_JSON_parse_free (spec);
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_BAD_REQUEST,
- TALER_EC_EXCHANGE_GENERIC_PARAMETER_MALFORMED,
+ TALER_EC_GENERIC_PARAMETER_MALFORMED,
"deposits");
}
gf = TEH_keys_global_fee_by_time (TEH_keys_get_state (),
@@ -709,8 +771,8 @@ TEH_handler_purses_create (
NULL);
}
/* parse deposits */
- pcc.coins = GNUNET_new_array (struct Coin,
- pcc.num_coins);
+ pcc.coins = GNUNET_new_array (pcc.num_coins,
+ struct Coin);
json_array_foreach (deposits, idx, deposit)
{
enum GNUNET_GenericReturnValue res;
@@ -742,12 +804,12 @@ TEH_handler_purses_create (
TEH_METRICS_num_verifications[TEH_MT_SIGNATURE_EDDSA]++;
if (GNUNET_OK !=
- TALER_wallet_purse_create_verify (&pcc.purse_expiration,
+ TALER_wallet_purse_create_verify (pcc.purse_expiration,
&pcc.h_contract_terms,
&pcc.merge_pub,
pcc.min_age,
&pcc.amount,
- &pcc.purse_pub,
+ pcc.purse_pub,
&pcc.purse_sig))
{
TALER_LOG_WARNING ("Invalid signature on /purses/$PID/create request\n");
diff --git a/src/exchange/taler-exchange-httpd_purses_create.h b/src/exchange/taler-exchange-httpd_purses_create.h
new file mode 100644
index 00000000..4dfbabf9
--- /dev/null
+++ b/src/exchange/taler-exchange-httpd_purses_create.h
@@ -0,0 +1,47 @@
+/*
+ This file is part of TALER
+ Copyright (C) 2022 Taler Systems SA
+
+ TALER is free software; you can redistribute it and/or modify it under the
+ terms of the GNU Affero General Public License as published by the Free Software
+ Foundation; either version 3, or (at your option) any later version.
+
+ TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License along with
+ TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+*/
+/**
+ * @file taler-exchange-httpd_purses_create.h
+ * @brief Handle /purses/$PID/create requests
+ * @author Christian Grothoff
+ */
+#ifndef TALER_EXCHANGE_HTTPD_PURSES_CREATE_H
+#define TALER_EXCHANGE_HTTPD_PURSES_CREATE_H
+
+#include <gnunet/gnunet_util_lib.h>
+#include <microhttpd.h>
+#include "taler-exchange-httpd.h"
+
+
+/**
+ * Handle a "/purses/$PURSE_PUB/create" request. Parses the JSON, and, if
+ * successful, passes the JSON data to #create_transaction() to further check
+ * the details of the operation specified. If everything checks out, this
+ * will ultimately lead to the "purses create" being executed, or rejected.
+ *
+ * @param connection the MHD connection to handle
+ * @param purse_pub public key of the purse
+ * @param root uploaded JSON data
+ * @return MHD result code
+ */
+MHD_RESULT
+TEH_handler_purses_create (struct MHD_Connection *connection,
+ const struct
+ TALER_PurseContractPublicKeyP *purse_pub,
+ const json_t *root);
+
+
+#endif
diff --git a/src/exchange/taler-exchange-httpd_recoup-refresh.c b/src/exchange/taler-exchange-httpd_recoup-refresh.c
index dbeadfbd..a00eeba4 100644
--- a/src/exchange/taler-exchange-httpd_recoup-refresh.c
+++ b/src/exchange/taler-exchange-httpd_recoup-refresh.c
@@ -390,10 +390,12 @@ TEH_handler_recoup_refresh (struct MHD_Connection *connection,
&coin_sig),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_fixed_auto ("h_age_commitment",
- &coin.h_age_commitment)),
+ &coin.h_age_commitment),
+ &coin.no_age_commitment),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_fixed_auto ("cs_nonce",
- &nonce)),
+ &nonce),
+ NULL),
GNUNET_JSON_spec_end ()
};
diff --git a/src/exchange/taler-exchange-httpd_recoup.c b/src/exchange/taler-exchange-httpd_recoup.c
index 101e7bff..6bda8af9 100644
--- a/src/exchange/taler-exchange-httpd_recoup.c
+++ b/src/exchange/taler-exchange-httpd_recoup.c
@@ -403,10 +403,12 @@ TEH_handler_recoup (struct MHD_Connection *connection,
&coin_sig),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_fixed_auto ("h_age_commitment",
- &coin.h_age_commitment)),
+ &coin.h_age_commitment),
+ &coin.no_age_commitment),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_fixed_auto ("cs_nonce",
- &nonce)),
+ &nonce),
+ NULL),
GNUNET_JSON_spec_end ()
};
diff --git a/src/exchange/taler-exchange-httpd_refreshes_reveal.c b/src/exchange/taler-exchange-httpd_refreshes_reveal.c
index e1cf6ab2..8a5d8a80 100644
--- a/src/exchange/taler-exchange-httpd_refreshes_reveal.c
+++ b/src/exchange/taler-exchange-httpd_refreshes_reveal.c
@@ -132,9 +132,9 @@ struct RevealContext
unsigned int num_fresh_coins;
/**
- * True if @e rms was provided.
+ * True if @e rms was not provided.
*/
- bool have_rms;
+ bool no_rms;
};
@@ -337,9 +337,9 @@ check_commitment (struct RevealContext *rctx,
}
TALER_refresh_get_commitment (&rc_expected,
TALER_CNC_KAPPA,
- rctx->have_rms
- ? &rctx->rms
- : NULL,
+ rctx->no_rms
+ ? NULL
+ : &rctx->rms,
rctx->num_fresh_coins,
rcs,
&rctx->melt.session.coin.coin_pub,
@@ -484,7 +484,7 @@ resolve_refreshes_reveal_denominations (struct MHD_Connection *connection,
if (NULL == dks[i])
return ret;
if ( (TALER_DENOMINATION_CS == dks[i]->denom_pub.cipher) &&
- (! rctx->have_rms) )
+ (rctx->no_rms) )
{
return TALER_MHD_reply_with_error (
connection,
@@ -937,10 +937,12 @@ TEH_handler_reveal (struct TEH_RequestContext *rc,
&new_denoms_h),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_json ("old_age_commitment",
- &old_age_commitment)),
+ &old_age_commitment),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_fixed_auto ("rms",
- &rctx.rms)),
+ &rctx.rms),
+ &rctx.no_rms),
GNUNET_JSON_spec_end ()
};
@@ -981,8 +983,6 @@ TEH_handler_reveal (struct TEH_RequestContext *rc,
return (GNUNET_SYSERR == res) ? MHD_NO : MHD_YES;
}
}
- rctx.have_rms = (NULL != json_object_get (root,
- "rms"));
/* Check we got enough transfer private keys */
/* Note we do +1 as 1 row (cut-and-choose!) is missing! */