[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-exchange] branch master updated: -add draft handler for purse mer
From: |
gnunet |
Subject: |
[taler-exchange] branch master updated: -add draft handler for purse merge client request |
Date: |
Mon, 11 Apr 2022 15:34:57 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository exchange.
The following commit(s) were added to refs/heads/master by this push:
new c8c10052 -add draft handler for purse merge client request
c8c10052 is described below
commit c8c100529711959a1c18a5591b450362e648a9f6
Author: Christian Grothoff <grothoff@gnunet.org>
AuthorDate: Mon Apr 11 15:34:45 2022 +0200
-add draft handler for purse merge client request
---
contrib/gana | 2 +-
src/include/taler_crypto_lib.h | 4 ++--
src/include/taler_exchange_service.h | 2 ++
src/lib/Makefile.am | 1 +
src/lib/exchange_api_purse_merge.c | 40 +++++++++++++++++++-----------------
src/util/wallet_signatures.c | 4 ++--
6 files changed, 29 insertions(+), 24 deletions(-)
diff --git a/contrib/gana b/contrib/gana
index 80d31052..f794cafb 160000
--- a/contrib/gana
+++ b/contrib/gana
@@ -1 +1 @@
-Subproject commit 80d310529425013bc47d1b9ab36e9b60f3ed4ed0
+Subproject commit f794cafbc16ce0eae2826695235275e1e16c64db
diff --git a/src/include/taler_crypto_lib.h b/src/include/taler_crypto_lib.h
index 332923a9..0884bbf3 100644
--- a/src/include/taler_crypto_lib.h
+++ b/src/include/taler_crypto_lib.h
@@ -2881,7 +2881,7 @@ TALER_wallet_account_merge_sign (
struct GNUNET_TIME_Timestamp merge_timestamp,
const struct TALER_PurseContractPublicKeyP *purse_pub,
struct GNUNET_TIME_Timestamp purse_expiration,
- struct TALER_PrivateContractHashP *h_contract_terms,
+ const struct TALER_PrivateContractHashP *h_contract_terms,
const struct TALER_Amount *amount,
uint32_t min_age,
const struct TALER_ReservePrivateKeyP *reserve_priv,
@@ -2906,7 +2906,7 @@ TALER_wallet_account_merge_verify (
struct GNUNET_TIME_Timestamp merge_timestamp,
const struct TALER_PurseContractPublicKeyP *purse_pub,
struct GNUNET_TIME_Timestamp purse_expiration,
- struct TALER_PrivateContractHashP *h_contract_terms,
+ const struct TALER_PrivateContractHashP *h_contract_terms,
const struct TALER_Amount *amount,
uint32_t min_age,
const struct TALER_ReservePublicKeyP *reserve_pub,
diff --git a/src/include/taler_exchange_service.h
b/src/include/taler_exchange_service.h
index 207573ed..20905458 100644
--- a/src/include/taler_exchange_service.h
+++ b/src/include/taler_exchange_service.h
@@ -4391,6 +4391,7 @@ struct TALER_EXCHANGE_AccountMergeHandle;
* @param h_contract_terms hash of the purses' contract
* @param min_age minimum age of deposits into the purse
* @param purse_value_after_fees amount that should be in the purse
+ * @paran purse_expiration when will the purse expire
* @param merge_timestamp when is the merge happening (current time)
* @param cb function to call with the exchange's result
* @param cb_cls closure for @a cb
@@ -4406,6 +4407,7 @@ TALER_EXCHANGE_account_merge (
const struct TALER_PrivateContractHashP *h_contract_terms,
uint8_t min_age,
const struct TALER_Amount *purse_value_after_fees,
+ struct GNUNET_TIME_Timestamp purse_expiration,
struct GNUNET_TIME_Timestamp merge_timestamp,
TALER_EXCHANGE_AccountMergeCallback cb,
void *cb_cls);
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index 52ef2d2a..f82a5812 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -46,6 +46,7 @@ libtalerexchange_la_SOURCES = \
exchange_api_management_wire_enable.c \
exchange_api_melt.c \
exchange_api_purse_create_with_deposit.c \
+ exchange_api_purse_merge.c \
exchange_api_recoup.c \
exchange_api_recoup_refresh.c \
exchange_api_refresh_common.c exchange_api_refresh_common.h \
diff --git a/src/lib/exchange_api_purse_merge.c
b/src/lib/exchange_api_purse_merge.c
index 8f6723ee..e541afab 100644
--- a/src/lib/exchange_api_purse_merge.c
+++ b/src/lib/exchange_api_purse_merge.c
@@ -70,15 +70,20 @@ struct TALER_EXCHANGE_AccountMergeHandle
*/
void *cb_cls;
+ /**
+ * Base URL of the provider hosting the @e reserve_pub.
+ */
+ char *provider_url;
+
/**
* Expected value in the purse after fees.
*/
struct TALER_Amount purse_value_after_fees;
/**
- * Public key of the merge capability.
+ * Public key of the reserve public key.
*/
- struct TALER_AccountMergePublicKeyP merge_pub;
+ struct TALER_ReservePublicKeyP reserve_pub;
/**
* Public key of the purse.
@@ -168,10 +173,10 @@ handle_purse_merge_finished (void *cls,
etime,
pch->purse_expiration,
&pch->purse_value_after_fees,
- &total_deposited,
&pch->purse_pub,
- &pch->merge_pub,
&pch->h_contract_terms,
+ &pch->reserve_pub,
+ pch->provider_url,
&exchange_pub,
&exchange_sig))
{
@@ -231,7 +236,7 @@ handle_purse_merge_finished (void *cls,
}
pch->cb (pch->cb_cls,
&dr);
- TALER_EXCHANGE_purse_merge_with_deposit_cancel (pch);
+ TALER_EXCHANGE_account_merge_cancel (pch);
}
@@ -255,20 +260,22 @@ TALER_EXCHANGE_account_merge (
json_t *merge_obj;
CURL *eh;
struct TALER_PurseMergeSignatureP merge_sig;
- struct TALER_ReserveSignatureP account_sig;
+ struct TALER_ReserveSignatureP reserve_sig;
char arg_str[sizeof (pch->purse_pub) * 2 + 32];
- char *url;
char *reserve_url;
pch = GNUNET_new (struct TALER_EXCHANGE_AccountMergeHandle);
pch->exchange = exchange;
pch->cb = cb;
pch->cb_cls = cb_cls;
- pch->merge_timestamp = merge_timestamp;
pch->purse_pub = *purse_pub;
pch->h_contract_terms = *h_contract_terms;
pch->purse_expiration = purse_expiration;
pch->purse_value_after_fees = *purse_value_after_fees;
+ pch->provider_url = GNUNET_strdup (reserve_exchange_url);
+ GNUNET_CRYPTO_eddsa_key_get_public (&reserve_priv->eddsa_priv,
+ &pch->reserve_pub.eddsa_pub);
+
GNUNET_assert (GNUNET_YES ==
TEAH_handle_is_ready (exchange));
{
@@ -287,18 +294,14 @@ TALER_EXCHANGE_account_merge (
pub_str);
}
{
- struct TALER_ReservePublicKeyP reserve_pub;
- char pub_str[sizeof (reserve_pub) * 2];
+ char pub_str[sizeof (pch->reserve_pub) * 2];
char *end;
const char *exchange_url;
bool is_http;
- GNUNET_CRYPTO_eddsa_key_get_public (&reserve_priv->eddsa_priv,
- &reserve_pub.eddsa_pub);
-
end = GNUNET_STRINGS_data_to_string (
- &reserve_pub,
- sizeof (reserve_pub),
+ &pch->reserve_pub,
+ sizeof (pch->reserve_pub),
pub_str,
sizeof (pub_str));
*end = '\0';
@@ -336,8 +339,6 @@ TALER_EXCHANGE_account_merge (
GNUNET_free (pch);
return NULL;
}
- GNUNET_CRYPTO_eddsa_key_get_public (&merge_priv->eddsa_priv,
- &pch->merge_pub.eddsa_pub);
TALER_wallet_purse_merge_sign (reserve_url,
merge_timestamp,
purse_pub,
@@ -378,13 +379,13 @@ TALER_EXCHANGE_account_merge (
}
json_decref (merge_obj);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "URL for purse merge with deposit: `%s'\n",
+ "URL for purse merge: `%s'\n",
pch->url);
ctx = TEAH_handle_to_context (exchange);
pch->job = GNUNET_CURL_job_add2 (ctx,
eh,
pch->ctx.headers,
- &handle_purse_merge_deposit_finished,
+ &handle_purse_merge_finished,
pch);
return pch;
}
@@ -400,6 +401,7 @@ TALER_EXCHANGE_account_merge_cancel (
pch->job = NULL;
}
GNUNET_free (pch->url);
+ GNUNET_free (pch->provider_url);
TALER_curl_easy_post_finished (&pch->ctx);
GNUNET_free (pch);
}
diff --git a/src/util/wallet_signatures.c b/src/util/wallet_signatures.c
index 4b2ddb6c..5b98f46e 100644
--- a/src/util/wallet_signatures.c
+++ b/src/util/wallet_signatures.c
@@ -1088,7 +1088,7 @@ TALER_wallet_account_merge_sign (
struct GNUNET_TIME_Timestamp merge_timestamp,
const struct TALER_PurseContractPublicKeyP *purse_pub,
struct GNUNET_TIME_Timestamp purse_expiration,
- struct TALER_PrivateContractHashP *h_contract_terms,
+ const struct TALER_PrivateContractHashP *h_contract_terms,
const struct TALER_Amount *amount,
uint32_t min_age,
const struct TALER_ReservePrivateKeyP *reserve_priv,
@@ -1117,7 +1117,7 @@ TALER_wallet_account_merge_verify (
struct GNUNET_TIME_Timestamp merge_timestamp,
const struct TALER_PurseContractPublicKeyP *purse_pub,
struct GNUNET_TIME_Timestamp purse_expiration,
- struct TALER_PrivateContractHashP *h_contract_terms,
+ const struct TALER_PrivateContractHashP *h_contract_terms,
const struct TALER_Amount *amount,
uint32_t min_age,
const struct TALER_ReservePublicKeyP *reserve_pub,
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-exchange] branch master updated: -add draft handler for purse merge client request,
gnunet <=