From c7e2d206bab7f06375be2154b323ad429d13a9e7 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 21 Mar 2022 03:59:31 +0100 Subject: add logic to check timestamp, revise history balance calculation logic in client --- src/include/taler_exchange_service.h | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) (limited to 'src/include/taler_exchange_service.h') diff --git a/src/include/taler_exchange_service.h b/src/include/taler_exchange_service.h index f59e1b46c..41f01c97a 100644 --- a/src/include/taler_exchange_service.h +++ b/src/include/taler_exchange_service.h @@ -1583,10 +1583,21 @@ struct TALER_EXCHANGE_ReserveStatus { /** - * Reserve balance. + * 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. */ @@ -1687,10 +1698,22 @@ struct TALER_EXCHANGE_ReserveHistory { /** - * Reserve balance. + * Reserve balance. May not be the difference between + * @e total_in and @e total_out because the @e may be truncated + * due to expiration. */ 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. */ @@ -2685,7 +2708,8 @@ TALER_EXCHANGE_verify_coin_history ( * @param history JSON array with the history * @param reserve_pub public key of the reserve to inspect * @param currency currency we expect the balance to be in - * @param[out] balance final balance + * @param[out] total_in set to value of credits to reserve + * @param[out] total_out set to value of debits from reserve * @param history_length number of entries in @a history * @param[out] rhistory array of length @a history_length, set to the * parsed history entries @@ -2699,7 +2723,8 @@ TALER_EXCHANGE_parse_reserve_history ( const json_t *history, const struct TALER_ReservePublicKeyP *reserve_pub, const char *currency, - struct TALER_Amount *balance, + struct TALER_Amount *total_in, + struct TALER_Amount *total_out, unsigned int history_length, struct TALER_EXCHANGE_ReserveHistoryEntry *rhistory); -- cgit v1.2.3