aboutsummaryrefslogtreecommitdiff
path: root/src/exchangedb
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2024-01-08 14:29:21 +0100
committerChristian Grothoff <christian@grothoff.org>2024-01-08 14:29:21 +0100
commitb26bab5ed8069ac79dda032a5167363ebb4727e7 (patch)
treec46b34b0a4db129d67ccd24e29eb937ec71b8fce /src/exchangedb
parent2b41bb8f388fa2b99cc9b1715cd9689bdd6b85a7 (diff)
also do not respond with 410 to the GET /purses//merge request
Diffstat (limited to 'src/exchangedb')
-rw-r--r--src/exchangedb/pg_select_purse.c10
-rw-r--r--src/exchangedb/pg_select_purse.h5
-rw-r--r--src/exchangedb/pg_select_purse_merge.c23
3 files changed, 23 insertions, 15 deletions
diff --git a/src/exchangedb/pg_select_purse.c b/src/exchangedb/pg_select_purse.c
index 7c0a638ac..ffccb905c 100644
--- a/src/exchangedb/pg_select_purse.c
+++ b/src/exchangedb/pg_select_purse.c
@@ -36,7 +36,8 @@ TEH_PG_select_purse (
struct TALER_Amount *deposited,
struct TALER_PrivateContractHashP *h_contract_terms,
struct GNUNET_TIME_Timestamp *merge_timestamp,
- bool *purse_deleted)
+ bool *purse_deleted,
+ bool *purse_refunded)
{
struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = {
@@ -60,6 +61,10 @@ TEH_PG_select_purse (
NULL),
GNUNET_PQ_result_spec_bool ("purse_deleted",
purse_deleted),
+ GNUNET_PQ_result_spec_allow_null (
+ GNUNET_PQ_result_spec_bool ("purse_refunded",
+ purse_refunded),
+ NULL),
GNUNET_PQ_result_spec_end
};
@@ -74,11 +79,14 @@ TEH_PG_select_purse (
",pr.balance"
",pm.merge_timestamp"
",pd.purse_sig IS NOT NULL AS purse_deleted"
+ ",pc.refunded AS purse_refunded"
" FROM purse_requests pr"
" LEFT JOIN purse_merges pm ON (pm.purse_pub = pr.purse_pub)"
+ " LEFT JOIN purse_decision pc ON (pc.purse_pub = pr.purse_pub)"
" LEFT JOIN purse_deletion pd ON (pd.purse_pub = pr.purse_pub)"
" WHERE pr.purse_pub=$1;");
*merge_timestamp = GNUNET_TIME_UNIT_FOREVER_TS;
+ *purse_refunded = false;
return GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
"select_purse",
params,
diff --git a/src/exchangedb/pg_select_purse.h b/src/exchangedb/pg_select_purse.h
index db63f0c90..8f88c5cf7 100644
--- a/src/exchangedb/pg_select_purse.h
+++ b/src/exchangedb/pg_select_purse.h
@@ -38,6 +38,7 @@
* @param[out] h_contract_terms set to hash of the contract for the purse
* @param[out] merge_timestamp set to time when the purse was merged, or NEVER if not
* @param[out] purse_deleted set to true if purse was deleted
+ * @param[out] purse_refunded set to true if purse was refunded
* @return transaction status code
*/
enum GNUNET_DB_QueryStatus
@@ -50,7 +51,7 @@ TEH_PG_select_purse (
struct TALER_Amount *deposited,
struct TALER_PrivateContractHashP *h_contract_terms,
struct GNUNET_TIME_Timestamp *merge_timestamp,
- bool *purse_deleted);
-
+ bool *purse_deleted,
+ bool *purse_refunded);
#endif
diff --git a/src/exchangedb/pg_select_purse_merge.c b/src/exchangedb/pg_select_purse_merge.c
index d58e8892f..ecc047cc5 100644
--- a/src/exchangedb/pg_select_purse_merge.c
+++ b/src/exchangedb/pg_select_purse_merge.c
@@ -41,7 +41,6 @@ TEH_PG_select_purse_merge (
GNUNET_PQ_query_param_auto_from_type (purse_pub),
GNUNET_PQ_query_param_end
};
- bool is_null;
struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_auto_from_type ("merge_sig",
merge_sig),
@@ -52,7 +51,7 @@ TEH_PG_select_purse_merge (
GNUNET_PQ_result_spec_allow_null (
GNUNET_PQ_result_spec_string ("partner_base_url",
partner_url),
- &is_null),
+ NULL),
GNUNET_PQ_result_spec_allow_null (
GNUNET_PQ_result_spec_bool ("refunded",
refunded),
@@ -61,19 +60,19 @@ TEH_PG_select_purse_merge (
};
*partner_url = NULL;
- *refunded = true;
+ *refunded = false;
PREPARE (pg,
"select_purse_merge",
"SELECT "
- " reserve_pub"
- ",merge_sig"
- ",merge_timestamp"
- ",partner_base_url"
- ",refunded"
- " FROM purse_merges"
- " LEFT JOIN purse_decision USING (purse_pub)"
- " LEFT JOIN partners USING (partner_serial_id)"
- " WHERE purse_pub=$1;");
+ " pm.reserve_pub"
+ ",pm.merge_sig"
+ ",pm.merge_timestamp"
+ ",pr.partner_base_url"
+ ",pd.refunded"
+ " FROM purse_merges pm"
+ " LEFT JOIN purse_decision pd USING (purse_pub)"
+ " LEFT JOIN partners pr USING (partner_serial_id)"
+ " WHERE pm.purse_pub=$1;");
return GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
"select_purse_merge",
params,