diff options
Diffstat (limited to 'src/lib/exchange_api_melt.c')
-rw-r--r-- | src/lib/exchange_api_melt.c | 62 |
1 files changed, 14 insertions, 48 deletions
diff --git a/src/lib/exchange_api_melt.c b/src/lib/exchange_api_melt.c index 1f369c11b..dcee66a8b 100644 --- a/src/lib/exchange_api_melt.c +++ b/src/lib/exchange_api_melt.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of TALER | 2 | This file is part of TALER |
3 | Copyright (C) 2015-2020 Taler Systems SA | 3 | Copyright (C) 2015-2021 Taler Systems SA |
4 | 4 | ||
5 | TALER is free software; you can redistribute it and/or modify it under the | 5 | TALER is free software; you can redistribute it and/or modify it under the |
6 | terms of the GNU General Public License as published by the Free Software | 6 | terms of the GNU General Public License as published by the Free Software |
@@ -449,26 +449,6 @@ handle_melt_finished (void *cls, | |||
449 | } | 449 | } |
450 | 450 | ||
451 | 451 | ||
452 | /** | ||
453 | * Submit a melt request to the exchange and get the exchange's | ||
454 | * response. | ||
455 | * | ||
456 | * This API is typically used by a wallet. Note that to ensure that | ||
457 | * no money is lost in case of hardware failures, the provided | ||
458 | * argument should have been constructed using | ||
459 | * #TALER_EXCHANGE_refresh_prepare and committed to persistent storage | ||
460 | * prior to calling this function. | ||
461 | * | ||
462 | * @param exchange the exchange handle; the exchange must be ready to operate | ||
463 | * @param refresh_data_length size of the @a refresh_data (returned | ||
464 | * in the `res_size` argument from #TALER_EXCHANGE_refresh_prepare()) | ||
465 | * @param refresh_data the refresh data as returned from | ||
466 | #TALER_EXCHANGE_refresh_prepare()) | ||
467 | * @param melt_cb the callback to call with the result | ||
468 | * @param melt_cb_cls closure for @a melt_cb | ||
469 | * @return a handle for this request; NULL if the argument was invalid. | ||
470 | * In this case, neither callback will be called. | ||
471 | */ | ||
472 | struct TALER_EXCHANGE_MeltHandle * | 452 | struct TALER_EXCHANGE_MeltHandle * |
473 | TALER_EXCHANGE_melt (struct TALER_EXCHANGE_Handle *exchange, | 453 | TALER_EXCHANGE_melt (struct TALER_EXCHANGE_Handle *exchange, |
474 | size_t refresh_data_length, | 454 | size_t refresh_data_length, |
@@ -511,27 +491,19 @@ TALER_EXCHANGE_melt (struct TALER_EXCHANGE_Handle *exchange, | |||
511 | GNUNET_CRYPTO_eddsa_sign (&md->melted_coin.coin_priv.eddsa_priv, | 491 | GNUNET_CRYPTO_eddsa_sign (&md->melted_coin.coin_priv.eddsa_priv, |
512 | &melt, | 492 | &melt, |
513 | &confirm_sig.eddsa_signature); | 493 | &confirm_sig.eddsa_signature); |
514 | melt_obj = json_pack ("{s:o, s:o, s:o, s:o, s:o, s:o}", | 494 | melt_obj = GNUNET_JSON_PACK ( |
515 | "coin_pub", | 495 | GNUNET_JSON_pack_data_auto ("coin_pub", |
516 | GNUNET_JSON_from_data_auto (&melt.coin_pub), | 496 | &melt.coin_pub), |
517 | "denom_pub_hash", | 497 | GNUNET_JSON_pack_data_auto ("denom_pub_hash", |
518 | GNUNET_JSON_from_data_auto (&melt.h_denom_pub), | 498 | &melt.h_denom_pub), |
519 | "denom_sig", | 499 | TALER_JSON_pack_denomination_signature ("denom_sig", |
520 | GNUNET_JSON_from_rsa_signature ( | 500 | &md->melted_coin.sig), |
521 | md->melted_coin.sig.rsa_signature), | 501 | GNUNET_JSON_pack_data_auto ("confirm_sig", |
522 | "confirm_sig", | 502 | &confirm_sig), |
523 | GNUNET_JSON_from_data_auto (&confirm_sig), | 503 | TALER_JSON_pack_amount ("value_with_fee", |
524 | "value_with_fee", | 504 | &md->melted_coin.melt_amount_with_fee), |
525 | TALER_JSON_from_amount ( | 505 | GNUNET_JSON_pack_data_auto ("rc", |
526 | &md->melted_coin.melt_amount_with_fee), | 506 | &melt.rc)); |
527 | "rc", | ||
528 | GNUNET_JSON_from_data_auto (&melt.rc)); | ||
529 | if (NULL == melt_obj) | ||
530 | { | ||
531 | GNUNET_break (0); | ||
532 | TALER_EXCHANGE_free_melt_data_ (md); | ||
533 | return NULL; | ||
534 | } | ||
535 | { | 507 | { |
536 | char pub_str[sizeof (struct TALER_CoinSpendPublicKeyP) * 2]; | 508 | char pub_str[sizeof (struct TALER_CoinSpendPublicKeyP) * 2]; |
537 | char *end; | 509 | char *end; |
@@ -596,12 +568,6 @@ TALER_EXCHANGE_melt (struct TALER_EXCHANGE_Handle *exchange, | |||
596 | } | 568 | } |
597 | 569 | ||
598 | 570 | ||
599 | /** | ||
600 | * Cancel a melt request. This function cannot be used | ||
601 | * on a request handle if either callback was already invoked. | ||
602 | * | ||
603 | * @param mh the refresh melt handle | ||
604 | */ | ||
605 | void | 571 | void |
606 | TALER_EXCHANGE_melt_cancel (struct TALER_EXCHANGE_MeltHandle *mh) | 572 | TALER_EXCHANGE_melt_cancel (struct TALER_EXCHANGE_MeltHandle *mh) |
607 | { | 573 | { |