aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <grothoff@gnunet.org>2024-03-08 18:43:54 +0100
committerChristian Grothoff <grothoff@gnunet.org>2024-03-08 18:43:54 +0100
commit9a5a961622c22e26d0378279c1b5fdaa886c6063 (patch)
tree1767051f4154eeea2aa8c6058ec245948746f0f1 /src
parent2c3d548b4850b96275d73a9703b076d37551a706 (diff)
fix account update failing to persist wire signature and then breaking that wire account for good
Diffstat (limited to 'src')
-rw-r--r--src/exchange/taler-exchange-httpd_management_wire_disable.c3
-rw-r--r--src/exchange/taler-exchange-httpd_management_wire_enable.c3
-rw-r--r--src/exchangedb/pg_update_wire.c5
-rw-r--r--src/exchangedb/pg_update_wire.h2
-rw-r--r--src/include/taler_exchangedb_plugin.h2
5 files changed, 13 insertions, 2 deletions
diff --git a/src/exchange/taler-exchange-httpd_management_wire_disable.c b/src/exchange/taler-exchange-httpd_management_wire_disable.c
index d3015fb68..53bece61c 100644
--- a/src/exchange/taler-exchange-httpd_management_wire_disable.c
+++ b/src/exchange/taler-exchange-httpd_management_wire_disable.c
@@ -103,7 +103,7 @@ del_wire (void *cls,
NULL);
return GNUNET_DB_STATUS_HARD_ERROR;
}
- if (0 == qs)
+ if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
{
*mhd_ret = TALER_MHD_reply_with_error (
connection,
@@ -118,6 +118,7 @@ del_wire (void *cls,
NULL,
NULL,
awc->validity_end,
+ NULL,
false);
if (qs < 0)
{
diff --git a/src/exchange/taler-exchange-httpd_management_wire_enable.c b/src/exchange/taler-exchange-httpd_management_wire_enable.c
index ca5b4ee78..e7c771cc2 100644
--- a/src/exchange/taler-exchange-httpd_management_wire_enable.c
+++ b/src/exchange/taler-exchange-httpd_management_wire_enable.c
@@ -126,7 +126,7 @@ add_wire (void *cls,
NULL);
return GNUNET_DB_STATUS_HARD_ERROR;
}
- if (0 == qs)
+ if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
qs = TEH_plugin->insert_wire (TEH_plugin->cls,
awc->payto_uri,
awc->conversion_url,
@@ -141,6 +141,7 @@ add_wire (void *cls,
awc->debit_restrictions,
awc->credit_restrictions,
awc->validity_start,
+ &awc->master_sig_wire,
true);
if (qs < 0)
{
diff --git a/src/exchangedb/pg_update_wire.c b/src/exchangedb/pg_update_wire.c
index f3b074686..439c92d4f 100644
--- a/src/exchangedb/pg_update_wire.c
+++ b/src/exchangedb/pg_update_wire.c
@@ -33,6 +33,7 @@ TEH_PG_update_wire (void *cls,
const json_t *debit_restrictions,
const json_t *credit_restrictions,
struct GNUNET_TIME_Timestamp change_date,
+ const struct TALER_MasterSignatureP *master_sig,
bool enabled)
{
struct PostgresClosure *pg = cls;
@@ -49,6 +50,9 @@ TEH_PG_update_wire (void *cls,
? TALER_PQ_query_param_json (credit_restrictions)
: GNUNET_PQ_query_param_null (),
GNUNET_PQ_query_param_timestamp (&change_date),
+ NULL == master_sig
+ ? GNUNET_PQ_query_param_null ()
+ : GNUNET_PQ_query_param_auto_from_type (master_sig),
GNUNET_PQ_query_param_end
};
@@ -61,6 +65,7 @@ TEH_PG_update_wire (void *cls,
" ,debit_restrictions=$4"
" ,credit_restrictions=$5"
" ,last_change=$6"
+ " ,master_sig=$7"
" WHERE payto_uri=$1");
return GNUNET_PQ_eval_prepared_non_select (pg->conn,
"update_wire",
diff --git a/src/exchangedb/pg_update_wire.h b/src/exchangedb/pg_update_wire.h
index ecdbc405a..9c30816e6 100644
--- a/src/exchangedb/pg_update_wire.h
+++ b/src/exchangedb/pg_update_wire.h
@@ -36,6 +36,7 @@
* @param credit_restrictions JSON array with credit restrictions on the account; NULL allowed if not @a enabled
* @param change_date date when the account status was last changed
* (only to be used for replay detection)
+ * @param master_sig master signature to store, can be NULL (if @a enabled is false)
* @param enabled true to enable, false to disable (the actual change)
* @return transaction status code
*/
@@ -46,6 +47,7 @@ TEH_PG_update_wire (void *cls,
const json_t *debit_restrictions,
const json_t *credit_restrictions,
struct GNUNET_TIME_Timestamp change_date,
+ const struct TALER_MasterSignatureP *master_sig,
bool enabled);
#endif
diff --git a/src/include/taler_exchangedb_plugin.h b/src/include/taler_exchangedb_plugin.h
index 5cd63f2bf..ccfacafc4 100644
--- a/src/include/taler_exchangedb_plugin.h
+++ b/src/include/taler_exchangedb_plugin.h
@@ -5785,6 +5785,7 @@ struct TALER_EXCHANGEDB_Plugin
* @param credit_restrictions JSON array with credit restrictions on the account; NULL allowed if not @a enabled
* @param change_date date when the account status was last changed
* (only to be used for replay detection)
+ * @param master_sig master signature to store, can be NULL (if @a enabled is false)
* @param enabled true to enable, false to disable (the actual change)
* @return transaction status code
*/
@@ -5795,6 +5796,7 @@ struct TALER_EXCHANGEDB_Plugin
const json_t *debit_restrictions,
const json_t *credit_restrictions,
struct GNUNET_TIME_Timestamp change_date,
+ const struct TALER_MasterSignatureP *master_sig,
bool enabled);