aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2023-09-18 18:59:53 +0200
committerChristian Grothoff <christian@grothoff.org>2023-09-18 18:59:53 +0200
commit12cff1b4439ab5dcc26fcf79e19518ae1bdce069 (patch)
treeb2ba500293a986475a66cde99a8bdb28e84368aa /src/include
parent612828b7ef2299769a5b525a0fbf031858edc4f4 (diff)
downloadexchange-12cff1b4439ab5dcc26fcf79e19518ae1bdce069.tar.xz
remove coin and reserve histories from exchange replies
Diffstat (limited to 'src/include')
-rw-r--r--src/include/taler_crypto_lib.h46
-rw-r--r--src/include/taler_exchange_service.h182
-rw-r--r--src/include/taler_exchangedb_plugin.h91
-rw-r--r--src/include/taler_testing_lib.h16
4 files changed, 53 insertions, 282 deletions
diff --git a/src/include/taler_crypto_lib.h b/src/include/taler_crypto_lib.h
index 67e5ff713..dfce91cdb 100644
--- a/src/include/taler_crypto_lib.h
+++ b/src/include/taler_crypto_lib.h
@@ -3854,63 +3854,59 @@ TALER_wallet_recoup_refresh_sign (
/**
* Verify reserve history request signature.
*
- * @param ts timestamp used
- * @param history_fee how much did the wallet say it would pay
+ * @param start_off start of the requested range
* @param reserve_pub reserve the history request was for
* @param reserve_sig resulting signature
* @return #GNUNET_OK if the signature is valid
*/
enum GNUNET_GenericReturnValue
TALER_wallet_reserve_history_verify (
- const struct GNUNET_TIME_Timestamp ts,
- const struct TALER_Amount *history_fee,
+ uint64_t start_off,
const struct TALER_ReservePublicKeyP *reserve_pub,
const struct TALER_ReserveSignatureP *reserve_sig);
/**
- * Create reserve history request signature.
+ * Create reserve status request signature.
*
- * @param ts timestamp used
- * @param history_fee how much do we expect to pay
+ * @param start_off start of the requested range
* @param reserve_priv private key of the reserve the history request is for
* @param[out] reserve_sig resulting signature
*/
void
TALER_wallet_reserve_history_sign (
- const struct GNUNET_TIME_Timestamp ts,
- const struct TALER_Amount *history_fee,
+ uint64_t start_off,
const struct TALER_ReservePrivateKeyP *reserve_priv,
struct TALER_ReserveSignatureP *reserve_sig);
/**
- * Verify reserve status request signature.
+ * Verify coin history request signature.
*
- * @param ts timestamp used
- * @param reserve_pub reserve the status request was for
- * @param reserve_sig resulting signature
+ * @param start_off start of the requested range
+ * @param coin_pub coin the history request was for
+ * @param coin_sig resulting signature
* @return #GNUNET_OK if the signature is valid
*/
enum GNUNET_GenericReturnValue
-TALER_wallet_reserve_status_verify (
- const struct GNUNET_TIME_Timestamp ts,
- const struct TALER_ReservePublicKeyP *reserve_pub,
- const struct TALER_ReserveSignatureP *reserve_sig);
+TALER_wallet_coin_history_verify (
+ uint64_t start_off,
+ const struct TALER_CoinSpendPublicKeyP *coin_pub,
+ const struct TALER_CoinSpendSignatureP *coin_sig);
/**
- * Create reserve status request signature.
+ * Create coin status request signature.
*
- * @param ts timestamp used
- * @param reserve_priv private key of the reserve the status request is for
- * @param[out] reserve_sig resulting signature
+ * @param start_off start of the requested range
+ * @param coin_priv private key of the coin the history request is for
+ * @param[out] coin_sig resulting signature
*/
void
-TALER_wallet_reserve_status_sign (
- const struct GNUNET_TIME_Timestamp ts,
- const struct TALER_ReservePrivateKeyP *reserve_priv,
- struct TALER_ReserveSignatureP *reserve_sig);
+TALER_wallet_coin_history_sign (
+ uint64_t start_off,
+ const struct TALER_CoinSpendPrivateKeyP *coin_priv,
+ struct TALER_CoinSpendSignatureP *coin_sig);
/* ********************* merchant signing ************************** */
diff --git a/src/include/taler_exchange_service.h b/src/include/taler_exchange_service.h
index 730451d12..77d4f2bad 100644
--- a/src/include/taler_exchange_service.h
+++ b/src/include/taler_exchange_service.h
@@ -1171,8 +1171,11 @@ struct TALER_EXCHANGE_BatchDepositResult
*/
struct
{
- /* FIXME: returning full details is not implemented */
- // Should have 'coin_pub' here!
+ /**
+ * The coin that had a conflict.
+ */
+ struct TALER_CoinSpendPublicKeyP coin_pub;
+
} conflict;
} details;
@@ -1612,11 +1615,6 @@ enum TALER_EXCHANGE_ReserveTransactionType
TALER_EXCHANGE_RTT_CLOSING,
/**
- * Reserve history request.
- */
- TALER_EXCHANGE_RTT_HISTORY,
-
- /**
* Reserve purse merge operation.
*/
TALER_EXCHANGE_RTT_MERGE,
@@ -1651,6 +1649,13 @@ struct TALER_EXCHANGE_ReserveHistoryEntry
struct TALER_Amount amount;
/**
+ * Index of this entry in the reserve history.
+ * Useful to filter requests by starting offset.
+ * Offsets are not necessarily contiguous.
+ */
+ uint64_t entry_off;
+
+ /**
* Details depending on @e type.
*/
union
@@ -1788,25 +1793,6 @@ struct TALER_EXCHANGE_ReserveHistoryEntry
} close_details;
/**
- * Information about a history operation of the reserve.
- * @e type is #TALER_EXCHANGE_RTT_HISTORY.
- */
- struct
- {
-
- /**
- * When was the request made.
- */
- struct GNUNET_TIME_Timestamp request_timestamp;
-
- /**
- * Signature by the reserve approving the history request.
- */
- struct TALER_ReserveSignatureP reserve_sig;
-
- } history_details;
-
- /**
* Information about a merge operation on the reserve.
* @e type is #TALER_EXCHANGE_RTT_MERGE.
*/
@@ -2032,115 +2018,6 @@ TALER_EXCHANGE_reserves_get_cancel (
/**
- * @brief A /reserves/$RID/status Handle
- */
-struct TALER_EXCHANGE_ReservesStatusHandle;
-
-
-/**
- * @brief Reserve status details.
- */
-struct TALER_EXCHANGE_ReserveStatus
-{
-
- /**
- * High-level HTTP response details.
- */
- struct TALER_EXCHANGE_HttpResponse hr;
-
- /**
- * Details depending on @e hr.http_status.
- */
- union
- {
-
- /**
- * Information returned on success, if
- * @e hr.http_status is #MHD_HTTP_OK
- */
- struct
- {
-
- /**
- * Current reserve balance. May not be the difference between
- * @e total_in and @e total_out because the @e may be truncated.
- */
- struct TALER_Amount balance;
-
- /**
- * Total of all inbound transactions in @e history.
- */
- struct TALER_Amount total_in;
-
- /**
- * Total of all outbound transactions in @e history.
- */
- struct TALER_Amount total_out;
-
- /**
- * Reserve history.
- */
- const struct TALER_EXCHANGE_ReserveHistoryEntry *history;
-
- /**
- * Length of the @e history array.
- */
- unsigned int history_len;
-
- } ok;
-
- } details;
-
-};
-
-
-/**
- * Callbacks of this type are used to serve the result of submitting a
- * reserve status request to a exchange.
- *
- * @param cls closure
- * @param rs HTTP response data
- */
-typedef void
-(*TALER_EXCHANGE_ReservesStatusCallback) (
- void *cls,
- const struct TALER_EXCHANGE_ReserveStatus *rs);
-
-
-/**
- * Submit a request to obtain the reserve status.
- *
- * @param ctx curl context
- * @param url exchange base URL
- * @param keys exchange keys
- * @param reserve_priv private key of the reserve to inspect
- * @param cb the callback to call when a reply for this request is available
- * @param cb_cls closure for the above callback
- * @return a handle for this request; NULL if the inputs are invalid (i.e.
- * signatures fail to verify). In this case, the callback is not called.
- */
-struct TALER_EXCHANGE_ReservesStatusHandle *
-TALER_EXCHANGE_reserves_status (
- struct GNUNET_CURL_Context *ctx,
- const char *url,
- struct TALER_EXCHANGE_Keys *keys,
- const struct TALER_ReservePrivateKeyP *reserve_priv,
- TALER_EXCHANGE_ReservesStatusCallback cb,
- void *cb_cls);
-
-
-/**
- * Cancel a reserve status request. This function cannot be used
- * on a request handle if a response is already served for it.
- *
- * @param rsh the reserve request handle
- */
-void
-TALER_EXCHANGE_reserves_status_cancel (
- struct TALER_EXCHANGE_ReservesStatusHandle *rsh);
-
-
-/**
* @brief A /reserves/$RID/history Handle
*/
struct TALER_EXCHANGE_ReservesHistoryHandle;
@@ -2158,34 +2035,21 @@ struct TALER_EXCHANGE_ReserveHistory
struct TALER_EXCHANGE_HttpResponse hr;
/**
- * Timestamp of when we made the history request
- * (client-side).
- */
- struct GNUNET_TIME_Timestamp ts;
-
- /**
- * Reserve signature affirming the history request
- * (generated as part of the request).
- */
- const struct TALER_ReserveSignatureP *reserve_sig;
-
- /**
- * Details depending on @e hr.http_status.
+ * Details depending on @e hr.http_history.
*/
union
{
/**
* Information returned on success, if
- * @e hr.http_status is #MHD_HTTP_OK
+ * @e hr.http_history is #MHD_HTTP_OK
*/
struct
{
/**
- * Reserve balance. May not be the difference between
- * @e total_in and @e total_out because the @e may be truncated
- * due to expiration.
+ * Current reserve balance. May not be the difference between
+ * @e total_in and @e total_out because the @e may be truncated.
*/
struct TALER_Amount balance;
@@ -2236,6 +2100,7 @@ typedef void
* @param url exchange base URL
* @param keys exchange keys
* @param reserve_priv private key of the reserve to inspect
+ * @param start_off offset of the oldest history entry to exclude from the response
* @param cb the callback to call when a reply for this request is available
* @param cb_cls closure for the above callback
* @return a handle for this request; NULL if the inputs are invalid (i.e.
@@ -2247,6 +2112,7 @@ TALER_EXCHANGE_reserves_history (
const char *url,
struct TALER_EXCHANGE_Keys *keys,
const struct TALER_ReservePrivateKeyP *reserve_priv,
+ uint64_t start_off,
TALER_EXCHANGE_ReservesHistoryCallback cb,
void *cb_cls);
@@ -6866,6 +6732,18 @@ struct TALER_EXCHANGE_ReserveOpenResult
} payment_required;
+ /**
+ * Information returned if status is
+ * #MHD_HTTP_CONFLICT.
+ */
+ struct
+ {
+ /**
+ * Public key of the coin that caused the conflict.
+ */
+ struct TALER_CoinSpendPublicKeyP coin_pub;
+
+ } conflict;
/**
* Information returned if KYC is required to proceed, set if
diff --git a/src/include/taler_exchangedb_plugin.h b/src/include/taler_exchangedb_plugin.h
index 8fd9ce19f..cc71f7770 100644
--- a/src/include/taler_exchangedb_plugin.h
+++ b/src/include/taler_exchangedb_plugin.h
@@ -2740,29 +2740,6 @@ typedef enum GNUNET_GenericReturnValue
/**
- * Function called with details about
- * history requests that have been made, with
- * the goal of auditing the history request execution.
- *
- * @param cls closure
- * @param rowid unique serial ID for the deposit in our DB
- * @param history_fee fee paid for the request
- * @param ts timestamp of the request
- * @param reserve_pub reserve history was requested for
- * @param reserve_sig signature approving the @a history_fee
- * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop
- */
-typedef enum GNUNET_GenericReturnValue
-(*TALER_EXCHANGEDB_HistoryRequestCallback)(
- void *cls,
- uint64_t rowid,
- const struct TALER_Amount *history_fee,
- const struct GNUNET_TIME_Timestamp ts,
- const struct TALER_ReservePublicKeyP *reserve_pub,
- const struct TALER_ReserveSignatureP *reserve_sig);
-
-
-/**
* Function called with details about purse decisions that have been made, with
* the goal of auditing the purse's execution.
*
@@ -4249,6 +4226,7 @@ struct TALER_EXCHANGEDB_Plugin
*
* @param cls the @e cls of this struct with the plugin-specific state
* @param reserve_pub public key of the reserve
+ * @param start_off maximum starting offset in history to exclude from returning
* @param[out] balance set to the reserve balance
* @param[out] rhp set to known transaction history (NULL if reserve is unknown)
* @return transaction status
@@ -4256,32 +4234,12 @@ struct TALER_EXCHANGEDB_Plugin
enum GNUNET_DB_QueryStatus
(*get_reserve_history)(void *cls,
const struct TALER_ReservePublicKeyP *reserve_pub,
+ uint64_t start_off,
struct TALER_Amount *balance,
struct TALER_EXCHANGEDB_ReserveHistory **rhp);
/**
- * Get truncated transaction history associated with the specified
- * reserve.
- *
- * @param cls the @e cls of this struct with the plugin-specific state
- * @param reserve_pub public key of the reserve
- * @param[out] balance_in set to the total of inbound
- * transactions in the returned history
- * @param[out] balance_out set to the total of outbound
- * transactions in the returned history
- * @param[out] rhp set to known transaction history (NULL if reserve is unknown)
- * @return transaction status
- */
- enum GNUNET_DB_QueryStatus
- (*get_reserve_status)(void *cls,
- const struct TALER_ReservePublicKeyP *reserve_pub,
- struct TALER_Amount *balance_in,
- struct TALER_Amount *balance_out,
- struct TALER_EXCHANGEDB_ReserveHistory **rhp);
-
-
- /**
* The current reserve balance of the specified reserve.
*
* @param cls the @e cls of this struct with the plugin-specific state
@@ -5253,24 +5211,6 @@ struct TALER_EXCHANGEDB_Plugin
/**
- * Select history requests above @a serial_id in monotonically increasing
- * order.
- *
- * @param cls closure
- * @param serial_id highest serial ID to exclude (select strictly larger)
- * @param cb function to call on each result
- * @param cb_cls closure for @a cb
- * @return transaction status code
- */
- enum GNUNET_DB_QueryStatus
- (*select_history_requests_above_serial_id)(
- void *cls,
- uint64_t serial_id,
- TALER_EXCHANGEDB_HistoryRequestCallback cb,
- void *cb_cls);
-
-
- /**
* Select purse refunds above @a serial_id in monotonically increasing
* order.
*
@@ -6590,33 +6530,6 @@ struct TALER_EXCHANGEDB_Plugin
/**
- * Function called to persist a signature that
- * prove that the client requested an
- * account history. Debits the @a history_fee from
- * the reserve (if possible).
- *
- * @param cls the @e cls of this struct with the plugin-specific state
- * @param reserve_pub account that the history was requested for
- * @param reserve_sig signature affirming the request
- * @param request_timestamp when was the request made
- * @param history_fee how much should the @a reserve_pub be charged for the request
- * @param[out] balance_ok set to TRUE if the reserve balance
- * was sufficient
- * @param[out] idempotent set to TRUE if the request is already in the DB
- * @return transaction status code
- */
- enum GNUNET_DB_QueryStatus
- (*insert_history_request)(
- void *cls,
- const struct TALER_ReservePublicKeyP *reserve_pub,
- const struct TALER_ReserveSignatureP *reserve_sig,
- struct GNUNET_TIME_Timestamp request_timestamp,
- const struct TALER_Amount *history_fee,
- bool *balance_ok,
- bool *idempotent);
-
-
- /**
* Function called to initiate closure of an account.
*
* @param cls the @e cls of this struct with the plugin-specific state
diff --git a/src/include/taler_testing_lib.h b/src/include/taler_testing_lib.h
index 367b54bba..5506f025c 100644
--- a/src/include/taler_testing_lib.h
+++ b/src/include/taler_testing_lib.h
@@ -1290,22 +1290,6 @@ TALER_TESTING_cmd_reserve_history (const char *label,
/**
- * Create a POST "/reserves/$RID/status" command.
- *
- * @param label the command label.
- * @param reserve_reference reference to the reserve to check.
- * @param expected_balance expected balance for the reserve.
- * @param expected_response_code expected HTTP response code.
- * @return the command.
- */
-struct TALER_TESTING_Command
-TALER_TESTING_cmd_reserve_status (const char *label,
- const char *reserve_reference,
- const char *expected_balance,
- unsigned int expected_response_code);
-
-
-/**
* Create a POST "/reserves/$RID/open" command.
*
* @param label the command label.