diff options
Diffstat (limited to 'src/mint/mint_db.c')
-rw-r--r-- | src/mint/mint_db.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/mint/mint_db.c b/src/mint/mint_db.c index b9f30ac3f..e029d0567 100644 --- a/src/mint/mint_db.c +++ b/src/mint/mint_db.c | |||
@@ -852,25 +852,27 @@ TALER_MINT_DB_commit (PGconn *db_conn) | |||
852 | * Get the summary of a reserve. | 852 | * Get the summary of a reserve. |
853 | * | 853 | * |
854 | * @param db the database connection handle | 854 | * @param db the database connection handle |
855 | * @param reserve_pub the public key identifying the reserve | 855 | * @param reserve the reserve data. The public key of the reserve should be set |
856 | * @param balance the amount existing in the reserve (will be filled) | 856 | * in this structure; it is used to query the database. The balance |
857 | * @param expiry expiration of the reserve (will be filled) | 857 | * and expiration are then filled accordingly. |
858 | * @return #GNUNET_OK upon success; #GNUNET_NO when the given reserve is not | 858 | * @return #GNUNET_OK upon success; #GNUNET_SYSERR upon failure |
859 | * found; #GNUNET_SYSERR upon failure | ||
860 | */ | 859 | */ |
861 | int | 860 | int |
862 | TALER_MINT_DB_reserve_get (PGconn *db, | 861 | TALER_MINT_DB_reserve_get (PGconn *db, |
863 | struct GNUNET_CRYPTO_EddsaPublicKey *reserve_pub, | 862 | struct Reserve *reserve) |
864 | struct TALER_Amount *balance, | ||
865 | struct GNUNET_TIME_Absolute *expiry) | ||
866 | { | 863 | { |
867 | PGresult *result; | 864 | PGresult *result; |
868 | uint64_t expiration_date_nbo; | 865 | uint64_t expiration_date_nbo; |
869 | struct TALER_DB_QueryParam params[] = { | 866 | struct TALER_DB_QueryParam params[] = { |
870 | TALER_DB_QUERY_PARAM_PTR(reserve_pub), | 867 | TALER_DB_QUERY_PARAM_PTR(reserve->pub), |
871 | TALER_DB_QUERY_PARAM_END | 868 | TALER_DB_QUERY_PARAM_END |
872 | }; | 869 | }; |
873 | 870 | ||
871 | if (NULL == reserve->pub) | ||
872 | { | ||
873 | GNUNET_break (0); | ||
874 | return GNUNET_SYSERR; | ||
875 | } | ||
874 | result = TALER_DB_exec_prepared (db, | 876 | result = TALER_DB_exec_prepared (db, |
875 | "get_reserve", | 877 | "get_reserve", |
876 | params); | 878 | params); |
@@ -897,8 +899,8 @@ TALER_MINT_DB_reserve_get (PGconn *db, | |||
897 | "current_balance_value", | 899 | "current_balance_value", |
898 | "current_balance_fraction", | 900 | "current_balance_fraction", |
899 | "current_balance_currency", | 901 | "current_balance_currency", |
900 | balance)); | 902 | &reserve->balance)); |
901 | expiry->abs_value_us = GNUNET_ntohll (expiration_date_nbo); | 903 | reserve->expiry.abs_value_us = GNUNET_ntohll (expiration_date_nbo); |
902 | PQclear (result); | 904 | PQclear (result); |
903 | return GNUNET_OK; | 905 | return GNUNET_OK; |
904 | 906 | ||