[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-merchant] branch master updated: -fix FTBFS
From: |
gnunet |
Subject: |
[taler-merchant] branch master updated: -fix FTBFS |
Date: |
Thu, 17 Feb 2022 19:03:19 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository merchant.
The following commit(s) were added to refs/heads/master by this push:
new 9a737781 -fix FTBFS
9a737781 is described below
commit 9a7377810c764897a98a350dfadb9035fe7af62b
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Thu Feb 17 19:03:17 2022 +0100
-fix FTBFS
---
src/lib/merchant_api_tip_pickup.c | 174 ++++++++++++--------------------
src/testing/testing_api_cmd_pay_order.c | 2 +-
2 files changed, 67 insertions(+), 109 deletions(-)
diff --git a/src/lib/merchant_api_tip_pickup.c
b/src/lib/merchant_api_tip_pickup.c
index d7609577..6d37d922 100644
--- a/src/lib/merchant_api_tip_pickup.c
+++ b/src/lib/merchant_api_tip_pickup.c
@@ -52,6 +52,26 @@ struct PlanchetData
*/
struct TALER_CoinPubHash c_hash;
+ /**
+ * Nonce used for @e csr request, if any.
+ */
+ struct TALER_CsNonce nonce;
+
+ /**
+ * Handle for a /csr request we may optionally need
+ * to trigger.
+ */
+ struct TALER_EXCHANGE_CsRWithdrawHandle *csr;
+
+ /**
+ * Handle for the /tip-pickup operation we are part of.
+ */
+ struct TALER_MERCHANT_TipPickupHandle *tp;
+
+ /**
+ * Offset of this entry in the array.
+ */
+ unsigned int off;
};
@@ -86,12 +106,6 @@ struct TALER_MERCHANT_TipPickupHandle
*/
struct TALER_EXCHANGE_PrivateCoinDetails *pcds;
- /**
- * Handle for a /csr request we may optionally need
- * to trigger.
- */
- struct TALER_EXCHANGE_CsRHandle *csr;
-
/**
* Context for making HTTP requests.
*/
@@ -102,12 +116,6 @@ struct TALER_MERCHANT_TipPickupHandle
*/
char *backend_url;
- /**
- * Array of denomination keys and nonces, or NULL.
- * Length is @e nks_len.
- */
- struct TALER_EXCHANGE_NonceKey *nks;
-
/**
* ID of the tip we are picking up.
*/
@@ -119,9 +127,9 @@ struct TALER_MERCHANT_TipPickupHandle
unsigned int num_planchets;
/**
- * Length of the @e nks array.
+ * Number of remaining active /csr-withdraw requests.
*/
- unsigned int nks_len;
+ unsigned int csr_active;
};
@@ -229,7 +237,6 @@ static void
pickup_post_csr (struct TALER_MERCHANT_TipPickupHandle *tp)
{
struct TALER_PlanchetDetail details[tp->num_planchets];
- unsigned int noff = 0;
for (unsigned int i = 0; i<tp->num_planchets; i++)
{
@@ -244,10 +251,8 @@ pickup_post_csr (struct TALER_MERCHANT_TipPickupHandle *tp)
&pcd->bks);
if (TALER_DENOMINATION_CS == pcd->exchange_vals.cipher)
{
- GNUNET_assert (noff < tp->nks_len);
details[i].blinded_planchet.details.cs_blinded_planchet.nonce
- = tp->nks[noff].nonce;
- noff++;
+ = pd->nonce;
}
if (GNUNET_OK !=
TALER_planchet_prepare (&pd->pk.key,
@@ -294,54 +299,29 @@ pickup_post_csr (struct TALER_MERCHANT_TipPickupHandle
*tp)
*/
static void
csr_cb (void *cls,
- const struct TALER_EXCHANGE_CsRResponse *csrr)
+ const struct TALER_EXCHANGE_CsRWithdrawResponse *csrr)
{
- struct TALER_MERCHANT_TipPickupHandle *tp = cls;
+ struct PlanchetData *pd = cls;
+ struct TALER_MERCHANT_TipPickupHandle *tp = pd->tp;
- tp->csr = NULL;
+ pd->csr = NULL;
+ tp->csr_active--;
switch (csrr->hr.http_status)
{
case MHD_HTTP_OK:
{
- unsigned int off = 0;
+ struct TALER_EXCHANGE_PrivateCoinDetails *pcd = &tp->pcds[pd->off];
- for (unsigned int i = 0; i<tp->num_planchets; i++)
- {
- const struct PlanchetData *pd = &tp->planchets[i];
- struct TALER_EXCHANGE_PrivateCoinDetails *pcd = &tp->pcds[i];
-
- switch (pd->pk.key.cipher)
- {
- case TALER_DENOMINATION_INVALID:
- GNUNET_assert (0);
- break;
- case TALER_DENOMINATION_RSA:
- continue;
- case TALER_DENOMINATION_CS:
- if (off >= csrr->details.success.alg_values_len)
- {
- struct TALER_MERCHANT_PickupDetails pd = {
- .hr.http_status = 0
- };
-
- GNUNET_break (0);
- tp->cb (tp->cb_cls,
- &pd);
- TALER_MERCHANT_tip_pickup_cancel (tp);
- return;
- }
- pcd->exchange_vals = csrr->details.success.alg_values[off];
- off++;
- break;
- }
- }
+ pcd->exchange_vals = csrr->details.success.alg_values;
}
+ if (0 != tp->csr_active)
+ return;
pickup_post_csr (tp);
return;
default:
{
struct TALER_MERCHANT_PickupDetails pd = {
- .hr.hint = "/csr failed",
+ .hr.hint = "/csr-withdraw failed",
.hr.exchange_http_status = csrr->hr.http_status
};
@@ -365,7 +345,6 @@ TALER_MERCHANT_tip_pickup (struct GNUNET_CURL_Context *ctx,
void *pickup_cb_cls)
{
struct TALER_MERCHANT_TipPickupHandle *tp;
- unsigned int num_csr;
if (0 == num_planchets)
{
@@ -378,19 +357,21 @@ TALER_MERCHANT_tip_pickup (struct GNUNET_CURL_Context
*ctx,
tp->ctx = ctx;
tp->backend_url = GNUNET_strdup (backend_url);
tp->tip_id = *tip_id;
- GNUNET_array_grow (tp->planchets,
- tp->num_planchets,
- num_planchets);
+ tp->num_planchets = num_planchets;
+ tp->planchets = GNUNET_new_array (num_planchets,
+ struct PlanchetData);
tp->pcds = GNUNET_new_array (num_planchets,
struct TALER_EXCHANGE_PrivateCoinDetails);
- num_csr = 0;
for (unsigned int i = 0; i<num_planchets; i++)
{
- const struct TALER_MERCHANT_PlanchetData *pd = &pds[i];
- const struct TALER_EXCHANGE_DenomPublicKey *pk = pd->pk;
+ const struct TALER_MERCHANT_PlanchetData *mpd = &pds[i];
+ const struct TALER_EXCHANGE_DenomPublicKey *pk = mpd->pk;
struct TALER_EXCHANGE_PrivateCoinDetails *pcd = &tp->pcds[i];
+ struct PlanchetData *pd = &tp->planchets[i];
- tp->planchets[i].ps = pd->ps;
+ pd->off = i;
+ pd->tp = tp;
+ tp->planchets[i].ps = mpd->ps;
tp->planchets[i].pk = *pds[i].pk;
TALER_denom_pub_deep_copy (&tp->planchets[i].pk.key,
&pds[i].pk->key);
@@ -400,57 +381,34 @@ TALER_MERCHANT_tip_pickup (struct GNUNET_CURL_Context
*ctx,
pcd->exchange_vals.cipher = TALER_DENOMINATION_RSA;
break;
case TALER_DENOMINATION_CS:
- num_csr++;
- break;
+ {
+ TALER_cs_withdraw_nonce_derive (&pd->ps,
+ &pd->nonce);
+ pd->csr = TALER_EXCHANGE_csr_withdraw (exchange,
+ &pd->pk,
+ &pd->nonce,
+ &csr_cb,
+ pd);
+ if (NULL == pd->csr)
+ {
+ GNUNET_break (0);
+ TALER_MERCHANT_tip_pickup_cancel (tp);
+ return NULL;
+ }
+ tp->csr_active++;
+ break;
+ }
default:
GNUNET_break (0);
TALER_MERCHANT_tip_pickup_cancel (tp);
return NULL;
}
}
- if (0 == num_csr)
+ if (0 == tp->csr_active)
{
pickup_post_csr (tp);
return tp;
}
- tp->nks_len = num_csr;
- tp->nks = GNUNET_new_array (num_csr,
- struct TALER_EXCHANGE_NonceKey);
- {
- unsigned int off = 0;
-
- for (unsigned int i = 0; i<tp->num_planchets; i++)
- {
- const struct PlanchetData *pd = &tp->planchets[i];
- struct TALER_EXCHANGE_NonceKey *nk = &tp->nks[i];
-
- switch (pd->pk.key.cipher)
- {
- case TALER_DENOMINATION_INVALID:
- GNUNET_assert (0);
- break;
- case TALER_DENOMINATION_RSA:
- break;
- case TALER_DENOMINATION_CS:
- nk->pk = &pd->pk;
- TALER_cs_withdraw_nonce_derive (&pd->ps,
- &nk->nonce);
- off++;
- break;
- }
- }
- tp->csr = TALER_EXCHANGE_csr (exchange,
- off,
- tp->nks,
- &csr_cb,
- tp);
- if (NULL == tp->csr)
- {
- GNUNET_break (0);
- TALER_MERCHANT_tip_pickup_cancel (tp);
- return NULL;
- }
- }
return tp;
}
@@ -461,9 +419,15 @@ TALER_MERCHANT_tip_pickup_cancel (struct
TALER_MERCHANT_TipPickupHandle *tp)
for (unsigned int i = 0; i<tp->num_planchets; i++)
{
struct TALER_EXCHANGE_PrivateCoinDetails *pcd = &tp->pcds[i];
+ struct PlanchetData *pd = &tp->planchets[i];
TALER_denom_sig_free (&pcd->sig);
TALER_denom_pub_free (&tp->planchets[i].pk.key);
+ if (NULL != pd->csr)
+ {
+ TALER_EXCHANGE_csr_withdraw_cancel (pd->csr);
+ pd->csr = NULL;
+ }
}
GNUNET_array_grow (tp->planchets,
tp->num_planchets,
@@ -473,13 +437,7 @@ TALER_MERCHANT_tip_pickup_cancel (struct
TALER_MERCHANT_TipPickupHandle *tp)
TALER_MERCHANT_tip_pickup2_cancel (tp->tpo2);
tp->tpo2 = NULL;
}
- if (NULL != tp->csr)
- {
- TALER_EXCHANGE_csr_cancel (tp->csr);
- tp->csr = NULL;
- }
GNUNET_free (tp->backend_url);
- GNUNET_free (tp->nks);
GNUNET_free (tp->pcds);
GNUNET_free (tp);
}
diff --git a/src/testing/testing_api_cmd_pay_order.c
b/src/testing/testing_api_cmd_pay_order.c
index 5609cf07..956a54ef 100644
--- a/src/testing/testing_api_cmd_pay_order.c
+++ b/src/testing/testing_api_cmd_pay_order.c
@@ -195,7 +195,7 @@ build_coins (struct TALER_MERCHANT_PayCoin **pc,
GNUNET_assert (0 <=
TALER_amount_subtract (&icoin->amount_without_fee,
&icoin->denom_value,
- &dpk->fee_deposit));
+ &dpk->fees.deposit));
GNUNET_assert (GNUNET_OK ==
TALER_TESTING_get_trait_exchange_url (coin_cmd,
&exchange_url));
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.