summaryrefslogtreecommitdiff
path: root/src/exchangedb/pg_have_deposit2.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2023-09-10 19:13:49 +0200
committerChristian Grothoff <christian@grothoff.org>2023-09-10 19:13:49 +0200
commit852c46668f1c9f766de9473c50e787e32a0f8697 (patch)
tree6106427e8da10610507b12cd4d663f3e66d8eae7 /src/exchangedb/pg_have_deposit2.c
parentcf595fa8480e87e1522710cd8ea7db9174aa028b (diff)
downloadexchange-852c46668f1c9f766de9473c50e787e32a0f8697.tar.gz
exchange-852c46668f1c9f766de9473c50e787e32a0f8697.tar.bz2
exchange-852c46668f1c9f766de9473c50e787e32a0f8697.zip
major exchange DB schema change: store common properties of batch deposit in batch_deposits table, and coin-specific ones in coin_deposits table; plus minor cleanups
Diffstat (limited to 'src/exchangedb/pg_have_deposit2.c')
-rw-r--r--src/exchangedb/pg_have_deposit2.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/src/exchangedb/pg_have_deposit2.c b/src/exchangedb/pg_have_deposit2.c
index ccb4f5c91..e00ad7490 100644
--- a/src/exchangedb/pg_have_deposit2.c
+++ b/src/exchangedb/pg_have_deposit2.c
@@ -73,23 +73,25 @@ TEH_PG_have_deposit2 (
PREPARE (pg,
"get_deposit",
"SELECT"
- " dep.amount_with_fee"
+ " cdep.amount_with_fee"
",denominations.fee_deposit"
- ",dep.wallet_timestamp"
- ",dep.exchange_timestamp"
- ",dep.refund_deadline"
- ",dep.wire_deadline"
- ",dep.h_contract_terms"
- ",dep.wire_salt"
+ ",bdep.wallet_timestamp"
+ ",bdep.exchange_timestamp"
+ ",bdep.refund_deadline"
+ ",bdep.wire_deadline"
+ ",bdep.h_contract_terms"
+ ",bdep.wire_salt"
",wt.payto_uri AS receiver_wire_account"
- " FROM deposits dep"
- " JOIN known_coins kc ON (kc.coin_pub = dep.coin_pub)"
+ " FROM coin_deposits cdep"
+ " JOIN batch_deposits bdep USING (batch_deposit_serial_id)"
+ " JOIN known_coins kc ON (kc.coin_pub = cdep.coin_pub)"
" JOIN denominations USING (denominations_serial)"
" JOIN wire_targets wt USING (wire_target_h_payto)"
- " WHERE dep.coin_pub=$1"
- " AND dep.merchant_pub=$3"
- " AND dep.h_contract_terms=$2;");
-
+ " WHERE cdep.coin_pub=$1"
+ " AND bdep.merchant_pub=$3"
+ " AND bdep.h_contract_terms=$2;");
+ /* Note: query might be made more efficient if we computed the 'shard'
+ from merchant_pub and included that as a constraint on bdep! */
qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
"get_deposit",
params,