diff options
author | Christian Grothoff <christian@grothoff.org> | 2022-02-09 16:43:36 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2022-02-09 16:43:36 +0100 |
commit | 1777db292e6e0d653e5e1e103317f2cc5ac241b6 (patch) | |
tree | 8be88489e754a53de87c55c0824bc749befa8132 /src/lib | |
parent | d05c561e4f95a845e3c8793a752369365f307d5f (diff) | |
download | exchange-1777db292e6e0d653e5e1e103317f2cc5ac241b6.tar.xz |
-fix withdraw logic
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/exchange_api_melt.c | 1 | ||||
-rw-r--r-- | src/lib/exchange_api_withdraw.c | 10 | ||||
-rw-r--r-- | src/lib/exchange_api_withdraw2.c | 7 |
3 files changed, 13 insertions, 5 deletions
diff --git a/src/lib/exchange_api_melt.c b/src/lib/exchange_api_melt.c index c4d9fb16c..4d585c85f 100644 --- a/src/lib/exchange_api_melt.c +++ b/src/lib/exchange_api_melt.c @@ -602,6 +602,7 @@ csr_cb (void *cls, struct TALER_EXCHANGE_MeltHandle *mh = cls; unsigned int nks_off = 0; + mh->csr = NULL; for (unsigned int i = 0; i<mh->rd->fresh_pks_len; i++) { const struct TALER_EXCHANGE_DenomPublicKey *fresh_pk = 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); diff --git a/src/lib/exchange_api_withdraw2.c b/src/lib/exchange_api_withdraw2.c index 1b3985552..13a43009e 100644 --- a/src/lib/exchange_api_withdraw2.c +++ b/src/lib/exchange_api_withdraw2.c @@ -438,9 +438,10 @@ TALER_EXCHANGE_withdraw2 ( TALER_amount_hton (&req.amount_with_fee, &wh->requested_amount); - if (GNUNET_OK != TALER_coin_ev_hash (&pd->blinded_planchet, - &pd->denom_pub_hash, - &req.h_coin_envelope)) + if (GNUNET_OK != + TALER_coin_ev_hash (&pd->blinded_planchet, + &pd->denom_pub_hash, + &req.h_coin_envelope)) { GNUNET_break (0); GNUNET_free (wh); |