diff options
Diffstat (limited to 'src/exchangedb/pg_do_batch_withdraw.c')
-rw-r--r-- | src/exchangedb/pg_do_batch_withdraw.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/src/exchangedb/pg_do_batch_withdraw.c b/src/exchangedb/pg_do_batch_withdraw.c index 8ef1be268..f5571ddbb 100644 --- a/src/exchangedb/pg_do_batch_withdraw.c +++ b/src/exchangedb/pg_do_batch_withdraw.c @@ -17,6 +17,7 @@ * @file exchangedb/pg_do_batch_withdraw.c * @brief Implementation of the do_batch_withdraw function for Postgres * @author Christian Grothoff + * @author Özgür Kesim */ #include "platform.h" #include "taler_error_codes.h" @@ -32,17 +33,23 @@ TEH_PG_do_batch_withdraw ( struct GNUNET_TIME_Timestamp now, const struct TALER_ReservePublicKeyP *reserve_pub, const struct TALER_Amount *amount, + bool do_age_check, bool *found, bool *balance_ok, + struct TALER_Amount *reserve_balance, + bool *age_ok, + uint16_t *allowed_maximum_age, uint64_t *ruuid) { struct PostgresClosure *pg = cls; struct GNUNET_TIME_Timestamp gc; struct GNUNET_PQ_QueryParam params[] = { - TALER_PQ_query_param_amount (amount), + TALER_PQ_query_param_amount (pg->conn, + amount), GNUNET_PQ_query_param_auto_from_type (reserve_pub), GNUNET_PQ_query_param_timestamp (&now), GNUNET_PQ_query_param_timestamp (&gc), + GNUNET_PQ_query_param_bool (do_age_check), GNUNET_PQ_query_param_end }; struct GNUNET_PQ_ResultSpec rs[] = { @@ -50,6 +57,12 @@ TEH_PG_do_batch_withdraw ( found), GNUNET_PQ_result_spec_bool ("balance_ok", balance_ok), + TALER_PQ_RESULT_SPEC_AMOUNT ("reserve_balance", + reserve_balance), + GNUNET_PQ_result_spec_bool ("age_ok", + age_ok), + GNUNET_PQ_result_spec_uint16 ("allowed_maximum_age", + allowed_maximum_age), GNUNET_PQ_result_spec_uint64 ("ruuid", ruuid), GNUNET_PQ_result_spec_end @@ -58,15 +71,14 @@ TEH_PG_do_batch_withdraw ( gc = GNUNET_TIME_absolute_to_timestamp ( GNUNET_TIME_absolute_add (now.abs_time, pg->legal_reserve_expiration_time)); - - - /* Used in #postgres_do_batch_withdraw() to - update the reserve balance and check its status */ PREPARE (pg, "call_batch_withdraw", "SELECT " " reserve_found" ",balance_ok" + ",reserve_balance" + ",age_ok" + ",allowed_maximum_age" ",ruuid" " FROM exchange_do_batch_withdraw" " ($1,$2,$3,$4,$5);"); @@ -75,4 +87,3 @@ TEH_PG_do_batch_withdraw ( params, rs); } - |