aboutsummaryrefslogtreecommitdiff
path: root/src/lib/exchange_api_withdraw.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2022-02-09 16:43:36 +0100
committerChristian Grothoff <christian@grothoff.org>2022-02-09 16:43:36 +0100
commit1777db292e6e0d653e5e1e103317f2cc5ac241b6 (patch)
tree8be88489e754a53de87c55c0824bc749befa8132 /src/lib/exchange_api_withdraw.c
parentd05c561e4f95a845e3c8793a752369365f307d5f (diff)
downloadexchange-1777db292e6e0d653e5e1e103317f2cc5ac241b6.tar.xz
-fix withdraw logic
Diffstat (limited to 'src/lib/exchange_api_withdraw.c')
-rw-r--r--src/lib/exchange_api_withdraw.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/lib/exchange_api_withdraw.c b/src/lib/exchange_api_withdraw.c
index 774f8c1ad..d89beff0f 100644
--- a/src/lib/exchange_api_withdraw.c
+++ b/src/lib/exchange_api_withdraw.c
@@ -214,6 +214,8 @@ withdraw_cs_stage_two_callback (void *cls,
TALER_planchet_blinding_secret_create (&wh->ps,
&wh->alg_values,
&wh->bks);
+ /* This initializes the 2nd half of the
+ wh->pd.blinded_planchet! */
if (GNUNET_OK !=
TALER_planchet_prepare (&wh->pk.key,
&wh->alg_values,
@@ -297,9 +299,13 @@ TALER_EXCHANGE_withdraw (
.pk = pk,
};
- wh->pd.blinded_planchet.cipher = TALER_DENOMINATION_CS;
TALER_cs_withdraw_nonce_derive (ps,
&nk.nonce);
+ /* Note that we only initialize the first half
+ of the blinded_planchet here; the other part
+ will be done after the /csr request! */
+ wh->pd.blinded_planchet.cipher = TALER_DENOMINATION_CS;
+ wh->pd.blinded_planchet.details.cs_blinded_planchet.nonce = nk.nonce;
wh->csrh = TALER_EXCHANGE_csr (exchange,
1, /* "array" length */
&nk,
@@ -312,7 +318,6 @@ TALER_EXCHANGE_withdraw (
GNUNET_free (wh);
return NULL;
}
- TALER_blinded_planchet_free (&wh->pd.blinded_planchet);
return wh;
}
@@ -320,6 +325,7 @@ TALER_EXCHANGE_withdraw (
void
TALER_EXCHANGE_withdraw_cancel (struct TALER_EXCHANGE_WithdrawHandle *wh)
{
+ TALER_blinded_planchet_free (&wh->pd.blinded_planchet);
if (NULL != wh->csrh)
{
TALER_EXCHANGE_csr_cancel (wh->csrh);