aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2024-08-25 13:58:51 +0200
committerChristian Grothoff <christian@grothoff.org>2024-08-25 13:58:51 +0200
commit4904bed32743084011e6c6baf5e6bf7eb1ffc75f (patch)
treefa27e2366ac464256a35119deedcd55d148b19de
parentc18a499745574aa782f6eaadadd57b49035bb799 (diff)
fix auditor-sync bugs
-rwxr-xr-xsrc/auditor/test-sync.sh2
-rw-r--r--src/exchangedb/pg_insert_records_by_table.c15
-rw-r--r--src/exchangedb/pg_lookup_records_by_table.c8
-rw-r--r--src/include/taler_exchangedb_plugin.h5
4 files changed, 21 insertions, 9 deletions
diff --git a/src/auditor/test-sync.sh b/src/auditor/test-sync.sh
index bcef908aa..9adeca5eb 100755
--- a/src/auditor/test-sync.sh
+++ b/src/auditor/test-sync.sh
@@ -71,7 +71,7 @@ function check_with_database()
-d test-sync-out.conf -t
# cs_nonce_locks excluded: no point
- for table in denominations denomination_revocations wire_targets reserves reserves_in reserves_close reserves_out auditors auditor_denom_sigs exchange_sign_keys signkey_revocations extensions policy_details policy_fulfillments known_coins refresh_commitments refresh_revealed_coins refresh_transfer_keys deposits refunds wire_out aggregation_tracking wire_fee recoup recoup_refresh
+ for table in denominations denomination_revocations wire_targets reserves reserves_in reserves_close reserves_open_requests reserves_open_deposits reserves_out auditors auditor_denom_sigs exchange_sign_keys signkey_revocations known_coins refresh_commitments refresh_revealed_coins refresh_transfer_keys batch_deposits coin_deposits refunds wire_out aggregation_tracking wire_fee recoup recoup_refresh extensions policy_details policy_fulfillments purse_requests purse_decision purse_merges purse_deposits account_merges history_requests close_requests wads_out wads_out_entries wads_in wads_in_entries profit_Drains aml_staff purse_deletion age_withdraw legitimization_measures legitimization_outcomes legitimization_processes kyc_attributes aml_history kyc_events kycauths_in
do
echo -n "."
CIN=$(echo "SELECT COUNT(*) FROM exchange.$table" | psql talercheck-in -Aqt)
diff --git a/src/exchangedb/pg_insert_records_by_table.c b/src/exchangedb/pg_insert_records_by_table.c
index 097e6275e..344c7d84c 100644
--- a/src/exchangedb/pg_insert_records_by_table.c
+++ b/src/exchangedb/pg_insert_records_by_table.c
@@ -172,10 +172,14 @@ irbt_cb_table_wire_targets (struct PostgresClosure *pg,
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_uint64 (&td->serial),
GNUNET_PQ_query_param_auto_from_type (&payto_hash),
- GNUNET_PQ_query_param_auto_from_type (
- &td->details.wire_targets.target_token),
GNUNET_PQ_query_param_string (
td->details.wire_targets.payto_uri),
+ GNUNET_PQ_query_param_auto_from_type (
+ &td->details.wire_targets.access_token),
+ td->details.wire_targets.no_account
+ ? GNUNET_PQ_query_param_null ()
+ : GNUNET_PQ_query_param_auto_from_type (
+ &td->details.wire_targets.target_pub),
GNUNET_PQ_query_param_end
};
@@ -187,10 +191,11 @@ irbt_cb_table_wire_targets (struct PostgresClosure *pg,
"INSERT INTO wire_targets"
"(wire_target_serial_id"
",wire_target_h_payto"
- ",target_token"
",payto_uri"
+ ",access_token"
+ ",target_pub"
") VALUES "
- "($1, $2, $3, $4);");
+ "($1, $2, $3, $4, $5);");
return GNUNET_PQ_eval_prepared_non_select (pg->conn,
"insert_into_table_wire_targets",
params);
@@ -1014,8 +1019,8 @@ irbt_cb_table_batch_deposits (struct PostgresClosure *pg,
",wallet_data_hash"
",wire_salt"
",wire_target_h_payto"
- ",policy_details_serial_id"
",policy_blocked"
+ ",policy_details_serial_id"
") VALUES "
"($1, $2, $3, $4, $5, $6, $7, $8, $9, $10,"
" $11, $12, $13);");
diff --git a/src/exchangedb/pg_lookup_records_by_table.c b/src/exchangedb/pg_lookup_records_by_table.c
index 52f64cf91..e8c6f8fa1 100644
--- a/src/exchangedb/pg_lookup_records_by_table.c
+++ b/src/exchangedb/pg_lookup_records_by_table.c
@@ -215,7 +215,12 @@ lrbt_cb_table_wire_targets (void *cls,
&td.serial),
GNUNET_PQ_result_spec_auto_from_type (
"access_token",
- &td.details.wire_targets.target_token),
+ &td.details.wire_targets.access_token),
+ GNUNET_PQ_result_spec_allow_null (
+ GNUNET_PQ_result_spec_auto_from_type (
+ "target_pub",
+ &td.details.wire_targets.target_pub),
+ &td.details.wire_targets.no_account),
GNUNET_PQ_result_spec_string (
"payto_uri",
&td.details.wire_targets.payto_uri),
@@ -3117,6 +3122,7 @@ TEH_PG_lookup_records_by_table (void *cls,
"SELECT"
" wire_target_serial_id AS serial"
",access_token"
+ ",target_pub"
",payto_uri"
" FROM wire_targets"
" WHERE wire_target_serial_id > $1"
diff --git a/src/include/taler_exchangedb_plugin.h b/src/include/taler_exchangedb_plugin.h
index c8444e296..be91b52fc 100644
--- a/src/include/taler_exchangedb_plugin.h
+++ b/src/include/taler_exchangedb_plugin.h
@@ -383,8 +383,9 @@ struct TALER_EXCHANGEDB_TableData
struct
{
char *payto_uri;
- struct TALER_AccountAccessTokenP target_token;
- union TALER_AccountPublicKeyP account_pub;
+ struct TALER_AccountAccessTokenP access_token;
+ union TALER_AccountPublicKeyP target_pub;
+ bool no_account;
} wire_targets;
struct