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 5ed5db96c..b38b82b94 100644 --- a/src/mint/mint_db.h +++ b/src/mint/mint_db.h | |||
@@ -27,7 +27,6 @@ | |||
27 | #include <microhttpd.h> | 27 | #include <microhttpd.h> |
28 | #include <gnunet/gnunet_util_lib.h> | 28 | #include <gnunet/gnunet_util_lib.h> |
29 | #include "taler_util.h" | 29 | #include "taler_util.h" |
30 | #include "taler-mint-httpd_db.h" | ||
31 | #include "mint.h" | 30 | #include "mint.h" |
32 | 31 | ||
33 | 32 | ||
@@ -329,11 +328,79 @@ int | |||
329 | TALER_MINT_DB_prepare_deposits (PGconn *db_conn); | 328 | TALER_MINT_DB_prepare_deposits (PGconn *db_conn); |
330 | 329 | ||
331 | 330 | ||
331 | |||
332 | /** | ||
333 | * Specification for a /deposit operation. | ||
334 | */ | ||
335 | struct Deposit | ||
336 | { | ||
337 | /** | ||
338 | * Information about the coin that is being deposited. | ||
339 | */ | ||
340 | struct TALER_CoinPublicInfo coin; | ||
341 | |||
342 | /** | ||
343 | * ECDSA signature affirming that the customer intends | ||
344 | * this coin to be deposited at the merchant identified | ||
345 | * by @e h_wire in relation to the contract identified | ||
346 | * by @e h_contract. | ||
347 | */ | ||
348 | struct GNUNET_CRYPTO_EcdsaSignature csig; | ||
349 | |||
350 | /** | ||
351 | * Public key of the merchant. Enables later identification | ||
352 | * of the merchant in case of a need to rollback transactions. | ||
353 | */ | ||
354 | struct GNUNET_CRYPTO_EddsaPublicKey merchant_pub; | ||
355 | |||
356 | /** | ||
357 | * Hash over the contract between merchant and customer | ||
358 | * (remains unknown to the Mint). | ||
359 | */ | ||
360 | struct GNUNET_HashCode h_contract; | ||
361 | |||
362 | /** | ||
363 | * Hash of the (canonical) representation of @e wire, used | ||
364 | * to check the signature on the request. Generated by | ||
365 | * the mint from the detailed wire data provided by the | ||
366 | * merchant. | ||
367 | */ | ||
368 | struct GNUNET_HashCode h_wire; | ||
369 | |||
370 | /** | ||
371 | * Detailed wire information for executing the transaction. | ||
372 | */ | ||
373 | const json_t *wire; | ||
374 | |||
375 | /** | ||
376 | * Merchant-generated transaction ID to detect duplicate | ||
377 | * transactions. | ||
378 | */ | ||
379 | uint64_t transaction_id; | ||
380 | |||
381 | /** | ||
382 | * Fraction of the coin's remaining value to be deposited. | ||
383 | * The coin is identified by @e coin_pub. | ||
384 | */ | ||
385 | struct TALER_Amount amount; | ||
386 | |||
387 | /** | ||
388 | * Type of the deposit (also purpose of the signature). Either | ||
389 | * #TALER_SIGNATURE_DEPOSIT or #TALER_SIGNATURE_INCREMENTAL_DEPOSIT. | ||
390 | */ | ||
391 | uint32_t purpose; // FIXME: bad type, use ENUM! | ||
392 | |||
393 | |||
394 | }; | ||
395 | |||
396 | |||
332 | int | 397 | int |
333 | TALER_MINT_DB_insert_deposit (PGconn *db_conn, | 398 | TALER_MINT_DB_insert_deposit (PGconn *db_conn, |
334 | const struct Deposit *deposit); | 399 | const struct Deposit *deposit); |
335 | 400 | ||
336 | 401 | ||
402 | // FIXME: with fractional deposits, we need more than | ||
403 | // just the coin key to lookup deposits... | ||
337 | int | 404 | int |
338 | TALER_MINT_DB_get_deposit (PGconn *db_conn, | 405 | TALER_MINT_DB_get_deposit (PGconn *db_conn, |
339 | const struct GNUNET_CRYPTO_EcdsaPublicKey *coin_pub, | 406 | const struct GNUNET_CRYPTO_EcdsaPublicKey *coin_pub, |
@@ -341,6 +408,8 @@ TALER_MINT_DB_get_deposit (PGconn *db_conn, | |||
341 | 408 | ||
342 | 409 | ||
343 | 410 | ||
411 | |||
412 | |||
344 | /** | 413 | /** |
345 | * Get the thread-local database-handle. | 414 | * Get the thread-local database-handle. |
346 | * Connect to the db if the connection does not exist yet. | 415 | * Connect to the db if the connection does not exist yet. |