diff options
Diffstat (limited to 'src/mint/mint_db.h')
-rw-r--r-- | src/mint/mint_db.h | 71 |
1 files changed, 70 insertions, 1 deletions
diff --git a/src/mint/mint_db.h b/src/mint/mint_db.h index 5ed5db96..b38b82b9 100644 --- a/src/mint/mint_db.h +++ b/src/mint/mint_db.h @@ -27,7 +27,6 @@ #include <microhttpd.h> #include <gnunet/gnunet_util_lib.h> #include "taler_util.h" -#include "taler-mint-httpd_db.h" #include "mint.h" @@ -329,11 +328,79 @@ int TALER_MINT_DB_prepare_deposits (PGconn *db_conn); + +/** + * Specification for a /deposit operation. + */ +struct Deposit +{ + /** + * Information about the coin that is being deposited. + */ + struct TALER_CoinPublicInfo coin; + + /** + * ECDSA signature affirming that the customer intends + * this coin to be deposited at the merchant identified + * by @e h_wire in relation to the contract identified + * by @e h_contract. + */ + struct GNUNET_CRYPTO_EcdsaSignature csig; + + /** + * Public key of the merchant. Enables later identification + * of the merchant in case of a need to rollback transactions. + */ + struct GNUNET_CRYPTO_EddsaPublicKey merchant_pub; + + /** + * Hash over the contract between merchant and customer + * (remains unknown to the Mint). + */ + struct GNUNET_HashCode h_contract; + + /** + * Hash of the (canonical) representation of @e wire, used + * to check the signature on the request. Generated by + * the mint from the detailed wire data provided by the + * merchant. + */ + struct GNUNET_HashCode h_wire; + + /** + * Detailed wire information for executing the transaction. + */ + const json_t *wire; + + /** + * Merchant-generated transaction ID to detect duplicate + * transactions. + */ + uint64_t transaction_id; + + /** + * Fraction of the coin's remaining value to be deposited. + * The coin is identified by @e coin_pub. + */ + struct TALER_Amount amount; + + /** + * Type of the deposit (also purpose of the signature). Either + * #TALER_SIGNATURE_DEPOSIT or #TALER_SIGNATURE_INCREMENTAL_DEPOSIT. + */ + uint32_t purpose; // FIXME: bad type, use ENUM! + + +}; + + int TALER_MINT_DB_insert_deposit (PGconn *db_conn, const struct Deposit *deposit); +// FIXME: with fractional deposits, we need more than +// just the coin key to lookup deposits... int TALER_MINT_DB_get_deposit (PGconn *db_conn, const struct GNUNET_CRYPTO_EcdsaPublicKey *coin_pub, @@ -341,6 +408,8 @@ TALER_MINT_DB_get_deposit (PGconn *db_conn, + + /** * Get the thread-local database-handle. * Connect to the db if the connection does not exist yet. |