summaryrefslogtreecommitdiff
path: root/src/backenddb/plugin_merchantdb_postgres.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backenddb/plugin_merchantdb_postgres.c')
-rw-r--r--src/backenddb/plugin_merchantdb_postgres.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/backenddb/plugin_merchantdb_postgres.c b/src/backenddb/plugin_merchantdb_postgres.c
index 052851ab..836be57c 100644
--- a/src/backenddb/plugin_merchantdb_postgres.c
+++ b/src/backenddb/plugin_merchantdb_postgres.c
@@ -175,6 +175,7 @@ postgres_initialize (void *cls)
",deposit_fee_val INT8 NOT NULL"
",deposit_fee_frac INT4 NOT NULL"
",deposit_fee_curr VARCHAR(" TALER_CURRENCY_LEN_STR ") NOT NULL"
+ ",signkey_pub BYTEA NOT NULL CHECK (LENGTH(signkey_pub)=32)"
",exchange_proof BYTEA NOT NULL"
",PRIMARY KEY (transaction_id, coin_pub)"
");");
@@ -182,6 +183,7 @@ postgres_initialize (void *cls)
"CREATE TABLE IF NOT EXISTS merchant_proofs ("
" exchange_uri VARCHAR NOT NULL"
",wtid BYTEA CHECK (LENGTH(wtid)=32)"
+ ",signkey_pub BYTEA NOT NULL CHECK (LENGTH(signkey_pub)=32)"
",proof BYTEA NOT NULL"
",PRIMARY KEY (wtid, exchange_uri)"
");");
@@ -229,9 +231,10 @@ postgres_initialize (void *cls)
",deposit_fee_val"
",deposit_fee_frac"
",deposit_fee_curr"
+ ",signkey_pub"
",exchange_proof) VALUES "
- "($1, $2, $3, $4, $5, $6, $7, $8, $9)",
- 9);
+ "($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)",
+ 10);
PG_PREPARE (pg,
"insert_transfer",
"INSERT INTO merchant_transfers"
@@ -245,9 +248,10 @@ postgres_initialize (void *cls)
"INSERT INTO merchant_proofs"
"(exchange_uri"
",wtid"
+ ",signkey_pub"
",proof) VALUES "
- "($1, $2, $3)",
- 3);
+ "($1, $2, $3, $4)",
+ 4);
/* Setup prepared "SELECT" statements */
PG_PREPARE (pg,
@@ -382,6 +386,7 @@ postgres_store_transaction (void *cls,
* @param coin_pub public key of the coin
* @param amount_with_fee amount the exchange will deposit for this coin
* @param deposit_fee fee the exchange will charge for this coin
+ * @param signkey_pub public key used by the exchange for @a exchange_proof
* @param exchange_proof proof from exchange that coin was accepted
* @return #GNUNET_OK on success, #GNUNET_SYSERR upon error
*/
@@ -391,6 +396,7 @@ postgres_store_deposit (void *cls,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_Amount *amount_with_fee,
const struct TALER_Amount *deposit_fee,
+ const struct TALER_ExchangePublicKeyP *signkey_pub,
const json_t *exchange_proof)
{
struct PostgresClosure *pg = cls;
@@ -402,6 +408,7 @@ postgres_store_deposit (void *cls,
GNUNET_PQ_query_param_auto_from_type (coin_pub),
TALER_PQ_query_param_amount (amount_with_fee),
TALER_PQ_query_param_amount (deposit_fee),
+ GNUNET_PQ_query_param_auto_from_type (signkey_pub),
TALER_PQ_query_param_json (exchange_proof),
GNUNET_PQ_query_param_end
};
@@ -474,6 +481,7 @@ postgres_store_coin_to_transfer (void *cls,
* @param cls closure
* @param exchange_uri URI of the exchange
* @param wtid identifier of the wire transfer
+ * @param signkey_pub public key used by the exchange for @a exchange_proof
* @param exchange_proof proof from exchange about what the deposit was for
* @return #GNUNET_OK on success, #GNUNET_SYSERR upon error
*/
@@ -481,6 +489,7 @@ static int
postgres_store_transfer_to_proof (void *cls,
const char *exchange_uri,
const struct TALER_WireTransferIdentifierRawP *wtid,
+ const struct TALER_ExchangePublicKeyP *signkey_pub,
const json_t *exchange_proof)
{
struct PostgresClosure *pg = cls;
@@ -490,6 +499,7 @@ postgres_store_transfer_to_proof (void *cls,
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_string (exchange_uri),
GNUNET_PQ_query_param_auto_from_type (wtid),
+ GNUNET_PQ_query_param_auto_from_type (signkey_pub),
TALER_PQ_query_param_json (exchange_proof),
GNUNET_PQ_query_param_end
};