aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <grothoff@gnunet.org>2023-08-29 13:53:23 +0200
committerChristian Grothoff <grothoff@gnunet.org>2023-08-29 13:53:23 +0200
commit3e9a1fc66e4c8317a7d9012d36c5685682ec3c10 (patch)
tree8509c59e9643a0fcfbb11c394b544b54dbc76543
parentdb0866fc932e34eb8d76e2149f04c1764415501b (diff)
remove /wire endpoint, add wallet_data_hash to deposit, bump protocol version to v17
-rw-r--r--src/exchange/taler-exchange-httpd.c6
-rw-r--r--src/exchange/taler-exchange-httpd_config.h2
-rw-r--r--src/exchange/taler-exchange-httpd_keys.c99
-rw-r--r--src/exchange/taler-exchange-httpd_keys.h12
-rw-r--r--src/exchange/taler-exchange-httpd_purses_get.c5
-rw-r--r--src/lib/exchange_api_handle.c2
-rw-r--r--src/util/wallet_signatures.c6
7 files changed, 13 insertions, 119 deletions
diff --git a/src/exchange/taler-exchange-httpd.c b/src/exchange/taler-exchange-httpd.c
index 194ec6dae..acda91f5d 100644
--- a/src/exchange/taler-exchange-httpd.c
+++ b/src/exchange/taler-exchange-httpd.c
@@ -1482,12 +1482,6 @@ handle_mhd_request (void *cls,
.method = MHD_HTTP_METHOD_GET,
.handler.get = &TEH_keys_get_handler,
},
- /* Requests for wiring information */
- {
- .url = "wire",
- .method = MHD_HTTP_METHOD_GET,
- .handler.get = &TEH_handler_wire
- },
{
.url = "batch-deposit",
.method = MHD_HTTP_METHOD_POST,
diff --git a/src/exchange/taler-exchange-httpd_config.h b/src/exchange/taler-exchange-httpd_config.h
index 596765b27..ea4551721 100644
--- a/src/exchange/taler-exchange-httpd_config.h
+++ b/src/exchange/taler-exchange-httpd_config.h
@@ -41,7 +41,7 @@
*
* Returned via both /config and /keys endpoints.
*/
-#define EXCHANGE_PROTOCOL_VERSION "16:0:1"
+#define EXCHANGE_PROTOCOL_VERSION "17:0:0"
/**
diff --git a/src/exchange/taler-exchange-httpd_keys.c b/src/exchange/taler-exchange-httpd_keys.c
index a6a1340da..a4e7ace83 100644
--- a/src/exchange/taler-exchange-httpd_keys.c
+++ b/src/exchange/taler-exchange-httpd_keys.c
@@ -1054,60 +1054,6 @@ get_wire_state (void)
}
-MHD_RESULT
-TEH_handler_wire (struct TEH_RequestContext *rc,
- const char *const args[])
-{
- struct WireStateHandle *wsh;
-
- (void) args;
- wsh = get_wire_state ();
- if (NULL == wsh)
- return TALER_MHD_reply_with_error (rc->connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_EXCHANGE_GENERIC_BAD_CONFIGURATION,
- NULL);
- {
- const char *etag;
-
- etag = MHD_lookup_connection_value (rc->connection,
- MHD_HEADER_KIND,
- MHD_HTTP_HEADER_IF_NONE_MATCH);
- if ( (NULL != etag) &&
- (MHD_HTTP_OK == wsh->http_status) &&
- (NULL != wsh->etag) &&
- (0 == strcmp (etag,
- wsh->etag)) )
- {
- MHD_RESULT ret;
- struct MHD_Response *resp;
-
- resp = MHD_create_response_from_buffer (0,
- NULL,
- MHD_RESPMEM_PERSISTENT);
- TALER_MHD_add_global_headers (resp);
- GNUNET_break (MHD_YES ==
- MHD_add_response_header (resp,
- MHD_HTTP_HEADER_EXPIRES,
- wsh->dat));
- GNUNET_break (MHD_YES ==
- MHD_add_response_header (resp,
- MHD_HTTP_HEADER_ETAG,
- wsh->etag));
- ret = MHD_queue_response (rc->connection,
- MHD_HTTP_NOT_MODIFIED,
- resp);
- GNUNET_break (MHD_YES == ret);
- MHD_destroy_response (resp);
- return ret;
- }
- }
- return MHD_queue_response (rc->connection,
- wsh->http_status,
- wsh->wire_reply);
-}
-
-
const struct TALER_WireFeeSet *
TEH_wire_fees_by_time (
struct GNUNET_TIME_Timestamp ts,
@@ -2479,7 +2425,6 @@ create_krd (struct TEH_KeyStateHandle *ksh,
struct GNUNET_TIME_Timestamp last_cherry_pick_date,
json_t *signkeys,
json_t *recoup,
- json_t *denoms,
json_t *grouped_denominations,
const struct GNUNET_HashCode *h_grouped)
{
@@ -2501,7 +2446,6 @@ create_krd (struct TEH_KeyStateHandle *ksh,
last_cherry_pick_date.abs_time));
GNUNET_assert (NULL != signkeys);
GNUNET_assert (NULL != recoup);
- GNUNET_assert (NULL != denoms);
GNUNET_assert (NULL != grouped_denominations);
GNUNET_assert (NULL != h_grouped);
GNUNET_assert (NULL != ksh->auditors);
@@ -2602,8 +2546,6 @@ create_krd (struct TEH_KeyStateHandle *ksh,
signkeys),
GNUNET_JSON_pack_array_incref ("recoup",
recoup),
- GNUNET_JSON_pack_array_incref ("denoms",
- denoms),
GNUNET_JSON_pack_array_incref ("wads",
json_object_get (wsh->json_reply,
"wads")),
@@ -2813,7 +2755,6 @@ finish_keys_response (struct TEH_KeyStateHandle *ksh)
enum GNUNET_GenericReturnValue ret = GNUNET_SYSERR;
json_t *recoup;
struct SignKeyCtx sctx;
- json_t *denoms = NULL;
json_t *grouped_denominations = NULL;
struct GNUNET_TIME_Timestamp last_cherry_pick_date;
struct GNUNET_CONTAINER_Heap *heap;
@@ -2846,8 +2787,6 @@ finish_keys_response (struct TEH_KeyStateHandle *ksh)
sctx.min_sk_frequency);
}
- denoms = json_array ();
- GNUNET_assert (NULL != denoms);
hash_context = GNUNET_CRYPTO_hash_context_start ();
grouped_denominations = json_array ();
@@ -2905,7 +2844,6 @@ finish_keys_response (struct TEH_KeyStateHandle *ksh)
last_cherry_pick_date,
sctx.signkeys,
recoup,
- denoms,
grouped_denominations,
&grouped_hash_xor))
{
@@ -2922,41 +2860,6 @@ finish_keys_response (struct TEH_KeyStateHandle *ksh)
}
last_cherry_pick_date = dk->meta.start;
-
- {
- json_t *denom;
-
- denom =
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_data_auto ("master_sig",
- &dk->master_sig),
- GNUNET_JSON_pack_timestamp ("stamp_start",
- dk->meta.start),
- GNUNET_JSON_pack_timestamp ("stamp_expire_withdraw",
- dk->meta.expire_withdraw),
- GNUNET_JSON_pack_timestamp ("stamp_expire_deposit",
- dk->meta.expire_deposit),
- GNUNET_JSON_pack_timestamp ("stamp_expire_legal",
- dk->meta.expire_legal),
- TALER_JSON_pack_denom_pub ("denom_pub",
- &dk->denom_pub),
- TALER_JSON_pack_amount ("value",
- &dk->meta.value),
- TALER_JSON_PACK_DENOM_FEES ("fee",
- &dk->meta.fees));
-
- GNUNET_CRYPTO_hash_context_read (hash_context,
- &dk->h_denom_pub,
- sizeof (struct GNUNET_HashCode));
-
- GNUNET_assert (
- 0 ==
- json_array_append_new (
- denoms,
- denom));
-
- }
-
/*
* Group the denominations by {cipher, value, fees, age_mask}.
*
@@ -3166,7 +3069,6 @@ finish_keys_response (struct TEH_KeyStateHandle *ksh)
last_cherry_pick_date,
sctx.signkeys,
recoup,
- denoms,
grouped_denominations,
&grouped_hash_xor))
{
@@ -3205,7 +3107,6 @@ CLEANUP:
json_decref (grouped_denominations);
json_decref (sctx.signkeys);
json_decref (recoup);
- json_decref (denoms);
return ret;
}
diff --git a/src/exchange/taler-exchange-httpd_keys.h b/src/exchange/taler-exchange-httpd_keys.h
index f30eeb626..61096de93 100644
--- a/src/exchange/taler-exchange-httpd_keys.h
+++ b/src/exchange/taler-exchange-httpd_keys.h
@@ -198,18 +198,6 @@ TEH_wire_update_state (void);
/**
- * Handle a "/wire" request.
- *
- * @param rc request context
- * @param args array of additional options (must be empty for this function)
- * @return MHD result code
- */
-MHD_RESULT
-TEH_handler_wire (struct TEH_RequestContext *rc,
- const char *const args[]);
-
-
-/**
* Return the current key state for this thread. Possibly re-builds the key
* state if we have reason to believe that something changed.
*
diff --git a/src/exchange/taler-exchange-httpd_purses_get.c b/src/exchange/taler-exchange-httpd_purses_get.c
index 5e4e0619f..0701fc452 100644
--- a/src/exchange/taler-exchange-httpd_purses_get.c
+++ b/src/exchange/taler-exchange-httpd_purses_get.c
@@ -401,6 +401,10 @@ TEH_handler_purses_get (struct TEH_RequestContext *rc,
ec,
NULL);
else
+ {
+ /* Make sure merge_timestamp is omitted if not yet merged */
+ if (GNUNET_TIME_absolute_is_never (gc->merge_timestamp.abs_time))
+ gc->merge_timestamp = GNUNET_TIME_UNIT_ZERO_TS;
res = TALER_MHD_REPLY_JSON_PACK (
rc->connection,
MHD_HTTP_OK,
@@ -419,6 +423,7 @@ TEH_handler_purses_get (struct TEH_RequestContext *rc,
GNUNET_JSON_pack_timestamp ("deposit_timestamp",
dt))
);
+ }
}
return res;
}
diff --git a/src/lib/exchange_api_handle.c b/src/lib/exchange_api_handle.c
index def2c38f6..5562936fd 100644
--- a/src/lib/exchange_api_handle.c
+++ b/src/lib/exchange_api_handle.c
@@ -40,7 +40,7 @@
* Which version of the Taler protocol is implemented
* by this library? Used to determine compatibility.
*/
-#define EXCHANGE_PROTOCOL_CURRENT 16
+#define EXCHANGE_PROTOCOL_CURRENT 17
/**
* How many versions are we backwards compatible with?
diff --git a/src/util/wallet_signatures.c b/src/util/wallet_signatures.c
index 823641ed4..89acecb35 100644
--- a/src/util/wallet_signatures.c
+++ b/src/util/wallet_signatures.c
@@ -111,6 +111,12 @@ struct TALER_DepositRequestPS
*/
struct TALER_MerchantPublicKeyP merchant;
+ /**
+ * Hash over a JSON containing data provided by the
+ * wallet to complete the contract upon payment.
+ */
+ struct GNUNET_HashCode wallet_data_hash;
+
};
GNUNET_NETWORK_STRUCT_END