summaryrefslogtreecommitdiff
path: root/src/exchangedb/pg_select_refunds_by_coin.c
diff options
context:
space:
mode:
authorJoseph <Joseph.xu@efrei.net>2023-01-11 05:54:49 -0500
committerJoseph <Joseph.xu@efrei.net>2023-01-11 05:55:14 -0500
commit5de648b0f6f8efba2665dd05cf3b4f45a1ac164b (patch)
treeba249130b135d170bd4f2ee6e827e26cede86ad0 /src/exchangedb/pg_select_refunds_by_coin.c
parent23626c02c7cbb980c0aa46ecc9fe3b55bbb55aa4 (diff)
downloadexchange-5de648b0f6f8efba2665dd05cf3b4f45a1ac164b.tar.gz
exchange-5de648b0f6f8efba2665dd05cf3b4f45a1ac164b.tar.bz2
exchange-5de648b0f6f8efba2665dd05cf3b4f45a1ac164b.zip
new functions for inserting into link_data ready_deposit refunds
Diffstat (limited to 'src/exchangedb/pg_select_refunds_by_coin.c')
-rw-r--r--src/exchangedb/pg_select_refunds_by_coin.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/src/exchangedb/pg_select_refunds_by_coin.c b/src/exchangedb/pg_select_refunds_by_coin.c
index 84b63a719..b9db2b709 100644
--- a/src/exchangedb/pg_select_refunds_by_coin.c
+++ b/src/exchangedb/pg_select_refunds_by_coin.c
@@ -140,16 +140,25 @@ TEH_PG_select_refunds_by_coin (
"get_refunds_by_coin_and_contract",
"WITH rc AS MATERIALIZED("
"SELECT"
- " * FROM refunds ref"
- "WHERE ref.coin_pub=$1"
- "AND dep.merchant_pub=$2"
- "AND dep.h_contract_terms=$3"
- ")"
+ " amount_with_fee_val"
+ ",amount_with_fee_frac"
+ ",coin_pub"
+ ",deposit_serial_id"
+ " FROM refunds ref"
+ " WHERE ref.coin_pub=$1)"
"SELECT"
- " ref.amount_with_fee_val"
- " ,ref.amount_with_fee_frac"
- "FROM deposits dep"
- "JOIN rc"
+ " rc.amount_with_fee_val"
+ " ,rc.amount_with_fee_frac"
+ " FROM "
+ "(SELECT"
+ " rc.amount_with_fee_val"
+ " ,rc.amount_with_fee_frac"
+ " FROM deposits dep"
+ " WHERE"
+ " dep.coin_pub = $1" // optional...
+ " AND dep.merchant_pub = $2"
+ " AND dep.h_contract_terms = $3) dep"
+ " JOIN rc"
" USING (coin_pub,deposit_serial_id)");
}
qs = GNUNET_PQ_eval_prepared_multi_select (pg->conn,