summaryrefslogtreecommitdiff
path: root/src/exchange
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-01-16 23:49:34 +0100
committerChristian Grothoff <christian@grothoff.org>2020-01-16 23:49:34 +0100
commitd61c2e400ac07574fc326c8d2be6f51be7c2a25c (patch)
tree277d9bf5ad2cd160a85d75992ae590e59dd28ac9 /src/exchange
parent0305cf5f9eb904e7a3ab3e8d39f4974a92a9a0b3 (diff)
downloadexchange-d61c2e400ac07574fc326c8d2be6f51be7c2a25c.tar.gz
exchange-d61c2e400ac07574fc326c8d2be6f51be7c2a25c.tar.bz2
exchange-d61c2e400ac07574fc326c8d2be6f51be7c2a25c.zip
kill another FIXME
Diffstat (limited to 'src/exchange')
-rw-r--r--src/exchange/taler-exchange-httpd_deposit.c2
-rw-r--r--src/exchange/taler-exchange-httpd_payback.c1
-rw-r--r--src/exchange/taler-exchange-httpd_refresh_melt.c3
-rw-r--r--src/exchange/taler-exchange-httpd_refund.c118
-rw-r--r--src/exchange/taler-exchange-httpd_responses.c53
-rw-r--r--src/exchange/taler-exchange-httpd_responses.h8
6 files changed, 120 insertions, 65 deletions
diff --git a/src/exchange/taler-exchange-httpd_deposit.c b/src/exchange/taler-exchange-httpd_deposit.c
index 11f579abc..38cc43074 100644
--- a/src/exchange/taler-exchange-httpd_deposit.c
+++ b/src/exchange/taler-exchange-httpd_deposit.c
@@ -214,6 +214,8 @@ deposit_transaction (void *cls,
"Deposited coin has insufficient funds left!\n");
*mhd_ret = TEH_RESPONSE_reply_coin_insufficient_funds (connection,
TALER_EC_DEPOSIT_INSUFFICIENT_FUNDS,
+ &deposit->coin.
+ coin_pub,
tl);
TEH_plugin->free_coin_transaction_list (TEH_plugin->cls,
tl);
diff --git a/src/exchange/taler-exchange-httpd_payback.c b/src/exchange/taler-exchange-httpd_payback.c
index a05045b24..bfd0f4133 100644
--- a/src/exchange/taler-exchange-httpd_payback.c
+++ b/src/exchange/taler-exchange-httpd_payback.c
@@ -346,6 +346,7 @@ payback_transaction (void *cls,
session);
*mhd_ret = TEH_RESPONSE_reply_coin_insufficient_funds (connection,
TALER_EC_PAYBACK_COIN_BALANCE_ZERO,
+ &pc->coin->coin_pub,
tl);
TEH_plugin->free_coin_transaction_list (TEH_plugin->cls,
tl);
diff --git a/src/exchange/taler-exchange-httpd_refresh_melt.c b/src/exchange/taler-exchange-httpd_refresh_melt.c
index 4f429012c..e0a4d8360 100644
--- a/src/exchange/taler-exchange-httpd_refresh_melt.c
+++ b/src/exchange/taler-exchange-httpd_refresh_melt.c
@@ -59,7 +59,8 @@ reply_refresh_melt_insufficient_funds (struct MHD_Connection *connection,
{
json_t *history;
- history = TEH_RESPONSE_compile_transaction_history (tl);
+ history = TEH_RESPONSE_compile_transaction_history (coin_pub,
+ tl);
if (NULL == history)
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_INTERNAL_SERVER_ERROR,
diff --git a/src/exchange/taler-exchange-httpd_refund.c b/src/exchange/taler-exchange-httpd_refund.c
index 6a96ff982..cb0a0f15f 100644
--- a/src/exchange/taler-exchange-httpd_refund.c
+++ b/src/exchange/taler-exchange-httpd_refund.c
@@ -40,12 +40,14 @@
* Generate successful refund confirmation message.
*
* @param connection connection to the client
+ * @param coin_pub public key of the coin
* @param refund details about the successful refund
* @return MHD result code
*/
static int
reply_refund_success (struct MHD_Connection *connection,
- const struct TALER_EXCHANGEDB_Refund *refund)
+ const struct TALER_CoinSpendPublicKeyP *coin_pub,
+ const struct TALER_EXCHANGEDB_RefundListEntry *refund)
{
struct TALER_RefundConfirmationPS rc;
struct TALER_ExchangePublicKeyP pub;
@@ -54,7 +56,7 @@ reply_refund_success (struct MHD_Connection *connection,
rc.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_REFUND);
rc.purpose.size = htonl (sizeof (struct TALER_RefundConfirmationPS));
rc.h_contract_terms = refund->h_contract_terms;
- rc.coin_pub = refund->coin.coin_pub;
+ rc.coin_pub = *coin_pub;
rc.merchant = refund->merchant_pub;
rc.rtransaction_id = GNUNET_htonll (refund->rtransaction_id);
TALER_amount_hton (&rc.refund_amount,
@@ -107,11 +109,13 @@ reply_refund_failure (struct MHD_Connection *connection,
* transaction list @a tl with the details about the conflict.
*
* @param connection connection to the client
+ * @param coin_pub public key this is about
* @param tl transaction list showing the conflict
* @return MHD result code
*/
static int
reply_refund_conflict (struct MHD_Connection *connection,
+ const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_EXCHANGEDB_TransactionList *tl)
{
return TALER_MHD_reply_json_pack (connection,
@@ -122,6 +126,7 @@ reply_refund_conflict (struct MHD_Connection *connection,
(json_int_t) TALER_EC_REFUND_CONFLICT,
"history",
TEH_RESPONSE_compile_transaction_history (
+ coin_pub,
tl));
}
@@ -152,8 +157,8 @@ refund_transaction (void *cls,
{
const struct TALER_EXCHANGEDB_Refund *refund = cls;
struct TALER_EXCHANGEDB_TransactionList *tl;
- const struct TALER_EXCHANGEDB_Deposit *dep;
- const struct TALER_EXCHANGEDB_Refund *ref;
+ const struct TALER_EXCHANGEDB_DepositListEntry *dep;
+ const struct TALER_EXCHANGEDB_RefundListEntry *ref;
struct TEH_KS_StateHandle *mks;
struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *dki;
struct TALER_Amount expect_fee;
@@ -163,6 +168,7 @@ refund_transaction (void *cls,
int fee_cmp;
unsigned int hc;
enum TALER_ErrorCode ec;
+ struct TALER_CoinPublicInfo coin_info;
dep = NULL;
ref = NULL;
@@ -192,10 +198,10 @@ refund_transaction (void *cls,
if (GNUNET_NO == deposit_found)
{
if ( (0 == memcmp (&tlp->details.deposit->merchant_pub,
- &refund->merchant_pub,
+ &refund->details.merchant_pub,
sizeof (struct TALER_MerchantPublicKeyP))) &&
(0 == memcmp (&tlp->details.deposit->h_contract_terms,
- &refund->h_contract_terms,
+ &refund->details.h_contract_terms,
sizeof (struct GNUNET_HashCode))) )
{
dep = tlp->details.deposit;
@@ -212,12 +218,13 @@ refund_transaction (void *cls,
{
/* First, check if existing refund request is identical */
if ( (0 == memcmp (&tlp->details.refund->merchant_pub,
- &refund->merchant_pub,
+ &refund->details.merchant_pub,
sizeof (struct TALER_MerchantPublicKeyP))) &&
(0 == memcmp (&tlp->details.refund->h_contract_terms,
- &refund->h_contract_terms,
+ &refund->details.h_contract_terms,
sizeof (struct GNUNET_HashCode))) &&
- (tlp->details.refund->rtransaction_id == refund->rtransaction_id) )
+ (tlp->details.refund->rtransaction_id ==
+ refund->details.rtransaction_id) )
{
ref = tlp->details.refund;
refund_found = GNUNET_YES;
@@ -225,12 +232,13 @@ refund_transaction (void *cls,
}
/* Second, check if existing refund request conflicts */
if ( (0 == memcmp (&tlp->details.refund->merchant_pub,
- &refund->merchant_pub,
+ &refund->details.merchant_pub,
sizeof (struct TALER_MerchantPublicKeyP))) &&
(0 == memcmp (&tlp->details.refund->h_contract_terms,
- &refund->h_contract_terms,
+ &refund->details.h_contract_terms,
sizeof (struct GNUNET_HashCode))) &&
- (tlp->details.refund->rtransaction_id != refund->rtransaction_id) )
+ (tlp->details.refund->rtransaction_id !=
+ refund->details.rtransaction_id) )
{
GNUNET_break_op (0); /* conflicting refund found */
refund_found = GNUNET_SYSERR;
@@ -269,6 +277,7 @@ refund_transaction (void *cls,
if (GNUNET_SYSERR == refund_found)
{
*mhd_ret = reply_refund_conflict (connection,
+ &refund->coin.coin_pub,
tl);
TEH_plugin->free_coin_transaction_list (TEH_plugin->cls,
tl);
@@ -279,6 +288,7 @@ refund_transaction (void *cls,
{
/* /refund already done, simply re-transmit confirmation */
*mhd_ret = reply_refund_success (connection,
+ &refund->coin.coin_pub,
ref);
TEH_plugin->free_coin_transaction_list (TEH_plugin->cls,
tl);
@@ -287,10 +297,10 @@ refund_transaction (void *cls,
/* check currency is compatible */
if ( (GNUNET_YES !=
- TALER_amount_cmp_currency (&refund->refund_amount,
+ TALER_amount_cmp_currency (&refund->details.refund_amount,
&dep->amount_with_fee)) ||
(GNUNET_YES !=
- TALER_amount_cmp_currency (&refund->refund_fee,
+ TALER_amount_cmp_currency (&refund->details.refund_fee,
&dep->deposit_fee)) )
{
GNUNET_break_op (0); /* currency missmatch */
@@ -303,7 +313,10 @@ refund_transaction (void *cls,
/* check if we already send the money for the /deposit */
qs = TEH_plugin->test_deposit_done (TEH_plugin->cls,
session,
- dep);
+ &refund->coin.coin_pub,
+ &dep->merchant_pub,
+ &dep->h_contract_terms,
+ &dep->h_wire);
if (GNUNET_DB_STATUS_HARD_ERROR == qs)
{
/* Internal error, we first had the deposit in the history,
@@ -332,7 +345,7 @@ refund_transaction (void *cls,
}
/* check refund amount is sufficiently low */
- if (1 == TALER_amount_cmp (&refund->refund_amount,
+ if (1 == TALER_amount_cmp (&refund->details.refund_amount,
&dep->amount_with_fee) )
{
GNUNET_break_op (0); /* cannot refund more than original value */
@@ -343,7 +356,25 @@ refund_transaction (void *cls,
TALER_EC_REFUND_INSUFFICIENT_FUNDS);
return GNUNET_DB_STATUS_HARD_ERROR;
}
-
+ qs = TEH_plugin->get_known_coin (TEH_plugin->cls,
+ session,
+ &refund->coin.coin_pub,
+ &coin_info);
+ if (0 > qs)
+ {
+ TEH_plugin->free_coin_transaction_list (TEH_plugin->cls,
+ tl);
+ if (GNUNET_DB_STATUS_HARD_ERROR == qs)
+ {
+ GNUNET_break (0); /* should be impossible by foreign key constraint! */
+ *mhd_ret = reply_refund_failure (connection,
+ MHD_HTTP_NOT_FOUND,
+ TALER_EC_REFUND_COIN_NOT_FOUND);
+ }
+ return qs;
+ }
+ GNUNET_CRYPTO_rsa_signature_free (coin_info.denom_sig.rsa_signature);
+ coin_info.denom_sig.rsa_signature = NULL; /* just to be safe */
// FIXME: do this outside of transaction function?
/* Check refund fee matches fee of denomination key! */
mks = TEH_KS_acquire (GNUNET_TIME_absolute_get ());
@@ -359,7 +390,7 @@ refund_transaction (void *cls,
return GNUNET_DB_STATUS_HARD_ERROR;
}
dki = TEH_KS_denomination_key_lookup_by_hash (mks,
- &dep->coin.denom_pub_hash,
+ &coin_info.denom_pub_hash,
TEH_KS_DKU_DEPOSIT,
&ec,
&hc);
@@ -379,7 +410,7 @@ refund_transaction (void *cls,
}
TALER_amount_ntoh (&expect_fee,
&dki->issue.properties.fee_refund);
- fee_cmp = TALER_amount_cmp (&refund->refund_fee,
+ fee_cmp = TALER_amount_cmp (&refund->details.refund_fee,
&expect_fee);
TEH_KS_release (mks);
@@ -436,19 +467,9 @@ verify_and_execute_refund (struct MHD_Connection *connection,
struct TALER_RefundRequestPS rr;
int mhd_ret;
- rr.purpose.purpose = htonl (TALER_SIGNATURE_MERCHANT_REFUND);
- rr.purpose.size = htonl (sizeof (struct TALER_RefundRequestPS));
- rr.h_contract_terms = refund->h_contract_terms;
- rr.coin_pub = refund->coin.coin_pub;
- rr.merchant = refund->merchant_pub;
- rr.rtransaction_id = GNUNET_htonll (refund->rtransaction_id);
- TALER_amount_hton (&rr.refund_amount,
- &refund->refund_amount);
- TALER_amount_hton (&rr.refund_fee,
- &refund->refund_fee);
if (GNUNET_YES !=
- TALER_amount_cmp_currency (&refund->refund_amount,
- &refund->refund_fee) )
+ TALER_amount_cmp_currency (&refund->details.refund_amount,
+ &refund->details.refund_fee) )
{
GNUNET_break_op (0);
return TALER_MHD_reply_with_error (connection,
@@ -456,8 +477,8 @@ verify_and_execute_refund (struct MHD_Connection *connection,
TALER_EC_REFUND_FEE_CURRENCY_MISSMATCH,
"refund_fee");
}
- if (-1 == TALER_amount_cmp (&refund->refund_amount,
- &refund->refund_fee) )
+ if (-1 == TALER_amount_cmp (&refund->details.refund_amount,
+ &refund->details.refund_fee) )
{
GNUNET_break_op (0);
return TALER_MHD_reply_with_error (connection,
@@ -465,11 +486,21 @@ verify_and_execute_refund (struct MHD_Connection *connection,
TALER_EC_REFUND_FEE_ABOVE_AMOUNT,
"refund_amount");
}
+ rr.purpose.purpose = htonl (TALER_SIGNATURE_MERCHANT_REFUND);
+ rr.purpose.size = htonl (sizeof (struct TALER_RefundRequestPS));
+ rr.h_contract_terms = refund->details.h_contract_terms;
+ rr.coin_pub = refund->coin.coin_pub;
+ rr.merchant = refund->details.merchant_pub;
+ rr.rtransaction_id = GNUNET_htonll (refund->details.rtransaction_id);
+ TALER_amount_hton (&rr.refund_amount,
+ &refund->details.refund_amount);
+ TALER_amount_hton (&rr.refund_fee,
+ &refund->details.refund_fee);
if (GNUNET_OK !=
GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MERCHANT_REFUND,
&rr.purpose,
- &refund->merchant_sig.eddsa_sig,
- &refund->merchant_pub.eddsa_pub))
+ &refund->details.merchant_sig.eddsa_sig,
+ &refund->details.merchant_pub.eddsa_pub))
{
TALER_LOG_WARNING ("Invalid signature on /refund request\n");
return TALER_MHD_reply_with_error (connection,
@@ -485,7 +516,8 @@ verify_and_execute_refund (struct MHD_Connection *connection,
(void *) refund))
return mhd_ret;
return reply_refund_success (connection,
- refund);
+ &refund->coin.coin_pub,
+ &refund->details);
}
@@ -514,13 +546,15 @@ TEH_REFUND_handler_refund (struct TEH_RequestHandler *rh,
int res;
struct TALER_EXCHANGEDB_Refund refund;
struct GNUNET_JSON_Specification spec[] = {
- TALER_JSON_spec_amount ("refund_amount", &refund.refund_amount),
- TALER_JSON_spec_amount ("refund_fee", &refund.refund_fee),
- GNUNET_JSON_spec_fixed_auto ("h_contract_terms", &refund.h_contract_terms),
+ TALER_JSON_spec_amount ("refund_amount", &refund.details.refund_amount),
+ TALER_JSON_spec_amount ("refund_fee", &refund.details.refund_fee),
+ GNUNET_JSON_spec_fixed_auto ("h_contract_terms",
+ &refund.details.h_contract_terms),
GNUNET_JSON_spec_fixed_auto ("coin_pub", &refund.coin.coin_pub),
- GNUNET_JSON_spec_fixed_auto ("merchant_pub", &refund.merchant_pub),
- GNUNET_JSON_spec_uint64 ("rtransaction_id", &refund.rtransaction_id),
- GNUNET_JSON_spec_fixed_auto ("merchant_sig", &refund.merchant_sig),
+ GNUNET_JSON_spec_fixed_auto ("merchant_pub", &refund.details.merchant_pub),
+ GNUNET_JSON_spec_uint64 ("rtransaction_id",
+ &refund.details.rtransaction_id),
+ GNUNET_JSON_spec_fixed_auto ("merchant_sig", &refund.details.merchant_sig),
GNUNET_JSON_spec_end ()
};
diff --git a/src/exchange/taler-exchange-httpd_responses.c b/src/exchange/taler-exchange-httpd_responses.c
index 4ef0f2d15..d6e5c32aa 100644
--- a/src/exchange/taler-exchange-httpd_responses.c
+++ b/src/exchange/taler-exchange-httpd_responses.c
@@ -42,11 +42,14 @@
/**
* Compile the transaction history of a coin into a JSON object.
*
+ * @param coin_pub public key of the coin
* @param tl transaction history to JSON-ify
* @return json representation of the @a rh, NULL on error
*/
json_t *
TEH_RESPONSE_compile_transaction_history (const struct
+ TALER_CoinSpendPublicKeyP *coin_pub,
+ const struct
TALER_EXCHANGEDB_TransactionList *tl)
{
json_t *history;
@@ -66,7 +69,8 @@ TEH_RESPONSE_compile_transaction_history (const struct
case TALER_EXCHANGEDB_TT_DEPOSIT:
{
struct TALER_DepositRequestPS dr;
- const struct TALER_EXCHANGEDB_Deposit *deposit = pos->details.deposit;
+ const struct TALER_EXCHANGEDB_DepositListEntry *deposit =
+ pos->details.deposit;
dr.purpose.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_DEPOSIT);
dr.purpose.size = htonl (sizeof (struct TALER_DepositRequestPS));
@@ -80,14 +84,14 @@ TEH_RESPONSE_compile_transaction_history (const struct
TALER_amount_hton (&dr.deposit_fee,
&deposit->deposit_fee);
dr.merchant = deposit->merchant_pub;
- dr.coin_pub = deposit->coin.coin_pub;
+ dr.coin_pub = *coin_pub;
#if SANITY_CHECKS_ON
/* internal sanity check before we hand out a bogus sig... */
if (GNUNET_OK !=
GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_WALLET_COIN_DEPOSIT,
&dr.purpose,
&deposit->csig.eddsa_signature,
- &deposit->coin.coin_pub.eddsa_pub))
+ &coin_pub->eddsa_pub))
{
GNUNET_break (0);
json_decref (history);
@@ -132,24 +136,25 @@ TEH_RESPONSE_compile_transaction_history (const struct
case TALER_EXCHANGEDB_TT_REFRESH_MELT:
{
struct TALER_RefreshMeltCoinAffirmationPS ms;
- const struct TALER_EXCHANGEDB_RefreshMelt *melt = pos->details.melt;
+ const struct TALER_EXCHANGEDB_RefreshMeltListEntry *melt =
+ pos->details.melt;
ms.purpose.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_MELT);
ms.purpose.size = htonl (sizeof (struct
TALER_RefreshMeltCoinAffirmationPS));
- ms.rc = melt->session.rc;
+ ms.rc = melt->rc;
TALER_amount_hton (&ms.amount_with_fee,
- &melt->session.amount_with_fee);
+ &melt->amount_with_fee);
TALER_amount_hton (&ms.melt_fee,
&melt->melt_fee);
- ms.coin_pub = melt->session.coin.coin_pub;
+ ms.coin_pub = *coin_pub;
#if SANITY_CHECKS_ON
/* internal sanity check before we hand out a bogus sig... */
if (GNUNET_OK !=
GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_WALLET_COIN_MELT,
&ms.purpose,
- &melt->session.coin_sig.eddsa_signature,
- &melt->session.coin.coin_pub.eddsa_pub))
+ &melt->coin_sig.eddsa_signature,
+ &coin_pub->eddsa_pub))
{
GNUNET_break (0);
json_decref (history);
@@ -161,15 +166,15 @@ TEH_RESPONSE_compile_transaction_history (const struct
json_pack ("{s:s, s:o, s:o, s:o, s:o}",
"type", "MELT",
"amount", TALER_JSON_from_amount (
- &melt->session.amount_with_fee),
+ &melt->amount_with_fee),
"melt_fee",
TALER_JSON_from_amount (
&melt->melt_fee),
"rc", GNUNET_JSON_from_data_auto (
- &melt->session.rc),
+ &melt->rc),
"coin_sig",
GNUNET_JSON_from_data_auto (
- &melt->session.coin_sig))))
+ &melt->coin_sig))))
{
GNUNET_break (0);
json_decref (history);
@@ -180,7 +185,8 @@ TEH_RESPONSE_compile_transaction_history (const struct
case TALER_EXCHANGEDB_TT_REFUND:
{
struct TALER_RefundRequestPS rr;
- const struct TALER_EXCHANGEDB_Refund *refund = pos->details.refund;
+ const struct TALER_EXCHANGEDB_RefundListEntry *refund =
+ pos->details.refund;
struct TALER_Amount value;
if (GNUNET_OK !=
@@ -195,7 +201,7 @@ TEH_RESPONSE_compile_transaction_history (const struct
rr.purpose.purpose = htonl (TALER_SIGNATURE_MERCHANT_REFUND);
rr.purpose.size = htonl (sizeof (struct TALER_RefundRequestPS));
rr.h_contract_terms = refund->h_contract_terms;
- rr.coin_pub = refund->coin.coin_pub;
+ rr.coin_pub = *coin_pub;
rr.merchant = refund->merchant_pub;
rr.rtransaction_id = GNUNET_htonll (refund->rtransaction_id);
TALER_amount_hton (&rr.refund_amount,
@@ -245,7 +251,7 @@ TEH_RESPONSE_compile_transaction_history (const struct
break;
case TALER_EXCHANGEDB_TT_OLD_COIN_PAYBACK:
{
- struct TALER_EXCHANGEDB_PaybackRefresh *pr =
+ struct TALER_EXCHANGEDB_PaybackRefreshListEntry *pr =
pos->details.old_coin_payback;
struct TALER_PaybackRefreshConfirmationPS pc;
struct TALER_ExchangePublicKeyP epub;
@@ -257,7 +263,7 @@ TEH_RESPONSE_compile_transaction_history (const struct
pc.timestamp = GNUNET_TIME_absolute_hton (pr->timestamp);
TALER_amount_hton (&pc.payback_amount,
&pr->value);
- pc.coin_pub = pr->coin.coin_pub;
+ pc.coin_pub = *coin_pub;
pc.old_coin_pub = pr->old_coin_pub;
if (GNUNET_OK !=
TEH_KS_sign (&pc.purpose,
@@ -299,7 +305,8 @@ TEH_RESPONSE_compile_transaction_history (const struct
}
case TALER_EXCHANGEDB_TT_PAYBACK:
{
- const struct TALER_EXCHANGEDB_Payback *payback = pos->details.payback;
+ const struct TALER_EXCHANGEDB_PaybackListEntry *payback =
+ pos->details.payback;
struct TALER_PaybackConfirmationPS pc;
struct TALER_ExchangePublicKeyP epub;
struct TALER_ExchangeSignatureP esig;
@@ -309,7 +316,7 @@ TEH_RESPONSE_compile_transaction_history (const struct
pc.timestamp = GNUNET_TIME_absolute_hton (payback->timestamp);
TALER_amount_hton (&pc.payback_amount,
&payback->value);
- pc.coin_pub = payback->coin.coin_pub;
+ pc.coin_pub = *coin_pub;
pc.reserve_pub = payback->reserve_pub;
if (GNUNET_OK !=
TEH_KS_sign (&pc.purpose,
@@ -347,7 +354,7 @@ TEH_RESPONSE_compile_transaction_history (const struct
break;
case TALER_EXCHANGEDB_TT_PAYBACK_REFRESH:
{
- struct TALER_EXCHANGEDB_PaybackRefresh *pr =
+ struct TALER_EXCHANGEDB_PaybackRefreshListEntry *pr =
pos->details.payback_refresh;
struct TALER_PaybackRefreshConfirmationPS pc;
struct TALER_ExchangePublicKeyP epub;
@@ -359,7 +366,7 @@ TEH_RESPONSE_compile_transaction_history (const struct
pc.timestamp = GNUNET_TIME_absolute_hton (pr->timestamp);
TALER_amount_hton (&pc.payback_amount,
&pr->value);
- pc.coin_pub = pr->coin.coin_pub;
+ pc.coin_pub = *coin_pub;
pc.old_coin_pub = pr->old_coin_pub;
if (GNUNET_OK !=
TEH_KS_sign (&pc.purpose,
@@ -415,6 +422,7 @@ TEH_RESPONSE_compile_transaction_history (const struct
*
* @param connection connection to the client
* @param ec error code to return
+ * @param coin_pub public key of the coin
* @param tl transaction list to use to build reply
* @return MHD result code
*/
@@ -422,11 +430,14 @@ int
TEH_RESPONSE_reply_coin_insufficient_funds (struct MHD_Connection *connection,
enum TALER_ErrorCode ec,
const struct
+ TALER_CoinSpendPublicKeyP *coin_pub,
+ const struct
TALER_EXCHANGEDB_TransactionList *tl)
{
json_t *history;
- history = TEH_RESPONSE_compile_transaction_history (tl);
+ history = TEH_RESPONSE_compile_transaction_history (coin_pub,
+ tl);
if (NULL == history)
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_INTERNAL_SERVER_ERROR,
diff --git a/src/exchange/taler-exchange-httpd_responses.h b/src/exchange/taler-exchange-httpd_responses.h
index ec0515829..782e17dd9 100644
--- a/src/exchange/taler-exchange-httpd_responses.h
+++ b/src/exchange/taler-exchange-httpd_responses.h
@@ -55,6 +55,7 @@ TEH_RESPONSE_compile_reserve_history (const struct
*
* @param connection connection to the client
* @param ec error code to return
+ * @param coin_pub public key of the coin
* @param tl transaction list to use to build reply
* @return MHD result code
*/
@@ -62,17 +63,22 @@ int
TEH_RESPONSE_reply_coin_insufficient_funds (struct MHD_Connection *connection,
enum TALER_ErrorCode ec,
const struct
+ TALER_CoinSpendPublicKeyP *coin_pub,
+ const struct
TALER_EXCHANGEDB_TransactionList *tl);
/**
* Compile the transaction history of a coin into a JSON object.
*
+ * @param coin_pub public key of the coin
* @param tl transaction history to JSON-ify
- * @return json representation of the @a rh
+ * @return json representation of the @a rh, NULL on error
*/
json_t *
TEH_RESPONSE_compile_transaction_history (const struct
+ TALER_CoinSpendPublicKeyP *coin_pub,
+ const struct
TALER_EXCHANGEDB_TransactionList *tl);