diff options
author | Christian Grothoff <grothoff@gnunet.org> | 2022-03-21 03:59:31 +0100 |
---|---|---|
committer | Christian Grothoff <grothoff@gnunet.org> | 2022-03-21 03:59:31 +0100 |
commit | c7e2d206bab7f06375be2154b323ad429d13a9e7 (patch) | |
tree | 969cc459e34e9cc88074269e272fd27be38f01f5 /src/include | |
parent | 1f86b02ffa60e3817f6a7d70a654f02759e793f3 (diff) | |
download | exchange-c7e2d206bab7f06375be2154b323ad429d13a9e7.tar.xz |
add logic to check timestamp, revise history balance calculation logic in client
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/taler_exchange_service.h | 33 |
1 files changed, 29 insertions, 4 deletions
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,11 +1583,22 @@ 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. */ const struct TALER_EXCHANGE_ReserveHistoryEntry *history; @@ -1687,11 +1698,23 @@ 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. */ const struct TALER_EXCHANGE_ReserveHistoryEntry *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); |