diff options
Diffstat (limited to 'src/exchangedb/pg_select_withdraw_amounts_for_kyc_check.c')
-rw-r--r-- | src/exchangedb/pg_select_withdraw_amounts_for_kyc_check.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/exchangedb/pg_select_withdraw_amounts_for_kyc_check.c b/src/exchangedb/pg_select_withdraw_amounts_for_kyc_check.c index 8875e22c7..71ed81833 100644 --- a/src/exchangedb/pg_select_withdraw_amounts_for_kyc_check.c +++ b/src/exchangedb/pg_select_withdraw_amounts_for_kyc_check.c @@ -137,13 +137,15 @@ TEH_PG_select_withdraw_amounts_for_kyc_check ( "SELECT" " ro.amount_with_fee AS amount" ",ro.execution_date AS date" - " FROM reserves_out ro" - " JOIN reserves_out_by_reserve USING (h_blind_ev)" - " JOIN reserves res ON (ro.reserve_uuid = res.reserve_uuid)" - " JOIN reserves_in ri ON (res.reserve_pub = ri.reserve_pub)" - " WHERE wire_source_h_payto=$1" + " FROM reserves_in ri" + " JOIN reserve_history rh" + " ON (rh.reserve_pub = ri.reserve_pub)" + " JOIN reserves_out ro" + " ON (ro.reserve_out_serial_id = rh.serial_id)" + " WHERE ri.wire_source_h_payto=$1" + " AND rh.table_name='reserves_out'" " AND ro.execution_date >= $2" - " ORDER BY ro.execution_date DESC"); + " ORDER BY rh.reserve_history_serial_id DESC"); qs = GNUNET_PQ_eval_prepared_multi_select ( pg->conn, "select_kyc_relevant_withdraw_events", |