From 7f171e69b27d48f02acd8c79e3a173a448be7ebd Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 28 Jan 2015 15:19:06 +0100 Subject: more cleanup of mint.h --- src/mint/mint_db.h | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 79 insertions(+), 5 deletions(-) (limited to 'src/mint/mint_db.h') diff --git a/src/mint/mint_db.h b/src/mint/mint_db.h index 64d72a350..5ed5db96c 100644 --- a/src/mint/mint_db.h +++ b/src/mint/mint_db.h @@ -83,6 +83,52 @@ int TALER_MINT_DB_commit (PGconn *db_conn); + +/** + * Reserve row. Corresponds to table 'reserves' in the mint's + * database. FIXME: not sure this is how we want to store this + * information. Also, may currently used in different ways in the + * code, so we might need to separate the struct into different ones + * depending on the context it is used in. + */ +struct Reserve +{ + /** + * Signature over the purse. + * Only valid if (blind_session_missing==GNUNET_YES). + */ + struct GNUNET_CRYPTO_EddsaSignature status_sig; + + /** + * Signature with purpose TALER_SIGNATURE_PURSE. + * Only valid if (blind_session_missing==GNUNET_YES). + */ + struct GNUNET_CRYPTO_EccSignaturePurpose status_sig_purpose; + + /** + * Signing key used to sign the purse. + * Only valid if (blind_session_missing==GNUNET_YES). + */ + struct GNUNET_CRYPTO_EddsaPublicKey status_sign_pub; + + /** + * Withdraw public key, identifies the purse. + * Only the customer knows the corresponding private key. + */ + struct GNUNET_CRYPTO_EddsaPublicKey reserve_pub; + + /** + * Remaining balance in the purse. // FIXME: do not use NBO here! + */ + struct TALER_AmountNBO balance; + + /** + * Expiration date for the purse. + */ + struct GNUNET_TIME_AbsoluteNBO expiration; +}; + + int TALER_MINT_DB_get_reserve (PGconn *db_conn, const struct GNUNET_CRYPTO_EddsaPublicKey *reserve_pub, @@ -103,6 +149,9 @@ TALER_MINT_DB_update_reserve (PGconn *db_conn, int fresh); + + + int TALER_MINT_DB_insert_refresh_order (PGconn *db_conn, uint16_t newcoin_index, @@ -115,17 +164,46 @@ TALER_MINT_DB_get_refresh_session (PGconn *db_conn, struct RefreshSession *r_session); + + +/** + * FIXME + */ +struct KnownCoin +{ + struct TALER_CoinPublicInfo public_info; + + /** + * Refreshing session, only valid if + * is_refreshed==1. + */ + struct GNUNET_CRYPTO_EddsaPublicKey refresh_session_pub; + + struct TALER_Amount expended_balance; + + int is_refreshed; + +}; + + int TALER_MINT_DB_get_known_coin (PGconn *db_conn, const struct GNUNET_CRYPTO_EcdsaPublicKey *coin_pub, struct KnownCoin *known_coin); - +// FIXME: what does 'upsert' even mean!? int TALER_MINT_DB_upsert_known_coin (PGconn *db_conn, struct KnownCoin *known_coin); +int +TALER_MINT_DB_insert_known_coin (PGconn *db_conn, + const struct KnownCoin *known_coin); + + + + int @@ -262,10 +340,6 @@ TALER_MINT_DB_get_deposit (PGconn *db_conn, struct Deposit *r_deposit); -int -TALER_MINT_DB_insert_known_coin (PGconn *db_conn, - const struct KnownCoin *known_coin); - /** * Get the thread-local database-handle. -- cgit v1.2.3