summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/auditor_api_curl_defaults.c12
-rw-r--r--src/lib/auditor_api_deposit_confirmation.c55
-rw-r--r--src/lib/exchange_api_auditor_add_denomination.c6
-rw-r--r--src/lib/exchange_api_common.c46
-rw-r--r--src/lib/exchange_api_curl_defaults.c3
-rw-r--r--src/lib/exchange_api_deposit.c38
-rw-r--r--src/lib/exchange_api_deposits_get.c10
-rw-r--r--src/lib/exchange_api_handle.c171
-rw-r--r--src/lib/exchange_api_handle.h2
-rw-r--r--src/lib/exchange_api_kyc_check.c6
-rw-r--r--src/lib/exchange_api_management_auditor_disable.c12
-rw-r--r--src/lib/exchange_api_management_auditor_enable.c12
-rw-r--r--src/lib/exchange_api_management_get_keys.c59
-rw-r--r--src/lib/exchange_api_management_post_keys.c6
-rw-r--r--src/lib/exchange_api_management_revoke_denomination_key.c6
-rw-r--r--src/lib/exchange_api_management_revoke_signing_key.c6
-rw-r--r--src/lib/exchange_api_management_set_wire_fee.c18
-rw-r--r--src/lib/exchange_api_management_wire_disable.c12
-rw-r--r--src/lib/exchange_api_management_wire_enable.c12
-rw-r--r--src/lib/exchange_api_recoup.c3
-rw-r--r--src/lib/exchange_api_refresh_common.c8
-rw-r--r--src/lib/exchange_api_refresh_common.h2
-rw-r--r--src/lib/exchange_api_refund.c12
-rw-r--r--src/lib/exchange_api_transfers_get.c4
-rw-r--r--src/lib/exchange_api_wire.c8
25 files changed, 254 insertions, 275 deletions
diff --git a/src/lib/auditor_api_curl_defaults.c b/src/lib/auditor_api_curl_defaults.c
index d8c6f619c..81fcd7bac 100644
--- a/src/lib/auditor_api_curl_defaults.c
+++ b/src/lib/auditor_api_curl_defaults.c
@@ -22,12 +22,6 @@
#include "auditor_api_curl_defaults.h"
-/**
- * Get a curl handle with the right defaults
- * for the exchange lib. In the future, we might manage a pool of connections here.
- *
- * @param url URL to query
- */
CURL *
TALER_AUDITOR_curl_easy_get_ (const char *url)
{
@@ -47,6 +41,12 @@ TALER_AUDITOR_curl_easy_get_ (const char *url)
curl_easy_setopt (eh,
CURLOPT_FOLLOWLOCATION,
1L));
+ /* Enable compression (using whatever curl likes), see
+ https://curl.se/libcurl/c/CURLOPT_ACCEPT_ENCODING.html */
+ GNUNET_break (CURLE_OK ==
+ curl_easy_setopt (eh,
+ CURLOPT_ACCEPT_ENCODING,
+ ""));
/* limit MAXREDIRS to 5 as a simple security measure against
a potential infinite loop caused by a malicious target */
GNUNET_assert (CURLE_OK ==
diff --git a/src/lib/auditor_api_deposit_confirmation.c b/src/lib/auditor_api_deposit_confirmation.c
index 5b207a18c..cdf1c5ef3 100644
--- a/src/lib/auditor_api_deposit_confirmation.c
+++ b/src/lib/auditor_api_deposit_confirmation.c
@@ -173,18 +173,18 @@ static enum GNUNET_GenericReturnValue
verify_signatures (const struct TALER_MerchantWireHash *h_wire,
const struct TALER_ExtensionContractHash *h_extensions,
const struct TALER_PrivateContractHash *h_contract_terms,
- struct GNUNET_TIME_Absolute exchange_timestamp,
- struct GNUNET_TIME_Absolute wire_deadline,
- struct GNUNET_TIME_Absolute refund_deadline,
+ struct GNUNET_TIME_Timestamp exchange_timestamp,
+ struct GNUNET_TIME_Timestamp wire_deadline,
+ struct GNUNET_TIME_Timestamp refund_deadline,
const struct TALER_Amount *amount_without_fee,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_MerchantPublicKeyP *merchant_pub,
const struct TALER_ExchangePublicKeyP *exchange_pub,
const struct TALER_ExchangeSignatureP *exchange_sig,
const struct TALER_MasterPublicKeyP *master_pub,
- struct GNUNET_TIME_Absolute ep_start,
- struct GNUNET_TIME_Absolute ep_expire,
- struct GNUNET_TIME_Absolute ep_end,
+ struct GNUNET_TIME_Timestamp ep_start,
+ struct GNUNET_TIME_Timestamp ep_expire,
+ struct GNUNET_TIME_Timestamp ep_end,
const struct TALER_MasterSignatureP *master_sig)
{
if (GNUNET_OK !=
@@ -223,7 +223,7 @@ verify_signatures (const struct TALER_MerchantWireHash *h_wire,
TALER_LOG_WARNING ("Invalid signature on exchange signing key!\n");
return GNUNET_SYSERR;
}
- if (GNUNET_TIME_absolute_is_past (ep_end))
+ if (GNUNET_TIME_absolute_is_past (ep_end.abs_time))
{
GNUNET_break (0);
TALER_LOG_WARNING ("Exchange signing key is no longer valid!\n");
@@ -239,18 +239,18 @@ TALER_AUDITOR_deposit_confirmation (
const struct TALER_MerchantWireHash *h_wire,
const struct TALER_ExtensionContractHash *h_extensions,
const struct TALER_PrivateContractHash *h_contract_terms,
- struct GNUNET_TIME_Absolute exchange_timestamp,
- struct GNUNET_TIME_Absolute wire_deadline,
- struct GNUNET_TIME_Absolute refund_deadline,
+ struct GNUNET_TIME_Timestamp exchange_timestamp,
+ struct GNUNET_TIME_Timestamp wire_deadline,
+ struct GNUNET_TIME_Timestamp refund_deadline,
const struct TALER_Amount *amount_without_fee,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_MerchantPublicKeyP *merchant_pub,
const struct TALER_ExchangePublicKeyP *exchange_pub,
const struct TALER_ExchangeSignatureP *exchange_sig,
const struct TALER_MasterPublicKeyP *master_pub,
- struct GNUNET_TIME_Absolute ep_start,
- struct GNUNET_TIME_Absolute ep_expire,
- struct GNUNET_TIME_Absolute ep_end,
+ struct GNUNET_TIME_Timestamp ep_start,
+ struct GNUNET_TIME_Timestamp ep_expire,
+ struct GNUNET_TIME_Timestamp ep_end,
const struct TALER_MasterSignatureP *master_sig,
TALER_AUDITOR_DepositConfirmationResultCallback cb,
void *cb_cls)
@@ -260,11 +260,6 @@ TALER_AUDITOR_deposit_confirmation (
json_t *deposit_confirmation_obj;
CURL *eh;
- (void) GNUNET_TIME_round_abs (&exchange_timestamp);
- (void) GNUNET_TIME_round_abs (&refund_deadline);
- (void) GNUNET_TIME_round_abs (&ep_start);
- (void) GNUNET_TIME_round_abs (&ep_expire);
- (void) GNUNET_TIME_round_abs (&ep_end);
GNUNET_assert (GNUNET_YES ==
TALER_AUDITOR_handle_is_ready_ (auditor));
if (GNUNET_OK !=
@@ -297,12 +292,12 @@ TALER_AUDITOR_deposit_confirmation (
h_extensions),
GNUNET_JSON_pack_data_auto ("h_contract_terms",
h_contract_terms),
- GNUNET_JSON_pack_time_abs ("exchange_timestamp",
- exchange_timestamp),
- GNUNET_JSON_pack_time_abs ("refund_deadline",
- refund_deadline),
- GNUNET_JSON_pack_time_abs ("wire_deadline",
- wire_deadline),
+ GNUNET_JSON_pack_timestamp ("exchange_timestamp",
+ exchange_timestamp),
+ GNUNET_JSON_pack_timestamp ("refund_deadline",
+ refund_deadline),
+ GNUNET_JSON_pack_timestamp ("wire_deadline",
+ wire_deadline),
TALER_JSON_pack_amount ("amount_without_fee",
amount_without_fee),
GNUNET_JSON_pack_data_auto ("coin_pub",
@@ -313,12 +308,12 @@ TALER_AUDITOR_deposit_confirmation (
exchange_sig),
GNUNET_JSON_pack_data_auto ("master_pub",
master_pub),
- GNUNET_JSON_pack_time_abs ("ep_start",
- ep_start),
- GNUNET_JSON_pack_time_abs ("ep_expire",
- ep_expire),
- GNUNET_JSON_pack_time_abs ("ep_end",
- ep_end),
+ GNUNET_JSON_pack_timestamp ("ep_start",
+ ep_start),
+ GNUNET_JSON_pack_timestamp ("ep_expire",
+ ep_expire),
+ GNUNET_JSON_pack_timestamp ("ep_end",
+ ep_end),
GNUNET_JSON_pack_data_auto ("master_sig",
master_sig),
GNUNET_JSON_pack_data_auto ("exchange_pub",
diff --git a/src/lib/exchange_api_auditor_add_denomination.c b/src/lib/exchange_api_auditor_add_denomination.c
index fbe46e51f..27eb43bcf 100644
--- a/src/lib/exchange_api_auditor_add_denomination.c
+++ b/src/lib/exchange_api_auditor_add_denomination.c
@@ -23,6 +23,7 @@
#include "taler_json_lib.h"
#include <gnunet/gnunet_curl_lib.h>
#include "taler_exchange_service.h"
+#include "auditor_api_curl_defaults.h"
#include "taler_signatures.h"
#include "taler_curl_lib.h"
#include "taler_json_lib.h"
@@ -190,7 +191,7 @@ TALER_EXCHANGE_add_auditor_denomination (
body = GNUNET_JSON_PACK (
GNUNET_JSON_pack_data_auto ("auditor_sig",
auditor_sig));
- eh = curl_easy_init ();
+ eh = TALER_AUDITOR_curl_easy_get_ (ah->url);
GNUNET_assert (NULL != eh);
if (GNUNET_OK !=
TALER_curl_easy_post (&ah->post_ctx,
@@ -207,9 +208,6 @@ TALER_EXCHANGE_add_auditor_denomination (
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Requesting URL '%s'\n",
ah->url);
- GNUNET_assert (CURLE_OK == curl_easy_setopt (eh,
- CURLOPT_URL,
- ah->url));
ah->job = GNUNET_CURL_job_add2 (ctx,
eh,
ah->post_ctx.headers,
diff --git a/src/lib/exchange_api_common.c b/src/lib/exchange_api_common.c
index 98a6ab20f..b14714ac6 100644
--- a/src/lib/exchange_api_common.c
+++ b/src/lib/exchange_api_common.c
@@ -86,12 +86,12 @@ TALER_EXCHANGE_parse_reserve_history (
{
const char *wire_url;
uint64_t wire_reference;
- struct GNUNET_TIME_Absolute timestamp;
+ struct GNUNET_TIME_Timestamp timestamp;
struct GNUNET_JSON_Specification withdraw_spec[] = {
GNUNET_JSON_spec_uint64 ("wire_reference",
&wire_reference),
- TALER_JSON_spec_absolute_time ("timestamp",
- &timestamp),
+ GNUNET_JSON_spec_timestamp ("timestamp",
+ &timestamp),
GNUNET_JSON_spec_string ("sender_account_url",
&wire_url),
GNUNET_JSON_spec_end ()
@@ -226,7 +226,7 @@ TALER_EXCHANGE_parse_reserve_history (
"RECOUP"))
{
struct TALER_RecoupConfirmationPS pc;
- struct GNUNET_TIME_Absolute timestamp;
+ struct GNUNET_TIME_Timestamp timestamp;
const struct TALER_EXCHANGE_Keys *key_state;
struct GNUNET_JSON_Specification recoup_spec[] = {
GNUNET_JSON_spec_fixed_auto ("coin_pub",
@@ -235,8 +235,8 @@ TALER_EXCHANGE_parse_reserve_history (
&rh->details.recoup_details.exchange_sig),
GNUNET_JSON_spec_fixed_auto ("exchange_pub",
&rh->details.recoup_details.exchange_pub),
- TALER_JSON_spec_absolute_time_nbo ("timestamp",
- &pc.timestamp),
+ GNUNET_JSON_spec_timestamp_nbo ("timestamp",
+ &pc.timestamp),
GNUNET_JSON_spec_end ()
};
@@ -256,7 +256,7 @@ TALER_EXCHANGE_parse_reserve_history (
pc.purpose.size = htonl (sizeof (pc));
pc.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP);
pc.reserve_pub = *reserve_pub;
- timestamp = GNUNET_TIME_absolute_ntoh (pc.timestamp);
+ timestamp = GNUNET_TIME_timestamp_ntoh (pc.timestamp);
rh->details.recoup_details.timestamp = timestamp;
key_state = TALER_EXCHANGE_get_keys (exchange);
@@ -294,7 +294,7 @@ TALER_EXCHANGE_parse_reserve_history (
{
const struct TALER_EXCHANGE_Keys *key_state;
struct TALER_ReserveCloseConfirmationPS rcc;
- struct GNUNET_TIME_Absolute timestamp;
+ struct GNUNET_TIME_Timestamp timestamp;
struct GNUNET_JSON_Specification closing_spec[] = {
GNUNET_JSON_spec_string (
"receiver_account_details",
@@ -307,8 +307,8 @@ TALER_EXCHANGE_parse_reserve_history (
&rh->details.close_details.exchange_pub),
TALER_JSON_spec_amount_any_nbo ("closing_fee",
&rcc.closing_fee),
- TALER_JSON_spec_absolute_time_nbo ("timestamp",
- &rcc.timestamp),
+ GNUNET_JSON_spec_timestamp_nbo ("timestamp",
+ &rcc.timestamp),
GNUNET_JSON_spec_end ()
};
@@ -330,7 +330,7 @@ TALER_EXCHANGE_parse_reserve_history (
rcc.purpose.size = htonl (sizeof (rcc));
rcc.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_RESERVE_CLOSED);
rcc.reserve_pub = *reserve_pub;
- timestamp = GNUNET_TIME_absolute_ntoh (rcc.timestamp);
+ timestamp = GNUNET_TIME_timestamp_ntoh (rcc.timestamp);
rh->details.close_details.timestamp = timestamp;
TALER_amount_ntoh (&rh->details.close_details.fee,
&rcc.closing_fee);
@@ -478,9 +478,9 @@ TALER_EXCHANGE_verify_coin_history (
struct TALER_MerchantWireHash h_wire;
struct TALER_PrivateContractHash h_contract_terms;
// struct TALER_ExtensionContractHash h_extensions; // FIXME!
- struct GNUNET_TIME_Absolute wallet_timestamp;
+ struct GNUNET_TIME_Timestamp wallet_timestamp;
struct TALER_MerchantPublicKeyP merchant_pub;
- struct GNUNET_TIME_Absolute refund_deadline = {0};
+ struct GNUNET_TIME_Timestamp refund_deadline = {0};
struct TALER_CoinSpendSignatureP sig;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_fixed_auto ("coin_sig",
@@ -491,11 +491,11 @@ TALER_EXCHANGE_verify_coin_history (
&h_wire),
GNUNET_JSON_spec_fixed_auto ("h_denom_pub",
h_denom_pub),
- TALER_JSON_spec_absolute_time ("timestamp",
- &wallet_timestamp),
+ GNUNET_JSON_spec_timestamp ("timestamp",
+ &wallet_timestamp),
GNUNET_JSON_spec_mark_optional (
- TALER_JSON_spec_absolute_time ("refund_deadline",
- &refund_deadline)),
+ GNUNET_JSON_spec_timestamp ("refund_deadline",
+ &refund_deadline)),
TALER_JSON_spec_amount_any ("deposit_fee",
&fee),
GNUNET_JSON_spec_fixed_auto ("merchant_pub",
@@ -711,8 +711,8 @@ TALER_EXCHANGE_verify_coin_history (
&rr.coin_blind),
GNUNET_JSON_spec_fixed_auto ("h_denom_pub",
&rr.h_denom_pub),
- TALER_JSON_spec_absolute_time_nbo ("timestamp",
- &pc.timestamp),
+ GNUNET_JSON_spec_timestamp_nbo ("timestamp",
+ &pc.timestamp),
GNUNET_JSON_spec_end ()
};
@@ -781,8 +781,8 @@ TALER_EXCHANGE_verify_coin_history (
&rr.coin_blind),
GNUNET_JSON_spec_fixed_auto ("h_denom_pub",
&rr.h_denom_pub),
- TALER_JSON_spec_absolute_time_nbo ("timestamp",
- &pc.timestamp),
+ GNUNET_JSON_spec_timestamp_nbo ("timestamp",
+ &pc.timestamp),
GNUNET_JSON_spec_end ()
};
@@ -840,8 +840,8 @@ TALER_EXCHANGE_verify_coin_history (
&exchange_pub),
GNUNET_JSON_spec_fixed_auto ("coin_pub",
&pc.coin_pub),
- TALER_JSON_spec_absolute_time_nbo ("timestamp",
- &pc.timestamp),
+ GNUNET_JSON_spec_timestamp_nbo ("timestamp",
+ &pc.timestamp),
GNUNET_JSON_spec_end ()
};
diff --git a/src/lib/exchange_api_curl_defaults.c b/src/lib/exchange_api_curl_defaults.c
index 6d6016953..9627db9ff 100644
--- a/src/lib/exchange_api_curl_defaults.c
+++ b/src/lib/exchange_api_curl_defaults.c
@@ -30,7 +30,10 @@ TALER_EXCHANGE_curl_easy_get_ (const char *url)
eh = curl_easy_init ();
if (NULL == eh)
+ {
+ GNUNET_break (0);
return NULL;
+ }
GNUNET_assert (CURLE_OK ==
curl_easy_setopt (eh,
CURLOPT_URL,
diff --git a/src/lib/exchange_api_deposit.c b/src/lib/exchange_api_deposit.c
index 3fd3353b2..de67bc5f2 100644
--- a/src/lib/exchange_api_deposit.c
+++ b/src/lib/exchange_api_deposit.c
@@ -100,13 +100,13 @@ struct TALER_EXCHANGE_DepositHandle
* Time when this confirmation was generated / when the exchange received
* the deposit request.
*/
- struct GNUNET_TIME_Absolute exchange_timestamp;
+ struct GNUNET_TIME_Timestamp exchange_timestamp;
/**
* By when does the exchange expect to pay the merchant
* (as per the merchant's request).
*/
- struct GNUNET_TIME_Absolute wire_deadline;
+ struct GNUNET_TIME_Timestamp wire_deadline;
/**
* How much time does the @e merchant have to issue a refund
@@ -115,7 +115,7 @@ struct TALER_EXCHANGE_DepositHandle
* performed by the exchange until the refund deadline. This value
* is taken from the original deposit request.
*/
- struct GNUNET_TIME_Absolute refund_deadline;
+ struct GNUNET_TIME_Timestamp refund_deadline;
/**
* Amount to be deposited, excluding fee. Calculated from the
@@ -334,8 +334,8 @@ handle_deposit_finished (void *cls,
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_string ("transaction_base_url",
&dr.details.success.transaction_base_url)),
- TALER_JSON_spec_absolute_time ("exchange_timestamp",
- &dh->exchange_timestamp),
+ GNUNET_JSON_spec_timestamp ("exchange_timestamp",
+ &dh->exchange_timestamp),
GNUNET_JSON_spec_end ()
};
@@ -481,9 +481,9 @@ verify_signatures (const struct TALER_EXCHANGE_DenomPublicKey *dki,
const struct TALER_DenominationSignature *denom_sig,
const struct TALER_DenominationPublicKey *denom_pub,
const struct TALER_DenominationHash *denom_pub_hash,
- struct GNUNET_TIME_Absolute timestamp,
+ struct GNUNET_TIME_Timestamp timestamp,
const struct TALER_MerchantPublicKeyP *merchant_pub,
- struct GNUNET_TIME_Absolute refund_deadline,
+ struct GNUNET_TIME_Timestamp refund_deadline,
const struct TALER_CoinSpendSignatureP *coin_sig)
{
if (GNUNET_OK !=
@@ -543,7 +543,7 @@ struct TALER_EXCHANGE_DepositHandle *
TALER_EXCHANGE_deposit (
struct TALER_EXCHANGE_Handle *exchange,
const struct TALER_Amount *amount,
- struct GNUNET_TIME_Absolute wire_deadline,
+ struct GNUNET_TIME_Timestamp wire_deadline,
const char *merchant_payto_uri,
const struct TALER_WireSalt *wire_salt,
const struct TALER_PrivateContractHash *h_contract_terms,
@@ -551,9 +551,9 @@ TALER_EXCHANGE_deposit (
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_DenominationSignature *denom_sig,
const struct TALER_DenominationPublicKey *denom_pub,
- struct GNUNET_TIME_Absolute timestamp,
+ struct GNUNET_TIME_Timestamp timestamp,
const struct TALER_MerchantPublicKeyP *merchant_pub,
- struct GNUNET_TIME_Absolute refund_deadline,
+ struct GNUNET_TIME_Timestamp refund_deadline,
const struct TALER_CoinSpendSignatureP *coin_sig,
TALER_EXCHANGE_DepositResultCallback cb,
void *cb_cls,
@@ -589,9 +589,9 @@ TALER_EXCHANGE_deposit (
"/coins/%s/deposit",
pub_str);
}
- (void) GNUNET_TIME_round_abs (&wire_deadline);
- (void) GNUNET_TIME_round_abs (&refund_deadline);
- if (refund_deadline.abs_value_us > wire_deadline.abs_value_us)
+ if (GNUNET_TIME_timestamp_cmp (refund_deadline,
+ >,
+ wire_deadline))
{
GNUNET_break_op (0);
*ec = TALER_EC_EXCHANGE_DEPOSIT_REFUND_DEADLINE_AFTER_WIRE_DEADLINE;
@@ -658,15 +658,15 @@ TALER_EXCHANGE_deposit (
&denom_pub_hash),
TALER_JSON_pack_denom_sig ("ub_sig",
denom_sig),
- GNUNET_JSON_pack_time_abs ("timestamp",
- timestamp),
+ GNUNET_JSON_pack_timestamp ("timestamp",
+ timestamp),
GNUNET_JSON_pack_data_auto ("merchant_pub",
merchant_pub),
GNUNET_JSON_pack_allow_null (
- GNUNET_JSON_pack_time_abs ("refund_deadline",
- refund_deadline)),
- GNUNET_JSON_pack_time_abs ("wire_transfer_deadline",
- wire_deadline),
+ GNUNET_JSON_pack_timestamp ("refund_deadline",
+ refund_deadline)),
+ GNUNET_JSON_pack_timestamp ("wire_transfer_deadline",
+ wire_deadline),
GNUNET_JSON_pack_data_auto ("coin_sig",
coin_sig));
dh = GNUNET_new (struct TALER_EXCHANGE_DepositHandle);
diff --git a/src/lib/exchange_api_deposits_get.c b/src/lib/exchange_api_deposits_get.c
index 3c334d760..18fb9b7bd 100644
--- a/src/lib/exchange_api_deposits_get.c
+++ b/src/lib/exchange_api_deposits_get.c
@@ -147,8 +147,8 @@ handle_deposit_wtid_finished (void *cls,
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_fixed_auto ("wtid",
&dr.details.success.wtid),
- TALER_JSON_spec_absolute_time ("execution_time",
- &dr.details.success.execution_time),
+ GNUNET_JSON_spec_timestamp ("execution_time",
+ &dr.details.success.execution_time),
TALER_JSON_spec_amount_any ("coin_contribution",
&dr.details.success.coin_contribution),
GNUNET_JSON_spec_fixed_auto ("exchange_sig",
@@ -168,7 +168,7 @@ handle_deposit_wtid_finished (void *cls,
dr.hr.ec = TALER_EC_GENERIC_REPLY_MALFORMED;
break;
}
- dwh->depconf.execution_time = GNUNET_TIME_absolute_hton (
+ dwh->depconf.execution_time = GNUNET_TIME_timestamp_hton (
dr.details.success.execution_time);
dwh->depconf.wtid = dr.details.success.wtid;
TALER_amount_hton (&dwh->depconf.coin_contribution,
@@ -192,8 +192,8 @@ handle_deposit_wtid_finished (void *cls,
{
/* Transaction known, but not executed yet */
struct GNUNET_JSON_Specification spec[] = {
- TALER_JSON_spec_absolute_time ("execution_time",
- &dr.details.accepted.execution_time),
+ GNUNET_JSON_spec_timestamp ("execution_time",
+ &dr.details.accepted.execution_time),
GNUNET_JSON_spec_uint64 ("payment_target_uuid",
&dr.details.accepted.payment_target_uuid),
GNUNET_JSON_spec_bool ("kyc_ok",
diff --git a/src/lib/exchange_api_handle.c b/src/lib/exchange_api_handle.c
index 5898a0df4..0f2a079b4 100644
--- a/src/lib/exchange_api_handle.c
+++ b/src/lib/exchange_api_handle.c
@@ -39,7 +39,7 @@
* Which version of the Taler protocol is implemented
* by this library? Used to determine compatibility.
*/
-#define EXCHANGE_PROTOCOL_CURRENT 10
+#define EXCHANGE_PROTOCOL_CURRENT 11
/**
* How many versions are we backwards compatible with?
@@ -161,7 +161,7 @@ struct KeysRequest
* Expiration time according to "Expire:" header.
* 0 if not provided by the server.
*/
- struct GNUNET_TIME_Absolute expire;
+ struct GNUNET_TIME_Timestamp expire;
};
@@ -264,12 +264,12 @@ parse_json_signkey (struct TALER_EXCHANGE_SigningPublicKey *sign_key,
&sign_key_issue_sig),
GNUNET_JSON_spec_fixed_auto ("key",
&sign_key->key),
- TALER_JSON_spec_absolute_time ("stamp_start",
- &sign_key->valid_from),
- TALER_JSON_spec_absolute_time ("stamp_expire",
- &sign_key->valid_until),
- TALER_JSON_spec_absolute_time ("stamp_end",
- &sign_key->valid_legal),
+ GNUNET_JSON_spec_timestamp ("stamp_start",
+ &sign_key->valid_from),
+ GNUNET_JSON_spec_timestamp ("stamp_expire",
+ &sign_key->valid_until),
+ GNUNET_JSON_spec_timestamp ("stamp_end",
+ &sign_key->valid_legal),
GNUNET_JSON_spec_end ()
};
@@ -322,14 +322,14 @@ parse_json_denomkey (struct TALER_EXCHANGE_DenomPublicKey *denom_key,
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_fixed_auto ("master_sig",
&denom_key->master_sig),
- TALER_JSON_spec_absolute_time ("stamp_expire_deposit",
- &denom_key->expire_deposit),
- TALER_JSON_spec_absolute_time ("stamp_expire_withdraw",
- &denom_key->withdraw_valid_until),
- TALER_JSON_spec_absolute_time ("stamp_start",
- &denom_key->valid_from),
- TALER_JSON_spec_absolute_time ("stamp_expire_legal",
- &denom_key->expire_legal),
+ GNUNET_JSON_spec_timestamp ("stamp_expire_deposit",
+ &denom_key->expire_deposit),
+ GNUNET_JSON_spec_timestamp ("stamp_expire_withdraw",
+ &denom_key->withdraw_valid_until),
+ GNUNET_JSON_spec_timestamp ("stamp_start",
+ &denom_key->valid_from),
+ GNUNET_JSON_spec_timestamp ("stamp_expire_legal",
+ &denom_key->expire_legal),
TALER_JSON_spec_amount_any ("value",
&denom_key->value),
TALER_JSON_spec_amount_any ("fee_withdraw",
@@ -675,10 +675,10 @@ decode_keys_json (const json_t *resp_obj,
&pub),
GNUNET_JSON_spec_fixed_auto ("master_public_key",
&key_data->master_pub),
- TALER_JSON_spec_absolute_time ("list_issue_date",
- &key_data->list_issue_date),
- TALER_JSON_spec_relative_time ("reserve_closing_delay",
- &key_data->reserve_closing_delay),
+ GNUNET_JSON_spec_timestamp ("list_issue_date",
+ &key_data->list_issue_date),
+ GNUNET_JSON_spec_relative_time ("reserve_closing_delay",
+ &key_data->reserve_closing_delay),
GNUNET_JSON_spec_string ("currency",
&currency),
GNUNET_JSON_spec_mark_optional (
@@ -843,10 +843,10 @@ decode_keys_json (const json_t *resp_obj,
/* Update "last_denom_issue_date" */
TALER_LOG_DEBUG ("Adding denomination key that is valid_until %s\n",
- GNUNET_STRINGS_absolute_time_to_string (dk.valid_from));
+ GNUNET_TIME_timestamp2s (dk.valid_from));
key_data->last_denom_issue_date
- = GNUNET_TIME_absolute_max (key_data->last_denom_issue_date,
- dk.valid_from);
+ = GNUNET_TIME_timestamp_max (key_data->last_denom_issue_date,
+ dk.valid_from);
};
}
@@ -970,7 +970,7 @@ decode_keys_json (const json_t *resp_obj,
struct TALER_ExchangeKeySetPS ks = {
.purpose.size = htonl (sizeof (ks)),
.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_KEY_SET),
- .list_issue_date = GNUNET_TIME_absolute_hton (key_data->list_issue_date)
+ .list_issue_date = GNUNET_TIME_timestamp_hton (key_data->list_issue_date)
};
GNUNET_CRYPTO_hash_context_finish (hash_context,
@@ -1040,16 +1040,16 @@ request_keys (void *cls);
void
TALER_EXCHANGE_set_last_denom (struct TALER_EXCHANGE_Handle *exchange,
- struct GNUNET_TIME_Absolute last_denom_new)
+ struct GNUNET_TIME_Timestamp last_denom_new)
{
TALER_LOG_DEBUG (
"Application explicitly set last denomination validity to %s\n",
- GNUNET_STRINGS_absolute_time_to_string (last_denom_new));
+ GNUNET_TIME_timestamp2s (last_denom_new));
exchange->key_data.last_denom_issue_date = last_denom_new;
}
-struct GNUNET_TIME_Absolute
+struct GNUNET_TIME_Timestamp
TALER_EXCHANGE_check_keys_current (struct TALER_EXCHANGE_Handle *exchange,
enum TALER_EXCHANGE_CheckKeysFlags flags)
{
@@ -1057,7 +1057,7 @@ TALER_EXCHANGE_check_keys_current (struct TALER_EXCHANGE_Handle *exchange,
bool pull_all_keys = 0 != (flags & TALER_EXCHANGE_CKF_PULL_ALL_KEYS);
if (NULL != exchange->kr)
- return GNUNET_TIME_UNIT_ZERO_ABS;
+ return GNUNET_TIME_UNIT_ZERO_TS;
if (pull_all_keys)
{
@@ -1067,12 +1067,13 @@ TALER_EXCHANGE_check_keys_current (struct TALER_EXCHANGE_Handle *exchange,
exchange->state = MHS_INIT;
}
if ( (! force_download) &&
- (GNUNET_TIME_absolute_is_future (exchange->key_data_expiration)) )
+ (GNUNET_TIME_absolute_is_future (
+ exchange->key_data_expiration.abs_time)) )
return exchange->key_data_expiration;
if (NULL == exchange->retry_task)
exchange->retry_task = GNUNET_SCHEDULER_add_now (&request_keys,
exchange);
- return GNUNET_TIME_UNIT_ZERO_ABS;
+ return GNUNET_TIME_UNIT_ZERO_TS;
}
@@ -1104,15 +1105,16 @@ keys_completed_cb (void *cls,
"Received keys from URL `%s' with status %ld and expiration %s.\n",
kr->url,
response_code,
- GNUNET_STRINGS_absolute_time_to_string (kr->expire));
- if (GNUNET_TIME_absolute_is_past (kr->expire))
+ GNUNET_TIME_timestamp2s (kr->expire));
+ if (GNUNET_TIME_absolute_is_past (kr->expire.abs_time))
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Exchange failed to give expiration time, assuming in %s\n",
- GNUNET_STRINGS_relative_time_to_string (DEFAULT_EXPIRATION,
- GNUNET_YES));
- kr->expire = GNUNET_TIME_relative_to_absolute (DEFAULT_EXPIRATION);
- (void) GNUNET_TIME_round_abs (&kr->expire);
+ GNUNET_TIME_relative2s (DEFAULT_EXPIRATION,
+ true));
+ kr->expire
+ = GNUNET_TIME_absolute_to_timestamp (
+ GNUNET_TIME_relative_to_absolute (DEFAULT_EXPIRATION));
}
kd_old = exchange->key_data;
memset (&kd,
@@ -1250,13 +1252,14 @@ keys_completed_cb (void *cls,
break;
}
exchange->key_data = kd;
- if (GNUNET_TIME_absolute_is_past (exchange->key_data.last_denom_issue_date))
+ if (GNUNET_TIME_absolute_is_past (
+ exchange->key_data.last_denom_issue_date.abs_time))
TALER_LOG_WARNING ("Last DK issue date from exchange is in the past: %s\n",
- GNUNET_STRINGS_absolute_time_to_string (
+ GNUNET_TIME_timestamp2s (
exchange->key_data.last_denom_issue_date));
else
TALER_LOG_DEBUG ("Last DK issue date updated to: %s\n",
- GNUNET_STRINGS_absolute_time_to_string (
+ GNUNET_TIME_timestamp2s (
exchange->key_data.last_denom_issue_date));
@@ -1340,7 +1343,7 @@ TEAH_path_to_url (struct TALER_EXCHANGE_Handle *h,
*/
static enum GNUNET_GenericReturnValue
parse_date_string (const char *dateline,
- struct GNUNET_TIME_Absolute *at)
+ struct GNUNET_TIME_Timestamp *at)
{
static const char *MONTHS[] =
{ "Jan", "Feb", "Mar", "Apr", "May", "Jun",
@@ -1422,7 +1425,7 @@ parse_date_string (const char *dateline,
}
if (t < 0)
t = 0; /* can happen due to timezone issues if date was 1.1.1970 */
- at->abs_value_us = 1000LL * 1000LL * t;
+ *at = GNUNET_TIME_timestamp_from_s (t);
return GNUNET_OK;
}
@@ -1464,7 +1467,7 @@ header_cb (char *buffer,
"Failed to parse %s-header `%s'\n",
MHD_HTTP_HEADER_EXPIRES,
val);
- kr->expire = GNUNET_TIME_UNIT_ZERO_ABS;
+ kr->expire = GNUNET_TIME_UNIT_ZERO_TS;
}
GNUNET_free (val);
return total;
@@ -1490,7 +1493,7 @@ deserialize_data (struct TALER_EXCHANGE_Handle *exchange,
json_t *keys;
const char *url;
uint32_t version;
- struct GNUNET_TIME_Absolute expire;
+ struct GNUNET_TIME_Timestamp expire;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_uint32 ("version",
&version),
@@ -1498,8 +1501,8 @@ deserialize_data (struct TALER_EXCHANGE_Handle *exchange,
&keys),
GNUNET_JSON_spec_string ("exchange_url",
&url),
- TALER_JSON_spec_absolute_time ("expire",
- &expire),
+ GNUNET_JSON_spec_timestamp ("expire",
+ &expire),
GNUNET_JSON_spec_end ()
};
struct TALER_EXCHANGE_Keys key_data;
@@ -1566,13 +1569,13 @@ json_t *
TALER_EXCHANGE_serialize_data (struct TALER_EXCHANGE_Handle *exchange)
{
const struct TALER_EXCHANGE_Keys *kd = &exchange->key_data;
- struct GNUNET_TIME_Absolute now;
+ struct GNUNET_TIME_Timestamp now;
json_t *keys;
json_t *signkeys;
json_t *denoms;
json_t *auditors;
- now = GNUNET_TIME_absolute_get ();
+ now = GNUNET_TIME_timestamp_get ();
signkeys = json_array ();
if (NULL == signkeys)
{
@@ -1584,19 +1587,21 @@ TALER_EXCHANGE_serialize_data (struct TALER_EXCHANGE_Handle *exchange)
const struct TALER_EXCHANGE_SigningPublicKey *sk = &kd->sign_keys[i];
json_t *signkey;
- if (now.abs_value_us > sk->valid_until.abs_value_us)
+ if (GNUNET_TIME_timestamp_cmp (now,
+ >,
+ sk->valid_until))
continue; /* skip keys that have expired */
signkey = GNUNET_JSON_PACK (
GNUNET_JSON_pack_data_auto ("key",
&sk->key),
GNUNET_JSON_pack_data_auto ("master_sig",
&sk->master_sig),
- GNUNET_JSON_pack_time_abs ("stamp_start",
- sk->valid_from),
- GNUNET_JSON_pack_time_abs ("stamp_expire",
- sk->valid_until),
- GNUNET_JSON_pack_time_abs ("stamp_end",
- sk->valid_legal));
+ GNUNET_JSON_pack_timestamp ("stamp_start",
+ sk->valid_from),
+ GNUNET_JSON_pack_timestamp ("stamp_expire",
+ sk->valid_until),
+ GNUNET_JSON_pack_timestamp ("stamp_end",
+ sk->valid_legal));
if (NULL == signkey)
{
GNUNET_break (0);
@@ -1623,17 +1628,19 @@ TALER_EXCHANGE_serialize_data (struct TALER_EXCHANGE_Handle *exchange)
const struct TALER_EXCHANGE_DenomPublicKey *dk = &kd->denom_keys[i];
json_t *denom;
- if (now.abs_value_us > dk->expire_deposit.abs_value_us)
+ if (GNUNET_TIME_timestamp_cmp (now,
+ >,
+ dk->expire_deposit))
continue; /* skip keys that have expired */
denom = GNUNET_JSON_PACK (
- GNUNET_JSON_pack_time_abs ("stamp_expire_deposit",
- dk->expire_deposit),
- GNUNET_JSON_pack_time_abs ("stamp_expire_withdraw",
- dk->withdraw_valid_until),
- GNUNET_JSON_pack_time_abs ("stamp_start",
- dk->valid_from),
- GNUNET_JSON_pack_time_abs ("stamp_expire_legal",
- dk->expire_legal),
+ GNUNET_JSON_pack_timestamp ("stamp_expire_deposit",
+ dk->expire_deposit),
+ GNUNET_JSON_pack_timestamp ("stamp_expire_withdraw",
+ dk->withdraw_valid_until),
+ GNUNET_JSON_pack_timestamp ("stamp_start",
+ dk->valid_from),
+ GNUNET_JSON_pack_timestamp ("stamp_expire_legal",
+ dk->expire_legal),
TALER_JSON_pack_amount ("value",
&dk->value),
TALER_JSON_pack_amount ("fee_withdraw",
@@ -1677,7 +1684,9 @@ TALER_EXCHANGE_serialize_data (struct TALER_EXCHANGE_Handle *exchange)
&kd->denom_keys[adi->denom_key_offset];
json_t *k;
- if (now.abs_value_us > dk->expire_deposit.abs_value_us)
+ if (GNUNET_TIME_timestamp_cmp (now,
+ >,
+ dk->expire_deposit))
continue; /* skip auditor signatures for denomination keys that have expired */
GNUNET_assert (adi->denom_key_offset < kd->num_denom_keys);
k = GNUNET_JSON_PACK (
@@ -1710,8 +1719,8 @@ TALER_EXCHANGE_serialize_data (struct TALER_EXCHANGE_Handle *exchange)
&kd->master_pub),
GNUNET_JSON_pack_time_rel ("reserve_closing_delay",
kd->reserve_closing_delay),
- GNUNET_JSON_pack_time_abs ("list_issue_date",
- kd->list_issue_date),
+ GNUNET_JSON_pack_timestamp ("list_issue_date",
+ kd->list_issue_date),
GNUNET_JSON_pack_array_steal ("signkeys",
signkeys),
GNUNET_JSON_pack_array_steal ("denoms",
@@ -1721,8 +1730,8 @@ TALER_EXCHANGE_serialize_data (struct TALER_EXCHANGE_Handle *exchange)
return GNUNET_JSON_PACK (
GNUNET_JSON_pack_uint64 ("version",
EXCHANGE_SERIALIZATION_FORMAT_VERSION),
- GNUNET_JSON_pack_time_abs ("expire",
- exchange->key_data_expiration),
+ GNUNET_JSON_pack_timestamp ("expire",
+ exchange->key_data_expiration),
GNUNET_JSON_pack_string ("exchange_url",
exchange->url),
GNUNET_JSON_pack_object_steal ("keys",
@@ -1823,12 +1832,12 @@ request_keys (void *cls)
if (GNUNET_YES == TEAH_handle_is_ready (exchange))
{
TALER_LOG_DEBUG ("Last DK issue date (before GETting /keys): %s\n",
- GNUNET_STRINGS_absolute_time_to_string (
+ GNUNET_TIME_timestamp2s (
exchange->key_data.last_denom_issue_date));
sprintf (&url[strlen (url)],
"last_issue_date=%llu&",
- (unsigned long
- long) exchange->key_data.last_denom_issue_date.abs_value_us
+ (unsigned long long)
+ exchange->key_data.last_denom_issue_date.abs_time.abs_value_us
/ 1000000LLU);
}
@@ -1951,18 +1960,22 @@ TALER_EXCHANGE_test_signing_key (const struct TALER_EXCHANGE_Keys *keys,
/* we will check using a tolerance of 1h for the time */
now = GNUNET_TIME_absolute_get ();
for (unsigned int i = 0; i<keys->num_sign_keys; i++)
- if ( (keys->sign_keys[i].valid_from.abs_value_us <=
- GNUNET_TIME_absolute_add (now,
- LIFETIME_TOLERANCE).abs_value_us) &&
- (keys->sign_keys[i].valid_until.abs_value_us >
- GNUNET_TIME_absolute_subtract (now,
- LIFETIME_TOLERANCE).abs_value_us) &&
+ if ( (GNUNET_TIME_absolute_cmp (
+ keys->sign_keys[i].valid_from.abs_time,
+ <=,
+ GNUNET_TIME_absolute_add (now,
+ LIFETIME_TOLERANCE))) &&
+ (GNUNET_TIME_absolute_cmp (
+ keys->sign_keys[i].valid_until.abs_time,
+ >,
+ GNUNET_TIME_absolute_subtract (now,
+ LIFETIME_TOLERANCE))) &&
(0 == GNUNET_memcmp (pub,
&keys->sign_keys[i].key)) )
return GNUNET_OK;
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "Signing key not valid at time %llu\n",
- (unsigned long long) now.abs_value_us);
+ "Signing key not valid at time %s\n",
+ GNUNET_TIME_absolute2s (now));
return GNUNET_SYSERR;
}
diff --git a/src/lib/exchange_api_handle.h b/src/lib/exchange_api_handle.h
index df0ccf7fc..569c723c4 100644
--- a/src/lib/exchange_api_handle.h
+++ b/src/lib/exchange_api_handle.h
@@ -147,7 +147,7 @@ struct TALER_EXCHANGE_Handle
/**
* When does @e key_data expire?
*/
- struct GNUNET_TIME_Absolute key_data_expiration;
+ struct GNUNET_TIME_Timestamp key_data_expiration;
/**
* Number of subsequent failed requests to /keys.
diff --git a/src/lib/exchange_api_kyc_check.c b/src/lib/exchange_api_kyc_check.c
index f64dfe4ea..bf7b0bf40 100644
--- a/src/lib/exchange_api_kyc_check.c
+++ b/src/lib/exchange_api_kyc_check.c
@@ -100,8 +100,8 @@ handle_kyc_check_finished (void *cls,
&ks.details.kyc_ok.exchange_sig),
GNUNET_JSON_spec_fixed_auto ("exchange_pub",
&ks.details.kyc_ok.exchange_pub),
- TALER_JSON_spec_absolute_time ("now",
- &ks.details.kyc_ok.timestamp),
+ GNUNET_JSON_spec_timestamp ("now",
+ &ks.details.kyc_ok.timestamp),
GNUNET_JSON_spec_end ()
};
const struct TALER_EXCHANGE_Keys *key_state;
@@ -122,7 +122,7 @@ handle_kyc_check_finished (void *cls,
ks.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
break;
}
- kyc_purpose.timestamp = GNUNET_TIME_absolute_hton (
+ kyc_purpose.timestamp = GNUNET_TIME_timestamp_hton (
ks.details.kyc_ok.timestamp);
key_state = TALER_EXCHANGE_get_keys (kch->exchange);
if (GNUNET_OK !=
diff --git a/src/lib/exchange_api_management_auditor_disable.c b/src/lib/exchange_api_management_auditor_disable.c
index fb68ad6d3..bfe60ee79 100644
--- a/src/lib/exchange_api_management_auditor_disable.c
+++ b/src/lib/exchange_api_management_auditor_disable.c
@@ -23,6 +23,7 @@
#include "taler_json_lib.h"
#include <gnunet/gnunet_curl_lib.h>
#include "taler_exchange_service.h"
+#include "exchange_api_curl_defaults.h"
#include "taler_signatures.h"
#include "taler_curl_lib.h"
#include "taler_json_lib.h"
@@ -128,7 +129,7 @@ TALER_EXCHANGE_management_disable_auditor (
struct GNUNET_CURL_Context *ctx,
const char *url,
const struct TALER_AuditorPublicKeyP *auditor_pub,
- struct GNUNET_TIME_Absolute validity_end,
+ struct GNUNET_TIME_Timestamp validity_end,
const struct TALER_MasterSignatureP *master_sig,
TALER_EXCHANGE_ManagementAuditorDisableCallback cb,
void *cb_cls)
@@ -169,9 +170,9 @@ TALER_EXCHANGE_management_disable_auditor (
body = GNUNET_JSON_PACK (
GNUNET_JSON_pack_data_auto ("master_sig",
master_sig),
- GNUNET_JSON_pack_time_abs ("validity_end",
- validity_end));
- eh = curl_easy_init ();
+ GNUNET_JSON_pack_timestamp ("validity_end",
+ validity_end));
+ eh = TALER_EXCHANGE_curl_easy_get_ (ah->url);
GNUNET_assert (NULL != eh);
if (GNUNET_OK !=
TALER_curl_easy_post (&ah->post_ctx,
@@ -188,9 +189,6 @@ TALER_EXCHANGE_management_disable_auditor (
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Requesting URL '%s'\n",
ah->url);
- GNUNET_assert (CURLE_OK == curl_easy_setopt (eh,
- CURLOPT_URL,
- ah->url));
ah->job = GNUNET_CURL_job_add2 (ctx,
eh,
ah->post_ctx.headers,
diff --git a/src/lib/exchange_api_management_auditor_enable.c b/src/lib/exchange_api_management_auditor_enable.c
index 1f53cb120..a99449307 100644
--- a/src/lib/exchange_api_management_auditor_enable.c
+++ b/src/lib/exchange_api_management_auditor_enable.c
@@ -23,6 +23,7 @@
#include "taler_json_lib.h"
#include <gnunet/gnunet_curl_lib.h>
#include "taler_exchange_service.h"
+#include "exchange_api_curl_defaults.h"
#include "taler_signatures.h"
#include "taler_curl_lib.h"
#include "taler_json_lib.h"
@@ -127,7 +128,7 @@ TALER_EXCHANGE_management_enable_auditor (
const struct TALER_AuditorPublicKeyP *auditor_pub,
const char *auditor_url,
const char *auditor_name,
- struct GNUNET_TIME_Absolute validity_start,
+ struct GNUNET_TIME_Timestamp validity_start,
const struct TALER_MasterSignatureP *master_sig,
TALER_EXCHANGE_ManagementAuditorEnableCallback cb,
void *cb_cls)
@@ -159,9 +160,9 @@ TALER_EXCHANGE_management_enable_auditor (
auditor_pub),
GNUNET_JSON_pack_data_auto ("master_sig",
master_sig),
- GNUNET_JSON_pack_time_abs ("validity_start",
- validity_start));
- eh = curl_easy_init ();
+ GNUNET_JSON_pack_timestamp ("validity_start",
+ validity_start));
+ eh = TALER_EXCHANGE_curl_easy_get_ (ah->url);
GNUNET_assert (NULL != eh);
if (GNUNET_OK !=
TALER_curl_easy_post (&ah->post_ctx,
@@ -178,9 +179,6 @@ TALER_EXCHANGE_management_enable_auditor (
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Requesting URL '%s'\n",
ah->url);
- GNUNET_assert (CURLE_OK == curl_easy_setopt (eh,
- CURLOPT_URL,
- ah->url));
ah->job = GNUNET_CURL_job_add2 (ctx,
eh,
ah->post_ctx.headers,
diff --git a/src/lib/exchange_api_management_get_keys.c b/src/lib/exchange_api_management_get_keys.c
index 5e6024f27..e776082d3 100644
--- a/src/lib/exchange_api_management_get_keys.c
+++ b/src/lib/exchange_api_management_get_keys.c
@@ -23,6 +23,7 @@
#include "taler_json_lib.h"
#include <gnunet/gnunet_curl_lib.h>
#include "taler_exchange_service.h"
+#include "exchange_api_curl_defaults.h"
#include "taler_signatures.h"
#include "taler_curl_lib.h"
#include "taler_crypto_lib.h"
@@ -124,12 +125,12 @@ handle_ok (struct TALER_EXCHANGE_ManagementGetKeysHandle *gh,
&sign_key->key),
GNUNET_JSON_spec_fixed_auto ("signkey_secmod_sig",
&sign_key->signkey_secmod_sig),
- TALER_JSON_spec_absolute_time ("stamp_start",
- &sign_key->valid_from),
- TALER_JSON_spec_absolute_time ("stamp_expire",
- &sign_key->valid_until),
- TALER_JSON_spec_absolute_time ("stamp_end",
- &sign_key->valid_legal),
+ GNUNET_JSON_spec_timestamp ("stamp_start",
+ &sign_key->valid_from),
+ GNUNET_JSON_spec_timestamp ("stamp_expire",
+ &sign_key->valid_until),
+ GNUNET_JSON_spec_timestamp ("stamp_end",
+ &sign_key->valid_legal),
GNUNET_JSON_spec_end ()
};
@@ -144,8 +145,8 @@ handle_ok (struct TALER_EXCHANGE_ManagementGetKeysHandle *gh,
}
{
struct GNUNET_TIME_Relative duration
- = GNUNET_TIME_absolute_get_difference (sign_key->valid_from,
- sign_key->valid_until);
+ = GNUNET_TIME_absolute_get_difference (sign_key->valid_from.abs_time,
+ sign_key->valid_until.abs_time);
if (GNUNET_OK !=
TALER_exchange_secmod_eddsa_verify (
@@ -171,14 +172,14 @@ handle_ok (struct TALER_EXCHANGE_ManagementGetKeysHandle *gh,
struct GNUNET_JSON_Specification spec[] = {
TALER_JSON_spec_amount_any ("value",
&denom_key->value),
- TALER_JSON_spec_absolute_time ("stamp_start",
- &denom_key->valid_from),
- TALER_JSON_spec_absolute_time ("stamp_expire_withdraw",
- &denom_key->withdraw_valid_until),
- TALER_JSON_spec_absolute_time ("stamp_expire_deposit",
- &denom_key->expire_deposit),
- TALER_JSON_spec_absolute_time ("stamp_expire_legal",
- &denom_key->expire_legal),
+ GNUNET_JSON_spec_timestamp ("stamp_start",
+ &denom_key->valid_from),
+ GNUNET_JSON_spec_timestamp ("stamp_expire_withdraw",
+ &denom_key->withdraw_valid_until),
+ GNUNET_JSON_spec_timestamp ("stamp_expire_deposit",
+ &denom_key->expire_deposit),
+ GNUNET_JSON_spec_timestamp ("stamp_expire_legal",
+ &denom_key->expire_legal),
TALER_JSON_spec_denom_pub ("denom_pub",
&denom_key->key),
TALER_JSON_spec_amount_any ("fee_withdraw",
@@ -214,8 +215,9 @@ handle_ok (struct TALER_EXCHANGE_ManagementGetKeysHandle *gh,
{
struct TALER_DenominationHash h_denom_pub;
struct GNUNET_TIME_Relative duration
- = GNUNET_TIME_absolute_get_difference (denom_key->valid_from,
- denom_key->withdraw_valid_until);
+ = GNUNET_TIME_absolute_get_difference (
+ denom_key->valid_from.abs_time,
+ denom_key->withdraw_valid_until.abs_time);
TALER_denom_pub_hash (&denom_key->key,
&h_denom_pub);
@@ -335,16 +337,6 @@ handle_get_keys_finished (void *cls,
};
-/**
- * Request future keys from the exchange. The obtained information will be
- * passed to the @a cb.
- *
- * @param ctx the context
- * @param url HTTP base URL for the exchange
- * @param cb function to call with the exchange's future keys result
- * @param cb_cls closure for @a cb
- * @return the request handle; NULL upon error
- */
struct TALER_EXCHANGE_ManagementGetKeysHandle *
TALER_EXCHANGE_get_management_keys (struct GNUNET_CURL_Context *ctx,
const char *url,
@@ -368,14 +360,10 @@ TALER_EXCHANGE_get_management_keys (struct GNUNET_CURL_Context *ctx,
GNUNET_free (gh);
return NULL;
}
- eh = curl_easy_init ();
+ eh = TALER_EXCHANGE_curl_easy_get_ (gh->url);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Requesting URL '%s'\n",
gh->url);
- GNUNET_assert (CURLE_OK ==
- curl_easy_setopt (eh,
- CURLOPT_URL,
- gh->url));
gh->job = GNUNET_CURL_job_add (ctx,
eh,
&handle_get_keys_finished,
@@ -389,11 +377,6 @@ TALER_EXCHANGE_get_management_keys (struct GNUNET_CURL_Context *ctx,
}
-/**
- * Cancel #TALER_EXCHANGE_get_management_keys() operation.
- *
- * @param gh handle of the operation to cancel
- */
void
TALER_EXCHANGE_get_management_keys_cancel (
struct TALER_EXCHANGE_ManagementGetKeysHandle *gh)
diff --git a/src/lib/exchange_api_management_post_keys.c b/src/lib/exchange_api_management_post_keys.c
index 6b040bdaa..d7790599a 100644
--- a/src/lib/exchange_api_management_post_keys.c
+++ b/src/lib/exchange_api_management_post_keys.c
@@ -23,6 +23,7 @@
#include "taler_json_lib.h"
#include <gnunet/gnunet_curl_lib.h>
#include "taler_exchange_service.h"
+#include "exchange_api_curl_defaults.h"
#include "taler_signatures.h"
#include "taler_curl_lib.h"
#include "taler_json_lib.h"
@@ -189,7 +190,7 @@ TALER_EXCHANGE_post_management_keys (
denom_sigs),
GNUNET_JSON_pack_array_steal ("signkey_sigs",
signkey_sigs));
- eh = curl_easy_init ();
+ eh = TALER_EXCHANGE_curl_easy_get_ (ph->url);
GNUNET_assert (NULL != eh);
if (GNUNET_OK !=
TALER_curl_easy_post (&ph->post_ctx,
@@ -206,9 +207,6 @@ TALER_EXCHANGE_post_management_keys (
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Requesting URL '%s'\n",
ph->url);
- GNUNET_assert (CURLE_OK == curl_easy_setopt (eh,
- CURLOPT_URL,
- ph->url));
ph->job = GNUNET_CURL_job_add2 (ctx,
eh,
ph->post_ctx.headers,
diff --git a/src/lib/exchange_api_management_revoke_denomination_key.c b/src/lib/exchange_api_management_revoke_denomination_key.c
index 4a1a79d03..383d9532e 100644
--- a/src/lib/exchange_api_management_revoke_denomination_key.c
+++ b/src/lib/exchange_api_management_revoke_denomination_key.c
@@ -23,6 +23,7 @@
#include "taler_json_lib.h"
#include <gnunet/gnunet_curl_lib.h>
#include "taler_exchange_service.h"
+#include "exchange_api_curl_defaults.h"
#include "taler_signatures.h"
#include "taler_curl_lib.h"
#include "taler_json_lib.h"
@@ -173,7 +174,7 @@ TALER_EXCHANGE_management_revoke_denomination_key (
GNUNET_free (rh);
return NULL;
}
- eh = curl_easy_init ();
+ eh = TALER_EXCHANGE_curl_easy_get_ (rh->url);
if (GNUNET_OK !=
TALER_curl_easy_post (&rh->post_ctx,
eh,
@@ -189,9 +190,6 @@ TALER_EXCHANGE_management_revoke_denomination_key (
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Requesting URL '%s'\n",
rh->url);
- GNUNET_assert (CURLE_OK == curl_easy_setopt (eh,
- CURLOPT_URL,
- rh->url));
rh->job = GNUNET_CURL_job_add2 (ctx,
eh,
rh->post_ctx.headers,
diff --git a/src/lib/exchange_api_management_revoke_signing_key.c b/src/lib/exchange_api_management_revoke_signing_key.c
index f43a46c40..046d18729 100644
--- a/src/lib/exchange_api_management_revoke_signing_key.c
+++ b/src/lib/exchange_api_management_revoke_signing_key.c
@@ -23,6 +23,7 @@
#include "taler_json_lib.h"
#include <gnunet/gnunet_curl_lib.h>
#include "taler_exchange_service.h"
+#include "exchange_api_curl_defaults.h"
#include "taler_signatures.h"
#include "taler_curl_lib.h"
#include "taler_json_lib.h"
@@ -163,7 +164,7 @@ TALER_EXCHANGE_management_revoke_signing_key (
body = GNUNET_JSON_PACK (
GNUNET_JSON_pack_data_auto ("master_sig",
master_sig));
- eh = curl_easy_init ();
+ eh = TALER_EXCHANGE_curl_easy_get_ (rh->url);
GNUNET_assert (NULL != eh);
if (GNUNET_OK !=
TALER_curl_easy_post (&rh->post_ctx,
@@ -180,9 +181,6 @@ TALER_EXCHANGE_management_revoke_signing_key (
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Requesting URL '%s'\n",
rh->url);
- GNUNET_assert (CURLE_OK == curl_easy_setopt (eh,
- CURLOPT_URL,
- rh->url));
rh->job = GNUNET_CURL_job_add2 (ctx,
eh,
rh->post_ctx.headers,
diff --git a/src/lib/exchange_api_management_set_wire_fee.c b/src/lib/exchange_api_management_set_wire_fee.c
index 075dbbbba..807c6723a 100644
--- a/src/lib/exchange_api_management_set_wire_fee.c
+++ b/src/lib/exchange_api_management_set_wire_fee.c
@@ -22,6 +22,7 @@
#include "platform.h"
#include "taler_json_lib.h"
#include <gnunet/gnunet_curl_lib.h>
+#include "exchange_api_curl_defaults.h"
#include "taler_exchange_service.h"
#include "taler_signatures.h"
#include "taler_curl_lib.h"
@@ -126,8 +127,8 @@ TALER_EXCHANGE_management_set_wire_fees (
struct GNUNET_CURL_Context *ctx,
const char *exchange_base_url,
const char *wire_method,
- struct GNUNET_TIME_Absolute validity_start,
- struct GNUNET_TIME_Absolute validity_end,
+ struct GNUNET_TIME_Timestamp validity_start,
+ struct GNUNET_TIME_Timestamp validity_end,
const struct TALER_Amount *wire_fee,
const struct TALER_Amount *closing_fee,
const struct TALER_MasterSignatureP *master_sig,
@@ -157,15 +158,15 @@ TALER_EXCHANGE_management_set_wire_fees (
wire_method),
GNUNET_JSON_pack_data_auto ("master_sig",
master_sig),
- GNUNET_JSON_pack_time_abs ("fee_start",
- validity_start),
- GNUNET_JSON_pack_time_abs ("fee_end",
- validity_end),
+ GNUNET_JSON_pack_timestamp ("fee_start",
+ validity_start),
+ GNUNET_JSON_pack_timestamp ("fee_end",
+ validity_end),
TALER_JSON_pack_amount ("closing_fee",
closing_fee),
TALER_JSON_pack_amount ("wire_fee",
wire_fee));
- eh = curl_easy_init ();
+ eh = TALER_EXCHANGE_curl_easy_get_ (swfh->url);
GNUNET_assert (NULL != eh);
if (GNUNET_OK !=
TALER_curl_easy_post (&swfh->post_ctx,
@@ -182,9 +183,6 @@ TALER_EXCHANGE_management_set_wire_fees (
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Requesting URL '%s'\n",
swfh->url);
- GNUNET_assert (CURLE_OK == curl_easy_setopt (eh,
- CURLOPT_URL,
- swfh->url));
swfh->job = GNUNET_CURL_job_add2 (ctx,
eh,
swfh->post_ctx.headers,
diff --git a/src/lib/exchange_api_management_wire_disable.c b/src/lib/exchange_api_management_wire_disable.c
index fbc6626ad..3bae8e3ab 100644
--- a/src/lib/exchange_api_management_wire_disable.c
+++ b/src/lib/exchange_api_management_wire_disable.c
@@ -23,6 +23,7 @@
#include "taler_json_lib.h"
#include <gnunet/gnunet_curl_lib.h>
#include "taler_exchange_service.h"
+#include "exchange_api_curl_defaults.h"
#include "taler_signatures.h"
#include "taler_curl_lib.h"
#include "taler_json_lib.h"
@@ -131,7 +132,7 @@ TALER_EXCHANGE_management_disable_wire (
struct GNUNET_CURL_Context *ctx,
const char *url,
const char *payto_uri,
- struct GNUNET_TIME_Absolute validity_end,
+ struct GNUNET_TIME_Timestamp validity_end,
const struct TALER_MasterSignatureP *master_sig,
TALER_EXCHANGE_ManagementWireDisableCallback cb,
void *cb_cls)
@@ -159,9 +160,9 @@ TALER_EXCHANGE_management_disable_wire (
payto_uri),
GNUNET_JSON_pack_data_auto ("master_sig_del",
master_sig),
- GNUNET_JSON_pack_time_abs ("validity_end",
- validity_end));
- eh = curl_easy_init ();
+ GNUNET_JSON_pack_timestamp ("validity_end",
+ validity_end));
+ eh = TALER_EXCHANGE_curl_easy_get_ (wh->url);
GNUNET_assert (NULL != eh);
if (GNUNET_OK !=
TALER_curl_easy_post (&wh->post_ctx,
@@ -178,9 +179,6 @@ TALER_EXCHANGE_management_disable_wire (
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Requesting URL '%s'\n",
wh->url);
- GNUNET_assert (CURLE_OK == curl_easy_setopt (eh,
- CURLOPT_URL,
- wh->url));
wh->job = GNUNET_CURL_job_add2 (ctx,
eh,
wh->post_ctx.headers,
diff --git a/src/lib/exchange_api_management_wire_enable.c b/src/lib/exchange_api_management_wire_enable.c
index 43eb2ce97..c4d5b13b4 100644
--- a/src/lib/exchange_api_management_wire_enable.c
+++ b/src/lib/exchange_api_management_wire_enable.c
@@ -23,6 +23,7 @@
#include "taler_json_lib.h"
#include <gnunet/gnunet_curl_lib.h>
#include "taler_exchange_service.h"
+#include "exchange_api_curl_defaults.h"
#include "taler_signatures.h"
#include "taler_curl_lib.h"
#include "taler_json_lib.h"
@@ -127,7 +128,7 @@ TALER_EXCHANGE_management_enable_wire (
struct GNUNET_CURL_Context *ctx,
const char *url,
const char *payto_uri,
- struct GNUNET_TIME_Absolute validity_start,
+ struct GNUNET_TIME_Timestamp validity_start,
const struct TALER_MasterSignatureP *master_sig1,
const struct TALER_MasterSignatureP *master_sig2,
TALER_EXCHANGE_ManagementWireEnableCallback cb,
@@ -158,9 +159,9 @@ TALER_EXCHANGE_management_enable_wire (
master_sig1),
GNUNET_JSON_pack_data_auto ("master_sig_wire",
master_sig2),
- GNUNET_JSON_pack_time_abs ("validity_start",
- validity_start));
- eh = curl_easy_init ();
+ GNUNET_JSON_pack_timestamp ("validity_start",
+ validity_start));
+ eh = TALER_EXCHANGE_curl_easy_get_ (wh->url);
GNUNET_assert (NULL != eh);
if (GNUNET_OK !=
TALER_curl_easy_post (&wh->post_ctx,
@@ -177,9 +178,6 @@ TALER_EXCHANGE_management_enable_wire (
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Requesting URL '%s'\n",
wh->url);
- GNUNET_assert (CURLE_OK == curl_easy_setopt (eh,
- CURLOPT_URL,
- wh->url));
wh->job = GNUNET_CURL_job_add2 (ctx,
eh,
wh->post_ctx.headers,
diff --git a/src/lib/exchange_api_recoup.c b/src/lib/exchange_api_recoup.c
index d61e7eff4..92b59f4b0 100644
--- a/src/lib/exchange_api_recoup.c
+++ b/src/lib/exchange_api_recoup.c
@@ -305,6 +305,7 @@ TALER_EXCHANGE_recoup (struct TALER_EXCHANGE_Handle *exchange,
const struct TALER_EXCHANGE_DenomPublicKey *pk,
const struct TALER_DenominationSignature *denom_sig,
const struct TALER_PlanchetSecretsP *ps,
+ const struct TALER_Amount *amount,
bool was_refreshed,
TALER_EXCHANGE_RecoupResultCallback recoup_cb,
void *recoup_cb_cls)
@@ -336,6 +337,8 @@ TALER_EXCHANGE_recoup (struct TALER_EXCHANGE_Handle *exchange,
&h_denom_pub),
TALER_JSON_pack_denom_sig ("denom_sig",
denom_sig),
+ TALER_JSON_pack_amount ("amount",
+ amount),
GNUNET_JSON_pack_data_auto ("coin_sig",
&coin_sig),
GNUNET_JSON_pack_data_auto ("coin_blind_key_secret",
diff --git a/src/lib/exchange_api_refresh_common.c b/src/lib/exchange_api_refresh_common.c
index 4f2a2cf18..3e367566d 100644
--- a/src/lib/exchange_api_refresh_common.c
+++ b/src/lib/exchange_api_refresh_common.c
@@ -89,8 +89,8 @@ serialize_melted_coin (const struct MeltedCoin *mc)
&mc->original_value),
TALER_JSON_pack_amount ("melt_fee",
&mc->fee_melt),
- GNUNET_JSON_pack_time_abs ("expire_deposit",
- mc->expire_deposit),
+ GNUNET_JSON_pack_timestamp ("expire_deposit",
+ mc->expire_deposit),
GNUNET_JSON_pack_array_steal ("transfer_privs",
tprivs));
}
@@ -126,8 +126,8 @@ deserialize_melted_coin (struct MeltedCoin *mc,
TALER_JSON_spec_amount ("melt_fee",
currency,
&mc->fee_melt),
- TALER_JSON_spec_absolute_time ("expire_deposit",
- &mc->expire_deposit),
+ GNUNET_JSON_spec_timestamp ("expire_deposit",
+ &mc->expire_deposit),
GNUNET_JSON_spec_json ("transfer_privs",
&trans_privs),
GNUNET_JSON_spec_end ()
diff --git a/src/lib/exchange_api_refresh_common.h b/src/lib/exchange_api_refresh_common.h
index 7b531e701..1c037d966 100644
--- a/src/lib/exchange_api_refresh_common.h
+++ b/src/lib/exchange_api_refresh_common.h
@@ -60,7 +60,7 @@ struct MeltedCoin
/**
* Timestamp indicating when coins of this denomination become invalid.
*/
- struct GNUNET_TIME_Absolute expire_deposit;
+ struct GNUNET_TIME_Timestamp expire_deposit;
/**
* Denomination key of the original coin.
diff --git a/src/lib/exchange_api_refund.c b/src/lib/exchange_api_refund.c
index 6e9d416df..a3030e6cf 100644
--- a/src/lib/exchange_api_refund.c
+++ b/src/lib/exchange_api_refund.c
@@ -203,9 +203,9 @@ verify_conflict_history_ok (struct TALER_EXCHANGE_RefundHandle *rh,
struct TALER_PrivateContractHash h_contract_terms;
// struct TALER_ExtensionContractHash h_extensions; // FIXME!
struct TALER_DenominationHash h_denom_pub;
- struct GNUNET_TIME_Absolute wallet_timestamp;
+ struct GNUNET_TIME_Timestamp wallet_timestamp;
struct TALER_MerchantPublicKeyP merchant_pub;
- struct GNUNET_TIME_Absolute refund_deadline;
+ struct GNUNET_TIME_Timestamp refund_deadline;
struct TALER_CoinSpendSignatureP sig;
struct GNUNET_JSON_Specification ispec[] = {
GNUNET_JSON_spec_fixed_auto ("coin_sig",
@@ -216,10 +216,10 @@ verify_conflict_history_ok (struct TALER_EXCHANGE_RefundHandle *rh,
&h_wire),
GNUNET_JSON_spec_fixed_auto ("h_denom_pub",
&h_denom_pub),
- TALER_JSON_spec_absolute_time ("timestamp",
- &wallet_timestamp),
- TALER_JSON_spec_absolute_time ("refund_deadline",
- &refund_deadline),
+ GNUNET_JSON_spec_timestamp ("timestamp",
+ &wallet_timestamp),
+ GNUNET_JSON_spec_timestamp ("refund_deadline",
+ &refund_deadline),
TALER_JSON_spec_amount_any ("deposit_fee",
&deposit_fee),
GNUNET_JSON_spec_fixed_auto ("merchant_pub",
diff --git a/src/lib/exchange_api_transfers_get.c b/src/lib/exchange_api_transfers_get.c
index 87d654c05..b9a9db941 100644
--- a/src/lib/exchange_api_transfers_get.c
+++ b/src/lib/exchange_api_transfers_get.c
@@ -93,7 +93,7 @@ check_transfers_get_response_ok (
TALER_JSON_spec_amount_any ("wire_fee", &td.wire_fee),
GNUNET_JSON_spec_fixed_auto ("merchant_pub", &merchant_pub),
GNUNET_JSON_spec_fixed_auto ("h_payto", &td.h_payto),
- TALER_JSON_spec_absolute_time ("execution_time", &td.execution_time),
+ GNUNET_JSON_spec_timestamp ("execution_time", &td.execution_time),
GNUNET_JSON_spec_json ("deposits", &details_j),
GNUNET_JSON_spec_fixed_auto ("exchange_sig", &td.exchange_sig),
GNUNET_JSON_spec_fixed_auto ("exchange_pub", &td.exchange_pub),
@@ -181,7 +181,7 @@ check_transfers_get_response_ok (
struct TALER_WireDepositDetailP dd;
dd.h_contract_terms = detail->h_contract_terms;
- dd.execution_time = GNUNET_TIME_absolute_hton (td.execution_time);
+ dd.execution_time = GNUNET_TIME_timestamp_hton (td.execution_time);
dd.coin_pub = detail->coin_pub;
TALER_amount_hton (&dd.deposit_value,
&detail->coin_value);
diff --git a/src/lib/exchange_api_wire.c b/src/lib/exchange_api_wire.c
index 65d38b12a..453b576b1 100644
--- a/src/lib/exchange_api_wire.c
+++ b/src/lib/exchange_api_wire.c
@@ -147,10 +147,10 @@ parse_fees (json_t *fees)
&wa->wire_fee),
TALER_JSON_spec_amount_any ("closing_fee",
&wa->closing_fee),
- TALER_JSON_spec_absolute_time ("start_date",
- &wa->start_date),
- TALER_JSON_spec_absolute_time ("end_date",
- &wa->end_date),
+ GNUNET_JSON_spec_timestamp ("start_date",
+ &wa->start_date),
+ GNUNET_JSON_spec_timestamp ("end_date",
+ &wa->end_date),
GNUNET_JSON_spec_end ()
};