summaryrefslogtreecommitdiff
path: root/src/exchange
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2022-07-05 14:25:30 +0200
committerChristian Grothoff <christian@grothoff.org>2022-07-05 14:25:30 +0200
commit36a8ecd4c47eaaab767d679564aa4e87166fa361 (patch)
tree7d59767c322edc96ece6e996a1a5d5659010e196 /src/exchange
parentbf9b7e168bfccb7a92793b50936ac404bdfb72d9 (diff)
downloadexchange-36a8ecd4c47eaaab767d679564aa4e87166fa361.tar.gz
exchange-36a8ecd4c47eaaab767d679564aa4e87166fa361.tar.bz2
exchange-36a8ecd4c47eaaab767d679564aa4e87166fa361.zip
-implemented bounded history for reserve status requests
Diffstat (limited to 'src/exchange')
-rw-r--r--src/exchange/taler-exchange-httpd_reserves_status.c33
1 files changed, 29 insertions, 4 deletions
diff --git a/src/exchange/taler-exchange-httpd_reserves_status.c b/src/exchange/taler-exchange-httpd_reserves_status.c
index 5b7becb94..ff8a65c23 100644
--- a/src/exchange/taler-exchange-httpd_reserves_status.c
+++ b/src/exchange/taler-exchange-httpd_reserves_status.c
@@ -59,6 +59,18 @@ struct ReserveStatusContext
struct TALER_EXCHANGEDB_KycStatus kyc;
/**
+ * Sum of incoming transactions within the returned history.
+ * (currently not used).
+ */
+ struct TALER_Amount balance_in;
+
+ /**
+ * Sum of outgoing transactions within the returned history.
+ * (currently not used).
+ */
+ struct TALER_Amount balance_out;
+
+ /**
* Current reserve balance.
*/
struct TALER_Amount balance;
@@ -135,10 +147,11 @@ reserve_status_transaction (void *cls,
"inselect_wallet_status");
return qs;
}
- qs = TEH_plugin->get_reserve_history (TEH_plugin->cls,
- rsc->reserve_pub,
- &rsc->balance,
- &rsc->rh);
+ qs = TEH_plugin->get_reserve_status (TEH_plugin->cls,
+ rsc->reserve_pub,
+ &rsc->balance_in,
+ &rsc->balance_out,
+ &rsc->rh);
if (GNUNET_DB_STATUS_HARD_ERROR == qs)
{
GNUNET_break (0);
@@ -148,6 +161,18 @@ reserve_status_transaction (void *cls,
TALER_EC_GENERIC_DB_FETCH_FAILED,
"get_reserve_status");
}
+ qs = TEH_plugin->get_reserve_balance (TEH_plugin->cls,
+ rsc->reserve_pub,
+ &rsc->balance);
+ if (GNUNET_DB_STATUS_HARD_ERROR == qs)
+ {
+ GNUNET_break (0);
+ *mhd_ret
+ = TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_DB_FETCH_FAILED,
+ "get_reserve_balance");
+ }
return qs;
}