diff options
Diffstat (limited to 'src/exchangedb/pg_have_deposit2.c')
-rw-r--r-- | src/exchangedb/pg_have_deposit2.c | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/src/exchangedb/pg_have_deposit2.c b/src/exchangedb/pg_have_deposit2.c index 92c300605..e00ad7490 100644 --- a/src/exchangedb/pg_have_deposit2.c +++ b/src/exchangedb/pg_have_deposit2.c @@ -70,31 +70,28 @@ TEH_PG_have_deposit2 ( GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Getting deposits for coin %s\n", TALER_B2S (coin_pub)); - - /* Fetch an existing deposit request, used to ensure idempotency - during /deposit processing. Used in #postgres_have_deposit(). */ PREPARE (pg, "get_deposit", "SELECT" - " dep.amount_with_fee_val" - ",dep.amount_with_fee_frac" - ",denominations.fee_deposit_val" - ",denominations.fee_deposit_frac" - ",dep.wallet_timestamp" - ",dep.exchange_timestamp" - ",dep.refund_deadline" - ",dep.wire_deadline" - ",dep.h_contract_terms" - ",dep.wire_salt" + " cdep.amount_with_fee" + ",denominations.fee_deposit" + ",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, |