aboutsummaryrefslogtreecommitdiff
path: root/src/exchangedb/plugin_exchangedb_postgres.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/exchangedb/plugin_exchangedb_postgres.c')
-rw-r--r--src/exchangedb/plugin_exchangedb_postgres.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c
index c078d65a7..1b370ff37 100644
--- a/src/exchangedb/plugin_exchangedb_postgres.c
+++ b/src/exchangedb/plugin_exchangedb_postgres.c
@@ -1646,12 +1646,12 @@ prepare_statements (struct PostgresClosure *pg)
GNUNET_PQ_make_prepare (
"recoup_by_reserve",
"SELECT "
- " coins.coin_pub,"
- " coin_sig,"
- " coin_blind,"
- " amount_val,"
- " amount_frac,"
- " recoup_timestamp,"
+ " rc.coin_pub,"
+ " rc.coin_sig,"
+ " rc.coin_blind,"
+ " rc.amount_val,"
+ " rc.amount_frac,"
+ " rc.recoup_timestamp,"
" denoms.denom_pub_hash,"
" coins.denom_sig"
" FROM reserves res"
@@ -1659,8 +1659,10 @@ prepare_statements (struct PostgresClosure *pg)
" ON (res.reserve_uuid = ror.reserve_uuid)"
" JOIN reserves_out ro"
" ON (ror.h_blind_ev = ro.h_blind_ev)"
+ " JOIN recoup_by_reserve rbr"
+ " ON (rbr.reserve_out_serial_id = ro.reserve_out_serial_id)"
" JOIN recoup rc"
- " ON (ro.reserve_out_serial_id = rc.reserve_out_serial_id)"
+ " ON (rbr.coin_pub = rc.coin_pub)"
" JOIN known_coins coins"
" ON (rc.coin_pub = coins.coin_pub)"
" JOIN denominations denoms"