From 5587ac112392a49a5a7779d198b3e38e6f6569c4 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 15 Oct 2023 22:53:33 +0200 Subject: migrate to batch withdraw API --- .../taler-merchant-httpd_post-rewards-ID-pickup.c | 26 +++++++++++++--------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/backend/taler-merchant-httpd_post-rewards-ID-pickup.c b/src/backend/taler-merchant-httpd_post-rewards-ID-pickup.c index 1a21790d..40eec8ef 100644 --- a/src/backend/taler-merchant-httpd_post-rewards-ID-pickup.c +++ b/src/backend/taler-merchant-httpd_post-rewards-ID-pickup.c @@ -78,7 +78,7 @@ struct PlanchetOperation /** * Withdraw handle (NULL while @e fo is active). */ - struct TALER_EXCHANGE_Withdraw2Handle *w2h; + struct TALER_EXCHANGE_BatchWithdraw2Handle *w2h; /** * Details about the planchet for withdrawing. @@ -241,7 +241,7 @@ stop_operations (struct PickupContext *pc) } if (NULL != po->w2h) { - TALER_EXCHANGE_withdraw2_cancel (po->w2h); + TALER_EXCHANGE_batch_withdraw2_cancel (po->w2h); po->w2h = NULL; } GNUNET_CONTAINER_DLL_remove (pc->po_head, @@ -319,7 +319,7 @@ TMH_force_reward_pickup_resume () */ static void withdraw_cb (void *cls, - const struct TALER_EXCHANGE_Withdraw2Response *w2r) + const struct TALER_EXCHANGE_BatchWithdraw2Response *w2r) { struct PlanchetOperation *po = cls; const struct TALER_EXCHANGE_HttpResponse *hr = &w2r->hr; @@ -346,10 +346,11 @@ withdraw_cb (void *cls, TALER_MHD_daemon_trigger (); /* we resumed, kick MHD */ return; } + GNUNET_assert (1 == w2r->details.ok.blind_sigs_length); qs = TMH_db->insert_pickup_blind_signature (TMH_db->cls, &pc->pickup_id, po->offset, - &w2r->details.ok.blind_sig); + &w2r->details.ok.blind_sigs[0]); GNUNET_free (po); if (qs < 0) { @@ -412,13 +413,16 @@ do_withdraw (void *cls, TALER_MHD_daemon_trigger (); /* we resumed, kick MHD */ return; } - po->w2h = TALER_EXCHANGE_withdraw2 (TMH_curl_ctx, - pc->exchange_url, - keys, - &po->pd, - &pc->reserve_priv, - &withdraw_cb, - po); + /* FIXME: actually use *batch* withdraw instead of + doing this coin-by-coin non-sense */ + po->w2h = TALER_EXCHANGE_batch_withdraw2 (TMH_curl_ctx, + pc->exchange_url, + keys, + &pc->reserve_priv, + 1, + &po->pd, + &withdraw_cb, + po); } -- cgit v1.2.3