diff options
Diffstat (limited to 'src/auditordb')
121 files changed, 1946 insertions, 435 deletions
diff --git a/src/auditordb/0002-auditor_amount_arithmetic_inconsistency.sql b/src/auditordb/0002-auditor_amount_arithmetic_inconsistency.sql index 89ed5163c..776fd1f69 100644 --- a/src/auditordb/0002-auditor_amount_arithmetic_inconsistency.sql +++ b/src/auditordb/0002-auditor_amount_arithmetic_inconsistency.sql @@ -21,7 +21,7 @@ CREATE TABLE auditor_amount_arithmetic_inconsistency row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE PRIMARY KEY,
-- TODO: correct constraintcheck, currently wrong
--operation BYTEA NOT NULL CHECK (LENGTH(operation)=16),
- operation BYTEA NOT NULL,
+ operation TEXT NOT NULL,
exchange_amount taler_amount,
auditor_amount taler_amount,
profitable BOOLEAN,
diff --git a/src/auditordb/0002-auditor_balances.sql b/src/auditordb/0002-auditor_balances.sql index 7692bf50b..dad3d0873 100644 --- a/src/auditordb/0002-auditor_balances.sql +++ b/src/auditordb/0002-auditor_balances.sql @@ -16,6 +16,7 @@ CREATE TABLE IF NOT EXISTS auditor_balances ( + row_id BIGINT GENERATED BY DEFAULT AS IDENTITY, balance_key TEXT PRIMARY KEY NOT NULL ,balance_value taler_amount, suppressed BOOLEAN NOT NULL DEFAULT FALSE diff --git a/src/auditordb/0002-auditor_emergency_by_count.sql b/src/auditordb/0002-auditor_emergency_by_count.sql index 7e97b53c3..c217a61d4 100644 --- a/src/auditordb/0002-auditor_emergency_by_count.sql +++ b/src/auditordb/0002-auditor_emergency_by_count.sql @@ -19,8 +19,8 @@ CREATE TABLE IF NOT EXISTS auditor_emergency_by_count (
row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE PRIMARY KEY,
denompub_h BYTEA,
- num_issued integer,
- num_known integer,
+ num_issued BIGINT,
+ num_known BIGINT,
risk taler_amount,
start BIGINT,
deposit_end BIGINT,
diff --git a/src/auditordb/0002-auditor_historic_reserve_summary.sql b/src/auditordb/0002-auditor_historic_reserve_summary.sql index a81abb832..a598ebd92 100644 --- a/src/auditordb/0002-auditor_historic_reserve_summary.sql +++ b/src/auditordb/0002-auditor_historic_reserve_summary.sql @@ -16,7 +16,9 @@ SET search_path TO auditor; CREATE TABLE IF NOT EXISTS auditor_historic_reserve_summary - (start_date INT8 PRIMARY KEY + ( + row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE, + start_date INT8 PRIMARY KEY ,end_date INT8 NOT NULL ,reserve_profits taler_amount NOT NULL, suppressed BOOLEAN NOT NULL DEFAULT FALSE diff --git a/src/auditordb/Makefile.am b/src/auditordb/Makefile.am index 0dc499d35..d262df5cf 100644 --- a/src/auditordb/Makefile.am +++ b/src/auditordb/Makefile.am @@ -192,7 +192,15 @@ pg_get_row_minor_inconsistencies.c pg_get_row_minor_inconsistencies.h \ pg_del_row_minor_inconsistencies.c pg_del_row_minor_inconsistencies.h \ pg_insert_row_minor_inconsistencies.c pg_insert_row_minor_inconsistencies.h \ pg_update_row_minor_inconsistencies.c pg_update_row_minor_inconsistencies.h \ -pg_del_auditor_progress.c pg_del_auditor_progress.h +pg_del_auditor_progress.c pg_del_auditor_progress.h \ +pg_get_fee_time_inconsistency.c pg_get_fee_time_inconsistency.h \ +pg_del_fee_time_inconsistency.c pg_del_fee_time_inconsistency.h \ +pg_insert_fee_time_inconsistency.c pg_insert_fee_time_inconsistency.h \ +pg_update_fee_time_inconsistency.c pg_update_fee_time_inconsistency.h \ +pg_get_balances.c pg_get_balances.h \ +pg_del_balances.c pg_del_balances.h \ +pg_insert_balances.c pg_insert_balances.h \ +pg_update_balances.c pg_update_balances.h libtaler_plugin_auditordb_postgres_la_LDFLAGS = \ $(TALER_PLUGIN_LDFLAGS) libtaler_plugin_auditordb_postgres_la_LIBADD = \ diff --git a/src/auditordb/pg_del_amount_arithmetic_inconsistency.c b/src/auditordb/pg_del_amount_arithmetic_inconsistency.c index 42dd2d2b1..5af3bdda7 100644 --- a/src/auditordb/pg_del_amount_arithmetic_inconsistency.c +++ b/src/auditordb/pg_del_amount_arithmetic_inconsistency.c @@ -1,6 +1,18 @@ -// -// Created by parallels on 21/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "pg_del_amount_arithmetic_inconsistency.h" diff --git a/src/auditordb/pg_del_amount_arithmetic_inconsistency.h b/src/auditordb/pg_del_amount_arithmetic_inconsistency.h index bf253617d..ff7f12cf2 100644 --- a/src/auditordb/pg_del_amount_arithmetic_inconsistency.h +++ b/src/auditordb/pg_del_amount_arithmetic_inconsistency.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 21/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_DEL_AMOUNT_ARITHMETIC_INCONSISTENCY_H #define SRC_PG_DEL_AMOUNT_ARITHMETIC_INCONSISTENCY_H diff --git a/src/auditordb/pg_del_auditor_closure_lags.c b/src/auditordb/pg_del_auditor_closure_lags.c index dd12f1b73..89f230af3 100644 --- a/src/auditordb/pg_del_auditor_closure_lags.c +++ b/src/auditordb/pg_del_auditor_closure_lags.c @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "pg_del_auditor_closure_lags.h" diff --git a/src/auditordb/pg_del_auditor_closure_lags.h b/src/auditordb/pg_del_auditor_closure_lags.h index a0f885f1b..7c6f2db51 100644 --- a/src/auditordb/pg_del_auditor_closure_lags.h +++ b/src/auditordb/pg_del_auditor_closure_lags.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_DEL_AUDITOR_CLOSURE_LAGS_H #define SRC_PG_DEL_AUDITOR_CLOSURE_LAGS_H diff --git a/src/auditordb/pg_del_auditor_emergency.c b/src/auditordb/pg_del_auditor_emergency.c index 6fb274990..a4afd14c5 100644 --- a/src/auditordb/pg_del_auditor_emergency.c +++ b/src/auditordb/pg_del_auditor_emergency.c @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "pg_del_auditor_emergency.h" diff --git a/src/auditordb/pg_del_auditor_emergency.h b/src/auditordb/pg_del_auditor_emergency.h index 1d893255b..94c8bc4e9 100644 --- a/src/auditordb/pg_del_auditor_emergency.h +++ b/src/auditordb/pg_del_auditor_emergency.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_DEL_AUDITOR_EMERGENCY_H #define SRC_PG_DEL_AUDITOR_EMERGENCY_H diff --git a/src/auditordb/pg_del_auditor_progress.c b/src/auditordb/pg_del_auditor_progress.c index 38034548d..087e2783c 100644 --- a/src/auditordb/pg_del_auditor_progress.c +++ b/src/auditordb/pg_del_auditor_progress.c @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "pg_del_auditor_progress.h" diff --git a/src/auditordb/pg_del_auditor_progress.h b/src/auditordb/pg_del_auditor_progress.h index a4b7542c3..51e974040 100644 --- a/src/auditordb/pg_del_auditor_progress.h +++ b/src/auditordb/pg_del_auditor_progress.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_DEL_AUDITOR_PROGRESS_H #define SRC_PG_DEL_AUDITOR_PROGRESS_H diff --git a/src/auditordb/pg_del_bad_sig_losses.c b/src/auditordb/pg_del_bad_sig_losses.c index b8fe175f9..2bf48642c 100644 --- a/src/auditordb/pg_del_bad_sig_losses.c +++ b/src/auditordb/pg_del_bad_sig_losses.c @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "pg_del_bad_sig_losses.h" diff --git a/src/auditordb/pg_del_bad_sig_losses.h b/src/auditordb/pg_del_bad_sig_losses.h index 0579b64c0..4881e8715 100644 --- a/src/auditordb/pg_del_bad_sig_losses.h +++ b/src/auditordb/pg_del_bad_sig_losses.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_DEL_BAD_SIG_LOSSES_H #define SRC_PG_DEL_BAD_SIG_LOSSES_H diff --git a/src/auditordb/pg_del_balances.c b/src/auditordb/pg_del_balances.c new file mode 100644 index 000000000..9cdf9e2ea --- /dev/null +++ b/src/auditordb/pg_del_balances.c @@ -0,0 +1,42 @@ +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ + + +#include "pg_del_balances.h" + +#include "taler_pq_lib.h" +#include "pg_helper.h" + +enum GNUNET_DB_QueryStatus +TAH_PG_del_balances ( + void *cls, + uint64_t row_id) +{ + struct PostgresClosure *pg = cls; + struct GNUNET_PQ_QueryParam params[] = { + GNUNET_PQ_query_param_uint64 (&row_id), + GNUNET_PQ_query_param_end + }; + + PREPARE (pg, + "auditor_delete_balances", + "DELETE" + " FROM auditor_balances" + " WHERE row_id=$1;"); + return GNUNET_PQ_eval_prepared_non_select (pg->conn, + "auditor_delete_balances", + params); +} diff --git a/src/auditordb/pg_del_balances.h b/src/auditordb/pg_del_balances.h new file mode 100644 index 000000000..03baebebc --- /dev/null +++ b/src/auditordb/pg_del_balances.h @@ -0,0 +1,36 @@ +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ + + +#ifndef SRC_PG_DEL_BALANCES_H +#define SRC_PG_DEL_BALANCES_H + +#include "taler_util.h" +#include "taler_auditordb_plugin.h" + +/** + * Delete a row from the bad sig losses table. + * + * @param cls the @e cls of this struct with the plugin-specific state + * @param row_id row to delete + * @return query transaction status + */ +enum GNUNET_DB_QueryStatus +TAH_PG_del_balances ( + void *cls, + uint64_t row_id); + +#endif // SRC_PG_DEL_BALANCES_H diff --git a/src/auditordb/pg_del_coin_inconsistency.c b/src/auditordb/pg_del_coin_inconsistency.c index 9d9265ebb..d1426c955 100644 --- a/src/auditordb/pg_del_coin_inconsistency.c +++ b/src/auditordb/pg_del_coin_inconsistency.c @@ -1,6 +1,18 @@ -// -// Created by parallels on 21/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "pg_del_coin_inconsistency.h" diff --git a/src/auditordb/pg_del_coin_inconsistency.h b/src/auditordb/pg_del_coin_inconsistency.h index 99be77d45..8fc43c1c5 100644 --- a/src/auditordb/pg_del_coin_inconsistency.h +++ b/src/auditordb/pg_del_coin_inconsistency.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 21/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_DEL_COIN_INCONSISTENCY_H #define SRC_PG_DEL_COIN_INCONSISTENCY_H diff --git a/src/auditordb/pg_del_denomination_key_validity_withdraw_inconsistency.c b/src/auditordb/pg_del_denomination_key_validity_withdraw_inconsistency.c index 54533854b..fa8d01580 100644 --- a/src/auditordb/pg_del_denomination_key_validity_withdraw_inconsistency.c +++ b/src/auditordb/pg_del_denomination_key_validity_withdraw_inconsistency.c @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "pg_del_denomination_key_validity_withdraw_inconsistency.h" diff --git a/src/auditordb/pg_del_denomination_key_validity_withdraw_inconsistency.h b/src/auditordb/pg_del_denomination_key_validity_withdraw_inconsistency.h index 6778ec40d..9c11dd768 100644 --- a/src/auditordb/pg_del_denomination_key_validity_withdraw_inconsistency.h +++ b/src/auditordb/pg_del_denomination_key_validity_withdraw_inconsistency.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_DEL_DENOMINATION_KEY_VALIDITY_WITHDRAW_INCONSISTENCY_H #define SRC_PG_DEL_DENOMINATION_KEY_VALIDITY_WITHDRAW_INCONSISTENCY_H diff --git a/src/auditordb/pg_del_emergency_by_count.c b/src/auditordb/pg_del_emergency_by_count.c index 418a157b5..84ab0def0 100644 --- a/src/auditordb/pg_del_emergency_by_count.c +++ b/src/auditordb/pg_del_emergency_by_count.c @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "pg_del_emergency_by_count.h" diff --git a/src/auditordb/pg_del_emergency_by_count.h b/src/auditordb/pg_del_emergency_by_count.h index 84e2205a5..734c7ae7e 100644 --- a/src/auditordb/pg_del_emergency_by_count.h +++ b/src/auditordb/pg_del_emergency_by_count.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_DEL_EMERGENCY_BY_COUNT_H #define SRC_PG_DEL_EMERGENCY_BY_COUNT_H diff --git a/src/auditordb/pg_del_fee_time_inconsistency.c b/src/auditordb/pg_del_fee_time_inconsistency.c index 7697e09f9..94fbff42f 100644 --- a/src/auditordb/pg_del_fee_time_inconsistency.c +++ b/src/auditordb/pg_del_fee_time_inconsistency.c @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "pg_del_fee_time_inconsistency.h" diff --git a/src/auditordb/pg_del_fee_time_inconsistency.h b/src/auditordb/pg_del_fee_time_inconsistency.h index 46262f5e1..49b7e253e 100644 --- a/src/auditordb/pg_del_fee_time_inconsistency.h +++ b/src/auditordb/pg_del_fee_time_inconsistency.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_DEL_FEE_TIME_INCONSISTENCY_H #define SRC_PG_DEL_FEE_TIME_INCONSISTENCY_H diff --git a/src/auditordb/pg_del_purse_not_closed_inconsistencies.c b/src/auditordb/pg_del_purse_not_closed_inconsistencies.c index 0bc9477dc..3bc82f1e9 100644 --- a/src/auditordb/pg_del_purse_not_closed_inconsistencies.c +++ b/src/auditordb/pg_del_purse_not_closed_inconsistencies.c @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "pg_del_purse_not_closed_inconsistencies.h" diff --git a/src/auditordb/pg_del_purse_not_closed_inconsistencies.h b/src/auditordb/pg_del_purse_not_closed_inconsistencies.h index 417dfd05a..25d4305e2 100644 --- a/src/auditordb/pg_del_purse_not_closed_inconsistencies.h +++ b/src/auditordb/pg_del_purse_not_closed_inconsistencies.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_DEL_PURSE_NOT_CLOSED_INCONSISTENCIES_H #define SRC_PG_DEL_PURSE_NOT_CLOSED_INCONSISTENCIES_H diff --git a/src/auditordb/pg_del_refreshes_hanging.c b/src/auditordb/pg_del_refreshes_hanging.c index cba4aa5d5..43a1cbba1 100644 --- a/src/auditordb/pg_del_refreshes_hanging.c +++ b/src/auditordb/pg_del_refreshes_hanging.c @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "pg_del_refreshes_hanging.h" diff --git a/src/auditordb/pg_del_refreshes_hanging.h b/src/auditordb/pg_del_refreshes_hanging.h index 8905514ca..f2cdee95e 100644 --- a/src/auditordb/pg_del_refreshes_hanging.h +++ b/src/auditordb/pg_del_refreshes_hanging.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_DEL_REFRESHES_HANGING_H #define SRC_PG_DEL_REFRESHES_HANGING_H diff --git a/src/auditordb/pg_del_reserve_balance_insufficient_inconsistency.c b/src/auditordb/pg_del_reserve_balance_insufficient_inconsistency.c index ea94afed0..001969e51 100644 --- a/src/auditordb/pg_del_reserve_balance_insufficient_inconsistency.c +++ b/src/auditordb/pg_del_reserve_balance_insufficient_inconsistency.c @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "pg_del_reserve_balance_insufficient_inconsistency.h" diff --git a/src/auditordb/pg_del_reserve_balance_insufficient_inconsistency.h b/src/auditordb/pg_del_reserve_balance_insufficient_inconsistency.h index 3cfab01c2..783dea493 100644 --- a/src/auditordb/pg_del_reserve_balance_insufficient_inconsistency.h +++ b/src/auditordb/pg_del_reserve_balance_insufficient_inconsistency.h @@ -1,7 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_DEL_RESERVE_BALANCE_INSUFFICIENT_INCONSISTENCY_H #define SRC_PG_DEL_RESERVE_BALANCE_INSUFFICIENT_INCONSISTENCY_H diff --git a/src/auditordb/pg_del_row_inconsistency.c b/src/auditordb/pg_del_row_inconsistency.c index d906628c9..f4ab9e068 100644 --- a/src/auditordb/pg_del_row_inconsistency.c +++ b/src/auditordb/pg_del_row_inconsistency.c @@ -1,6 +1,18 @@ -// -// Created by parallels on 21/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "pg_del_row_inconsistency.h" #include "taler_pq_lib.h" diff --git a/src/auditordb/pg_del_row_inconsistency.h b/src/auditordb/pg_del_row_inconsistency.h index 665792c3b..2584f5265 100644 --- a/src/auditordb/pg_del_row_inconsistency.h +++ b/src/auditordb/pg_del_row_inconsistency.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 21/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_DEL_ROW_INCONSISTENCY_H #define SRC_PG_DEL_ROW_INCONSISTENCY_H diff --git a/src/auditordb/pg_get_amount_arithmetic_inconsistency.c b/src/auditordb/pg_get_amount_arithmetic_inconsistency.c index a23fa40bd..4b09ee39b 100644 --- a/src/auditordb/pg_get_amount_arithmetic_inconsistency.c +++ b/src/auditordb/pg_get_amount_arithmetic_inconsistency.c @@ -1,6 +1,18 @@ -// -// Created by parallels on 19/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "platform.h" #include "taler_error_codes.h" @@ -64,8 +76,8 @@ amount_arithmetic_inconsistency_cb (void *cls, GNUNET_PQ_result_spec_uint64 ("row_id", &serial_id), // TODO: what type is this exactly - GNUNET_PQ_result_spec_auto_from_type ("operation", - &dc.operation), + GNUNET_PQ_result_spec_string ("operation", + &dc.operation), TALER_PQ_RESULT_SPEC_AMOUNT ("exchange_amount", &dc.exchange_amount), TALER_PQ_RESULT_SPEC_AMOUNT ("auditor_amount", @@ -108,13 +120,13 @@ TAH_PG_get_amount_arithmetic_inconsistency ( TALER_AUDITORDB_AmountArithmeticInconsistencyCallback cb, void *cb_cls) { - + uint64_t plimit = (uint64_t) ((limit < 0) ? -limit : limit); struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_uint64 (&offset), GNUNET_PQ_query_param_bool (return_suppressed), - GNUNET_PQ_query_param_int64 (&limit), + GNUNET_PQ_query_param_uint64 (&plimit), GNUNET_PQ_query_param_end }; struct AmountArithmeticInconsistencyContext dcc = { diff --git a/src/auditordb/pg_get_amount_arithmetic_inconsistency.h b/src/auditordb/pg_get_amount_arithmetic_inconsistency.h index 3d00cccce..7cf4260fe 100644 --- a/src/auditordb/pg_get_amount_arithmetic_inconsistency.h +++ b/src/auditordb/pg_get_amount_arithmetic_inconsistency.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 19/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_GET_AMOUNT_ARITHMETIC_INCONSISTENCY_H #define SRC_PG_GET_AMOUNT_ARITHMETIC_INCONSISTENCY_H diff --git a/src/auditordb/pg_get_auditor_closure_lags.c b/src/auditordb/pg_get_auditor_closure_lags.c index 0cf9bcf72..18a506cba 100644 --- a/src/auditordb/pg_get_auditor_closure_lags.c +++ b/src/auditordb/pg_get_auditor_closure_lags.c @@ -1,7 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "platform.h" #include "taler_error_codes.h" @@ -103,11 +114,13 @@ TAH_PG_get_auditor_closure_lags ( void *cb_cls) { + uint64_t plimit = (uint64_t) ((limit < 0) ? -limit : limit); + struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_uint64 (&offset), GNUNET_PQ_query_param_bool (return_suppressed), - GNUNET_PQ_query_param_int64 (&limit), + GNUNET_PQ_query_param_uint64 (&plimit), GNUNET_PQ_query_param_end }; diff --git a/src/auditordb/pg_get_auditor_closure_lags.h b/src/auditordb/pg_get_auditor_closure_lags.h index d94d8fa74..03822864e 100644 --- a/src/auditordb/pg_get_auditor_closure_lags.h +++ b/src/auditordb/pg_get_auditor_closure_lags.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_GET_AUDITOR_CLOSURE_LAGS_H #define SRC_PG_GET_AUDITOR_CLOSURE_LAGS_H diff --git a/src/auditordb/pg_get_bad_sig_losses.c b/src/auditordb/pg_get_bad_sig_losses.c index 7c2e8eae0..096739779 100644 --- a/src/auditordb/pg_get_bad_sig_losses.c +++ b/src/auditordb/pg_get_bad_sig_losses.c @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "platform.h" @@ -53,6 +65,8 @@ bad_sig_losses_cb (void *cls, { struct BadSigLossesContext *dcc = cls; struct PostgresClosure *pg = dcc->pg; + GNUNET_log (GNUNET_ERROR_TYPE_INFO, "---found badsiglosses...\n"); + GNUNET_log (GNUNET_ERROR_TYPE_INFO, "---num_results: %u\n", num_results); for (unsigned int i = 0; i < num_results; i++) { @@ -65,7 +79,6 @@ bad_sig_losses_cb (void *cls, GNUNET_PQ_result_spec_uint64 ("row_id", &serial_id), GNUNET_PQ_result_spec_string ("operation", &dc.operation), TALER_PQ_RESULT_SPEC_AMOUNT ("loss", &dc.loss), - GNUNET_PQ_result_spec_auto_from_type ("operation_specific_pub", &dc.operation_specific_pub), @@ -100,16 +113,42 @@ TAH_PG_get_bad_sig_losses ( void *cls, int64_t limit, uint64_t offset, - bool return_suppressed, // maybe not needed + bool return_suppressed, + bool filter_spec_pub, + struct GNUNET_CRYPTO_EddsaPublicKey op_spec_pub, + const char *op, TALER_AUDITORDB_BadSigLossesCallback cb, void *cb_cls) { + /*if true, does not filter for an operation specific key*/ + bool any_spec_pub = ! filter_spec_pub; + + /*if true, does not filter for an operation*/ + bool any_op = true; + const char *o; + + if (op != NULL) + { + any_op = false; + o = op; + } + else + { + o = ""; + } + + uint64_t plimit = (uint64_t) ((limit < 0) ? -limit : limit); + struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_uint64 (&offset), GNUNET_PQ_query_param_bool (return_suppressed), - GNUNET_PQ_query_param_int64 (&limit), + GNUNET_PQ_query_param_uint64 (&plimit), + GNUNET_PQ_query_param_bool (any_spec_pub), + GNUNET_PQ_query_param_auto_from_type (&op_spec_pub), + GNUNET_PQ_query_param_bool (any_op), + GNUNET_PQ_query_param_string (o), GNUNET_PQ_query_param_end }; struct BadSigLossesContext dcc = { @@ -129,6 +168,8 @@ TAH_PG_get_bad_sig_losses ( " FROM auditor_bad_sig_losses" " WHERE (row_id < $1)" " AND ($2 OR suppressed is false)" + " AND ($4 OR operation_specific_pub = $5)" + " AND ($6 OR operation = $7)" " ORDER BY row_id DESC" " LIMIT $3" ); @@ -142,6 +183,8 @@ TAH_PG_get_bad_sig_losses ( " FROM auditor_bad_sig_losses" " WHERE (row_id > $1)" " AND ($2 OR suppressed is false)" + " AND ($4 OR operation_specific_pub = $5)" + " AND ($6 OR operation = $7)" " ORDER BY row_id ASC" " LIMIT $3" ); diff --git a/src/auditordb/pg_get_bad_sig_losses.h b/src/auditordb/pg_get_bad_sig_losses.h index 4e5bbd98b..5694458d3 100644 --- a/src/auditordb/pg_get_bad_sig_losses.h +++ b/src/auditordb/pg_get_bad_sig_losses.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_GET_BAD_SIG_LOSSES_H #define SRC_PG_GET_BAD_SIG_LOSSES_H @@ -26,6 +38,9 @@ TAH_PG_get_bad_sig_losses ( int64_t limit, uint64_t offset, bool return_suppressed, + bool filter_spec_pub, + struct GNUNET_CRYPTO_EddsaPublicKey op_spec_pub, + const char *op, TALER_AUDITORDB_BadSigLossesCallback cb, void *cb_cls); diff --git a/src/auditordb/pg_get_balances.c b/src/auditordb/pg_get_balances.c new file mode 100644 index 000000000..717114254 --- /dev/null +++ b/src/auditordb/pg_get_balances.c @@ -0,0 +1,198 @@ +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ + + +#include "platform.h" +#include "taler_error_codes.h" +#include "taler_dbevents.h" +#include "taler_pq_lib.h" +#include "pg_helper.h" + +#include "pg_get_balances.h" + + +struct BalancesContext +{ + + /** + * Function to call for each bad sig loss. + */ + TALER_AUDITORDB_BalancesCallback cb; + + /** + * Closure for @e cb + */ + void *cb_cls; + + /** + * Plugin context. + */ + struct PostgresClosure *pg; + + /** + * Query status to return. + */ + enum GNUNET_DB_QueryStatus qs; +}; + + +/** + * Helper function for #TAH_PG_get_balances(). + * To be called with the results of a SELECT statement + * that has returned @a num_results results. + * + * @param cls closure of type `struct BalancesContext *` + * @param result the postgres result + * @param num_results the number of results in @a result + */ +static void +balances_cb (void *cls, + PGresult *result, + unsigned int num_results) +{ + struct BalancesContext *dcc = cls; + struct PostgresClosure *pg = dcc->pg; + + for (unsigned int i = 0; i < num_results; i++) + { + uint64_t serial_id; + + enum TALER_DbEventType ev; + + ev = TALER_DBEVENT_AUDITOR_NEW_PROGRESS; + + struct TALER_AUDITORDB_Balances dc; + + struct GNUNET_PQ_ResultSpec rs[] = { + + GNUNET_PQ_result_spec_uint64 ("row_id", &serial_id), + + GNUNET_PQ_result_spec_string ("balance_key", &dc.balance_key), + TALER_PQ_RESULT_SPEC_AMOUNT ("balance_value", &dc.balance_value), + GNUNET_PQ_result_spec_bool ("suppressed", &dc.suppressed), + + + GNUNET_PQ_result_spec_end + }; + enum GNUNET_GenericReturnValue rval; + + if (GNUNET_OK != + GNUNET_PQ_extract_result (result, + rs, + i)) + { + GNUNET_break (0); + dcc->qs = GNUNET_DB_STATUS_HARD_ERROR; + return; + } + + dcc->qs = i + 1; + + rval = dcc->cb (dcc->cb_cls, + serial_id, + &dc); + GNUNET_PQ_cleanup_result (rs); + if (GNUNET_OK != rval) + break; + } +} + + +enum GNUNET_DB_QueryStatus +TAH_PG_get_balances ( + void *cls, + int64_t limit, + uint64_t offset, + bool return_suppressed, + const char *balance_key, + TALER_AUDITORDB_BalancesCallback cb, + void *cb_cls) +{ + + /*if true, does not filter for a specific balance*/ + bool any_balance = true; + const char *bk; + + if (balance_key != NULL) + { + any_balance = false; + bk = balance_key; + } + else + { + bk = ""; + } + + + uint64_t plimit = (uint64_t) ((limit < 0) ? -limit : limit); + + struct PostgresClosure *pg = cls; + struct GNUNET_PQ_QueryParam params[] = { + GNUNET_PQ_query_param_uint64 (&offset), + GNUNET_PQ_query_param_bool (return_suppressed), + GNUNET_PQ_query_param_uint64 (&plimit), + GNUNET_PQ_query_param_bool (any_balance), + GNUNET_PQ_query_param_string (bk), + GNUNET_PQ_query_param_end + }; + struct BalancesContext dcc = { + .cb = cb, + .cb_cls = cb_cls, + .pg = pg + }; + enum GNUNET_DB_QueryStatus qs; + + PREPARE (pg, + "auditor_balances_get_desc", + "SELECT" + " row_id," + " balance_key," + " balance_value," + " suppressed" + " FROM auditor_balances" + " WHERE (row_id < $1)" + " AND ($2 OR suppressed is false)" + " AND ($4 OR balance_key = $5)" + " ORDER BY row_id DESC" + " LIMIT $3" + ); + PREPARE (pg, + "auditor_balances_get_asc", + "SELECT" + " row_id," + " balance_key," + " balance_value," + " suppressed" + " FROM auditor_balances" + " WHERE (row_id > $1)" + " AND ($2 OR suppressed is false)" + " AND ($4 OR balance_key = $5)" + " ORDER BY row_id ASC" + " LIMIT $3" + ); + qs = GNUNET_PQ_eval_prepared_multi_select (pg->conn, + (limit > 0) + ? "auditor_balances_get_asc" + : "auditor_balances_get_desc", + params, + &balances_cb, + &dcc); + + if (qs > 0) + return dcc.qs; + GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR != qs); + return qs; +} diff --git a/src/auditordb/pg_get_balances.h b/src/auditordb/pg_get_balances.h new file mode 100644 index 000000000..7d210d6b8 --- /dev/null +++ b/src/auditordb/pg_get_balances.h @@ -0,0 +1,46 @@ +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ + + +#ifndef SRC_PG_GET_BALANCES_H +#define SRC_PG_GET_BALANCES_H + +#include "taler_util.h" +#include "taler_json_lib.h" +#include "taler_auditordb_plugin.h" + +/** + * Get information about balances from the database. + * + * @param cls the @e cls of this struct with the plugin-specific state + * @param start_id row/serial ID where to start the iteration (0 from + * the start, exclusive, i.e. serial_ids must start from 1) + * @param return_suppressed should suppressed rows be returned anyway? + * @param cb function to call with results + * @param cb_cls closure for @a cb + * @return query result status + */ +enum GNUNET_DB_QueryStatus +TAH_PG_get_balances ( + void *cls, + int64_t limit, + uint64_t offset, + bool return_suppressed, + const char *balance_key, + TALER_AUDITORDB_BalancesCallback cb, + void *cb_cls); + +#endif // SRC_PG_GET_BALANCES_H diff --git a/src/auditordb/pg_get_coin_inconsistency.c b/src/auditordb/pg_get_coin_inconsistency.c index c29d386db..8c1f465c9 100644 --- a/src/auditordb/pg_get_coin_inconsistency.c +++ b/src/auditordb/pg_get_coin_inconsistency.c @@ -1,6 +1,18 @@ -// -// Created by parallels on 20/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "platform.h" @@ -112,13 +124,14 @@ TAH_PG_get_coin_inconsistency ( TALER_AUDITORDB_CoinInconsistencyCallback cb, void *cb_cls) { - printf ("checkpoint pg_0\n"); + + uint64_t plimit = (uint64_t) ((limit < 0) ? -limit : limit); struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_uint64 (&offset), GNUNET_PQ_query_param_bool (return_suppressed), - GNUNET_PQ_query_param_int64 (&limit), + GNUNET_PQ_query_param_uint64 (&plimit), GNUNET_PQ_query_param_end }; struct CoinInconsistencyContext dcc = { @@ -128,7 +141,6 @@ TAH_PG_get_coin_inconsistency ( }; enum GNUNET_DB_QueryStatus qs; - printf ("checkpoint pg_1\n"); PREPARE (pg, "auditor_coin_inconsistency_select_desc", diff --git a/src/auditordb/pg_get_coin_inconsistency.h b/src/auditordb/pg_get_coin_inconsistency.h index bff9b82b5..9bff05397 100644 --- a/src/auditordb/pg_get_coin_inconsistency.h +++ b/src/auditordb/pg_get_coin_inconsistency.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 20/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_GET_COIN_INCONSISTENCY_H #define SRC_PG_GET_COIN_INCONSISTENCY_H diff --git a/src/auditordb/pg_get_denomination_key_validity_withdraw_inconsistency.c b/src/auditordb/pg_get_denomination_key_validity_withdraw_inconsistency.c index 345384e11..7449f35da 100644 --- a/src/auditordb/pg_get_denomination_key_validity_withdraw_inconsistency.c +++ b/src/auditordb/pg_get_denomination_key_validity_withdraw_inconsistency.c @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "platform.h" @@ -64,7 +76,8 @@ denomination_key_validity_withdraw_inconsistency_cb (void *cls, struct GNUNET_PQ_ResultSpec rs[] = { GNUNET_PQ_result_spec_uint64 ("row_id", &serial_id), - GNUNET_PQ_result_spec_int64 ("execution_date", &dc.execution_date), + GNUNET_PQ_result_spec_absolute_time ("execution_date", + &dc.execution_date), GNUNET_PQ_result_spec_auto_from_type ("reserve_pub", &dc.reserve_pub), GNUNET_PQ_result_spec_auto_from_type ("denompub_h", &dc.denompub_h), @@ -105,11 +118,13 @@ TAH_PG_get_denomination_key_validity_withdraw_inconsistency ( void *cb_cls) { + uint64_t plimit = (uint64_t) ((limit < 0) ? -limit : limit); + struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_uint64 (&offset), GNUNET_PQ_query_param_bool (return_suppressed), - GNUNET_PQ_query_param_int64 (&limit), + GNUNET_PQ_query_param_uint64 (&plimit), GNUNET_PQ_query_param_end }; struct DenominationKeyValidityWithdrawInconsistencyContext dcc = { diff --git a/src/auditordb/pg_get_denomination_key_validity_withdraw_inconsistency.h b/src/auditordb/pg_get_denomination_key_validity_withdraw_inconsistency.h index ab40da401..199e2c364 100644 --- a/src/auditordb/pg_get_denomination_key_validity_withdraw_inconsistency.h +++ b/src/auditordb/pg_get_denomination_key_validity_withdraw_inconsistency.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_GET_DENOMINATION_KEY_VALIDITY_WITHDRAW_INCONSISTENCY_H #define SRC_PG_GET_DENOMINATION_KEY_VALIDITY_WITHDRAW_INCONSISTENCY_H diff --git a/src/auditordb/pg_get_denomination_pending.c b/src/auditordb/pg_get_denomination_pending.c index 975034189..41d586a18 100644 --- a/src/auditordb/pg_get_denomination_pending.c +++ b/src/auditordb/pg_get_denomination_pending.c @@ -122,11 +122,13 @@ TAH_PG_get_denomination_pending ( void *cb_cls) { + uint64_t plimit = (uint64_t) ((limit < 0) ? -limit : limit); + struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_uint64 (&offset), GNUNET_PQ_query_param_bool (return_suppressed), - GNUNET_PQ_query_param_int64 (&limit), + GNUNET_PQ_query_param_uint64 (&plimit), GNUNET_PQ_query_param_end }; struct DenominationPendingContext dcc = { diff --git a/src/auditordb/pg_get_denominations_without_sigs.c b/src/auditordb/pg_get_denominations_without_sigs.c index c19d704aa..2bc3e5dc0 100644 --- a/src/auditordb/pg_get_denominations_without_sigs.c +++ b/src/auditordb/pg_get_denominations_without_sigs.c @@ -78,8 +78,8 @@ denominations_without_sigs_cb (void *cls, GNUNET_PQ_result_spec_auto_from_type ("denompub_h", &dc.denompub_h), TALER_PQ_RESULT_SPEC_AMOUNT ("value", &dc.value), - GNUNET_PQ_result_spec_int64 ("start_time", &dc.start_time), - GNUNET_PQ_result_spec_int64 ("end_time", &dc.end_time), + GNUNET_PQ_result_spec_absolute_time ("start_time", &dc.start_time), + GNUNET_PQ_result_spec_absolute_time ("end_time", &dc.end_time), GNUNET_PQ_result_spec_bool ("suppressed", &dc.suppressed), @@ -119,11 +119,13 @@ TAH_PG_get_denominations_without_sigs ( void *cb_cls) { + uint64_t plimit = (uint64_t) ((limit < 0) ? -limit : limit); + struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_uint64 (&offset), GNUNET_PQ_query_param_bool (return_suppressed), - GNUNET_PQ_query_param_int64 (&limit), + GNUNET_PQ_query_param_uint64 (&plimit), GNUNET_PQ_query_param_end }; struct DenominationsWithoutSigsContext dcc = { diff --git a/src/auditordb/pg_get_deposit_confirmations.c b/src/auditordb/pg_get_deposit_confirmations.c index e5158a69d..de9817919 100644 --- a/src/auditordb/pg_get_deposit_confirmations.c +++ b/src/auditordb/pg_get_deposit_confirmations.c @@ -154,15 +154,20 @@ deposit_confirmation_cb (void *cls, enum GNUNET_DB_QueryStatus TAH_PG_get_deposit_confirmations ( void *cls, - uint64_t start_id, + int64_t limit, + uint64_t offset, bool return_suppressed, TALER_AUDITORDB_DepositConfirmationCallback cb, void *cb_cls) { + + uint64_t plimit = (uint64_t) ((limit < 0) ? -limit : limit); + struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { - GNUNET_PQ_query_param_uint64 (&start_id), + GNUNET_PQ_query_param_uint64 (&offset), GNUNET_PQ_query_param_bool (return_suppressed), + GNUNET_PQ_query_param_uint64 (&plimit), GNUNET_PQ_query_param_end }; struct DepositConfirmationContext dcc = { @@ -173,7 +178,30 @@ TAH_PG_get_deposit_confirmations ( enum GNUNET_DB_QueryStatus qs; PREPARE (pg, - "auditor_deposit_confirmation_select", + "auditor_deposit_confirmation_select_desc", + "SELECT" + " deposit_confirmation_serial_id" + ",h_contract_terms" + ",h_policy" + ",h_wire" + ",exchange_timestamp" + ",wire_deadline" + ",refund_deadline" + ",total_without_fee" + ",coin_pubs" + ",coin_sigs" + ",merchant_pub" + ",exchange_sig" + ",exchange_pub" + ",master_sig" + " FROM auditor_deposit_confirmations" + " WHERE (deposit_confirmation_serial_id < $1)" + " AND ($2 OR suppressed is false)" + " ORDER BY deposit_confirmation_serial_id DESC" + " LIMIT $3" + ); + PREPARE (pg, + "auditor_deposit_confirmation_select_asc", "SELECT" " deposit_confirmation_serial_id" ",h_contract_terms" @@ -190,10 +218,16 @@ TAH_PG_get_deposit_confirmations ( ",exchange_pub" ",master_sig" " FROM auditor_deposit_confirmations" - " WHERE deposit_confirmation_serial_id>$1" - " AND ($2 OR NOT suppressed);"); + " WHERE (deposit_confirmation_serial_id > $1)" + " AND ($2 OR suppressed is false)" + " ORDER BY deposit_confirmation_serial_id ASC" + " LIMIT $3" + ); qs = GNUNET_PQ_eval_prepared_multi_select (pg->conn, - "auditor_deposit_confirmation_select", + (limit > 0) ? + "auditor_deposit_confirmation_select_asc" + : + "auditor_deposit_confirmation_select_desc", params, &deposit_confirmation_cb, &dcc); diff --git a/src/auditordb/pg_get_deposit_confirmations.h b/src/auditordb/pg_get_deposit_confirmations.h index 6b33e9e6f..141f2a276 100644 --- a/src/auditordb/pg_get_deposit_confirmations.h +++ b/src/auditordb/pg_get_deposit_confirmations.h @@ -40,7 +40,8 @@ enum GNUNET_DB_QueryStatus TAH_PG_get_deposit_confirmations ( void *cls, - uint64_t start_id, + int64_t limit, + uint64_t offset, bool return_suppressed, TALER_AUDITORDB_DepositConfirmationCallback cb, void *cb_cls); diff --git a/src/auditordb/pg_get_emergency.c b/src/auditordb/pg_get_emergency.c index 2a7e92658..a1e615ab2 100644 --- a/src/auditordb/pg_get_emergency.c +++ b/src/auditordb/pg_get_emergency.c @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "platform.h" @@ -67,8 +79,8 @@ emergency_cb (void *cls, GNUNET_PQ_result_spec_auto_from_type ("denompub_h", &dc.denompub_h), TALER_PQ_RESULT_SPEC_AMOUNT ("denom_risk", &dc.denom_risk), TALER_PQ_RESULT_SPEC_AMOUNT ("denom_loss", &dc.denom_loss), - GNUNET_PQ_result_spec_int64 ("deposit_start", &dc.deposit_start), - GNUNET_PQ_result_spec_int64 ("deposit_end", &dc.deposit_end), + GNUNET_PQ_result_spec_absolute_time ("deposit_start", &dc.deposit_start), + GNUNET_PQ_result_spec_absolute_time ("deposit_end", &dc.deposit_end), TALER_PQ_RESULT_SPEC_AMOUNT ("value", &dc.value), GNUNET_PQ_result_spec_end }; @@ -106,10 +118,12 @@ TAH_PG_get_emergency ( void *cb_cls) { + uint64_t plimit = (uint64_t) ((limit < 0) ? -limit : limit); + struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_uint64 (&offset), - GNUNET_PQ_query_param_int64 (&limit), + GNUNET_PQ_query_param_uint64 (&plimit), GNUNET_PQ_query_param_end }; struct EmergencyContext dcc = { diff --git a/src/auditordb/pg_get_emergency.h b/src/auditordb/pg_get_emergency.h index 64415750b..09530920e 100644 --- a/src/auditordb/pg_get_emergency.h +++ b/src/auditordb/pg_get_emergency.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_GET_EMERGENCY_H #define SRC_PG_GET_EMERGENCY_H diff --git a/src/auditordb/pg_get_emergency_by_count.c b/src/auditordb/pg_get_emergency_by_count.c index 8f74a6b33..53dc0e0fa 100644 --- a/src/auditordb/pg_get_emergency_by_count.c +++ b/src/auditordb/pg_get_emergency_by_count.c @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "platform.h" @@ -69,8 +81,8 @@ emergency_by_count_cb (void *cls, GNUNET_PQ_result_spec_int64 ("num_issued", &dc.num_issued), GNUNET_PQ_result_spec_int64 ("num_known", &dc.num_known), TALER_PQ_RESULT_SPEC_AMOUNT ("risk", &dc.risk), - GNUNET_PQ_result_spec_int64 ("start", &dc.start), - GNUNET_PQ_result_spec_int64 ("deposit_end", &dc.deposit_end), + GNUNET_PQ_result_spec_absolute_time ("start", &dc.start), + GNUNET_PQ_result_spec_absolute_time ("deposit_end", &dc.deposit_end), TALER_PQ_RESULT_SPEC_AMOUNT ("value", &dc.value), GNUNET_PQ_result_spec_end @@ -109,11 +121,13 @@ TAH_PG_get_emergency_by_count ( void *cb_cls) { + uint64_t plimit = (uint64_t) ((limit < 0) ? -limit : limit); + struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_uint64 (&offset), GNUNET_PQ_query_param_bool (return_suppressed), - GNUNET_PQ_query_param_int64 (&limit), + GNUNET_PQ_query_param_uint64 (&plimit), GNUNET_PQ_query_param_end }; struct EmergencyByCountContext dcc = { diff --git a/src/auditordb/pg_get_emergency_by_count.h b/src/auditordb/pg_get_emergency_by_count.h index b6b4e0f04..2054e2aee 100644 --- a/src/auditordb/pg_get_emergency_by_count.h +++ b/src/auditordb/pg_get_emergency_by_count.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_GET_EMERGENCY_BY_COUNT_H #define SRC_PG_GET_EMERGENCY_BY_COUNT_H diff --git a/src/auditordb/pg_get_exchange_signkeys.c b/src/auditordb/pg_get_exchange_signkeys.c index 96d2d2917..27e3f17f6 100644 --- a/src/auditordb/pg_get_exchange_signkeys.c +++ b/src/auditordb/pg_get_exchange_signkeys.c @@ -120,11 +120,13 @@ TAH_PG_get_exchange_signkeys ( void *cb_cls) { + uint64_t plimit = (uint64_t) ((limit < 0) ? -limit : limit); + struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_uint64 (&offset), GNUNET_PQ_query_param_bool (return_suppressed), - GNUNET_PQ_query_param_int64 (&limit), + GNUNET_PQ_query_param_uint64 (&plimit), GNUNET_PQ_query_param_end }; struct ExchangeSignkeysContext dcc = { diff --git a/src/auditordb/pg_get_fee_time_inconsistency.c b/src/auditordb/pg_get_fee_time_inconsistency.c index e63dddfab..730d3d5e3 100644 --- a/src/auditordb/pg_get_fee_time_inconsistency.c +++ b/src/auditordb/pg_get_fee_time_inconsistency.c @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "platform.h" @@ -106,11 +118,13 @@ TAH_PG_get_fee_time_inconsistency ( void *cb_cls) { + uint64_t plimit = (uint64_t) ((limit < 0) ? -limit : limit); + struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_uint64 (&offset), GNUNET_PQ_query_param_bool (return_suppressed), - GNUNET_PQ_query_param_int64 (&limit), + GNUNET_PQ_query_param_uint64 (&plimit), GNUNET_PQ_query_param_end }; struct FeeTimeInconsistencyContext dcc = { diff --git a/src/auditordb/pg_get_fee_time_inconsistency.h b/src/auditordb/pg_get_fee_time_inconsistency.h index 7c4796b4b..8874cffff 100644 --- a/src/auditordb/pg_get_fee_time_inconsistency.h +++ b/src/auditordb/pg_get_fee_time_inconsistency.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_GET_FEE_TIME_INCONSISTENCY_H #define SRC_PG_GET_FEE_TIME_INCONSISTENCY_H diff --git a/src/auditordb/pg_get_historic_denomination_revenue.c b/src/auditordb/pg_get_historic_denomination_revenue.c index 4eea62750..eded4602d 100644 --- a/src/auditordb/pg_get_historic_denomination_revenue.c +++ b/src/auditordb/pg_get_historic_denomination_revenue.c @@ -120,11 +120,13 @@ TAH_PG_get_historic_denomination_revenue ( void *cb_cls) { + uint64_t plimit = (uint64_t) ((limit < 0) ? -limit : limit); + struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_uint64 (&offset), GNUNET_PQ_query_param_bool (return_suppressed), - GNUNET_PQ_query_param_int64 (&limit), + GNUNET_PQ_query_param_uint64 (&plimit), GNUNET_PQ_query_param_end }; struct HistoricDenominationRevenueContext dcc = { diff --git a/src/auditordb/pg_get_historic_reserve_summary.c b/src/auditordb/pg_get_historic_reserve_summary.c index 68c0724ab..0356fbedf 100644 --- a/src/auditordb/pg_get_historic_reserve_summary.c +++ b/src/auditordb/pg_get_historic_reserve_summary.c @@ -118,11 +118,13 @@ TAH_PG_get_historic_reserve_summary ( void *cb_cls) { + uint64_t plimit = (uint64_t) ((limit < 0) ? -limit : limit); + struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_uint64 (&offset), GNUNET_PQ_query_param_bool (return_suppressed), - GNUNET_PQ_query_param_int64 (&limit), + GNUNET_PQ_query_param_uint64 (&plimit), GNUNET_PQ_query_param_end }; struct HistoricReserveSummaryContext dcc = { @@ -135,6 +137,7 @@ TAH_PG_get_historic_reserve_summary ( PREPARE (pg, "auditor_historic_reserve_summary_get_desc", "SELECT" + " row_id," " start_date," " end_date," " reserve_profits," @@ -148,6 +151,7 @@ TAH_PG_get_historic_reserve_summary ( PREPARE (pg, "auditor_historic_reserve_summary_get_asc", "SELECT" + " row_id," " start_date," " end_date," " reserve_profits," diff --git a/src/auditordb/pg_get_misattribution_in_inconsistency.c b/src/auditordb/pg_get_misattribution_in_inconsistency.c index c5e990642..a091c9b64 100644 --- a/src/auditordb/pg_get_misattribution_in_inconsistency.c +++ b/src/auditordb/pg_get_misattribution_in_inconsistency.c @@ -118,11 +118,13 @@ TAH_PG_get_misattribution_in_inconsistency ( void *cb_cls) { + uint64_t plimit = (uint64_t) ((limit < 0) ? -limit : limit); + struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_uint64 (&offset), GNUNET_PQ_query_param_bool (return_suppressed), - GNUNET_PQ_query_param_int64 (&limit), + GNUNET_PQ_query_param_uint64 (&plimit), GNUNET_PQ_query_param_end }; struct MisattributionInInconsistencyContext dcc = { diff --git a/src/auditordb/pg_get_purse_not_closed_inconsistencies.c b/src/auditordb/pg_get_purse_not_closed_inconsistencies.c index c5e891ee0..adf306ed5 100644 --- a/src/auditordb/pg_get_purse_not_closed_inconsistencies.c +++ b/src/auditordb/pg_get_purse_not_closed_inconsistencies.c @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "platform.h" @@ -69,7 +81,8 @@ purse_not_closed_inconsistencies_cb (void *cls, GNUNET_PQ_result_spec_uint64 ("row_id", &serial_id), GNUNET_PQ_result_spec_auto_from_type ("purse_pub", &dc.purse_pub), TALER_PQ_RESULT_SPEC_AMOUNT ("amount", &dc.amount), - GNUNET_PQ_result_spec_int64 ("expiration_date", &dc.expiration_date), + GNUNET_PQ_result_spec_absolute_time ("expiration_date", + &dc.expiration_date), GNUNET_PQ_result_spec_end }; @@ -107,11 +120,13 @@ TAH_PG_get_purse_not_closed_inconsistencies ( void *cb_cls) { + uint64_t plimit = (uint64_t) ((limit < 0) ? -limit : limit); + struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_uint64 (&offset), GNUNET_PQ_query_param_bool (return_suppressed), - GNUNET_PQ_query_param_int64 (&limit), + GNUNET_PQ_query_param_uint64 (&plimit), GNUNET_PQ_query_param_end }; struct PurseNotClosedInconsistenciesContext dcc = { diff --git a/src/auditordb/pg_get_purse_not_closed_inconsistencies.h b/src/auditordb/pg_get_purse_not_closed_inconsistencies.h index 658aeea80..ef7bdb3ae 100644 --- a/src/auditordb/pg_get_purse_not_closed_inconsistencies.h +++ b/src/auditordb/pg_get_purse_not_closed_inconsistencies.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_GET_PURSE_NOT_CLOSED_INCONSISTENCIES_H #define SRC_PG_GET_PURSE_NOT_CLOSED_INCONSISTENCIES_H diff --git a/src/auditordb/pg_get_purses.c b/src/auditordb/pg_get_purses.c index ce4ae6001..4b5bc3814 100644 --- a/src/auditordb/pg_get_purses.c +++ b/src/auditordb/pg_get_purses.c @@ -121,11 +121,13 @@ TAH_PG_get_purses ( void *cb_cls) { + uint64_t plimit = (uint64_t) ((limit < 0) ? -limit : limit); + struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_uint64 (&offset), GNUNET_PQ_query_param_bool (return_suppressed), - GNUNET_PQ_query_param_int64 (&limit), + GNUNET_PQ_query_param_uint64 (&plimit), GNUNET_PQ_query_param_end }; struct PursesContext dcc = { diff --git a/src/auditordb/pg_get_refreshes_hanging.c b/src/auditordb/pg_get_refreshes_hanging.c index 6d86ae7a6..353ac5e1e 100644 --- a/src/auditordb/pg_get_refreshes_hanging.c +++ b/src/auditordb/pg_get_refreshes_hanging.c @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "platform.h" @@ -67,7 +79,7 @@ refreshes_hanging_cb (void *cls, GNUNET_PQ_result_spec_uint64 ("row_id", &serial_id), TALER_PQ_RESULT_SPEC_AMOUNT ("amount", &dc.amount), - GNUNET_PQ_result_spec_auto_from_type ("purse_pub", &dc.coin_pub), + GNUNET_PQ_result_spec_auto_from_type ("coin_pub", &dc.coin_pub), GNUNET_PQ_result_spec_end }; @@ -105,11 +117,13 @@ TAH_PG_get_refreshes_hanging ( void *cb_cls) { + uint64_t plimit = (uint64_t) ((limit < 0) ? -limit : limit); + struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_uint64 (&offset), GNUNET_PQ_query_param_bool (return_suppressed), - GNUNET_PQ_query_param_int64 (&limit), + GNUNET_PQ_query_param_uint64 (&plimit), GNUNET_PQ_query_param_end }; struct RefreshesHangingContext dcc = { diff --git a/src/auditordb/pg_get_refreshes_hanging.h b/src/auditordb/pg_get_refreshes_hanging.h index 7603c9b3d..b4fd26708 100644 --- a/src/auditordb/pg_get_refreshes_hanging.h +++ b/src/auditordb/pg_get_refreshes_hanging.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_GET_REFRESHES_HANGING_H #define SRC_PG_GET_REFRESHES_HANGING_H diff --git a/src/auditordb/pg_get_reserve_balance_insufficient_inconsistency.c b/src/auditordb/pg_get_reserve_balance_insufficient_inconsistency.c index ed482937b..f84d5bbaa 100644 --- a/src/auditordb/pg_get_reserve_balance_insufficient_inconsistency.c +++ b/src/auditordb/pg_get_reserve_balance_insufficient_inconsistency.c @@ -1,7 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "platform.h" #include "taler_error_codes.h" @@ -107,11 +118,13 @@ TAH_PG_get_reserve_balance_insufficient_inconsistency ( void *cb_cls) { + uint64_t plimit = (uint64_t) ((limit < 0) ? -limit : limit); + struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_uint64 (&offset), GNUNET_PQ_query_param_bool (return_suppressed), - GNUNET_PQ_query_param_int64 (&limit), + GNUNET_PQ_query_param_uint64 (&plimit), GNUNET_PQ_query_param_end }; struct ReserveBalanceInsufficientInconsistencyContext dcc = { diff --git a/src/auditordb/pg_get_reserve_balance_insufficient_inconsistency.h b/src/auditordb/pg_get_reserve_balance_insufficient_inconsistency.h index 5133f8149..d2e0fa3ed 100644 --- a/src/auditordb/pg_get_reserve_balance_insufficient_inconsistency.h +++ b/src/auditordb/pg_get_reserve_balance_insufficient_inconsistency.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_GET_RESERVE_BALANCE_INSUFFICIENT_INCONSISTENCY_H #define SRC_PG_GET_RESERVE_BALANCE_INSUFFICIENT_INCONSISTENCY_H diff --git a/src/auditordb/pg_get_reserve_balance_summary_wrong_inconsistency.c b/src/auditordb/pg_get_reserve_balance_summary_wrong_inconsistency.c index a2ae412f0..d41d1cbf9 100644 --- a/src/auditordb/pg_get_reserve_balance_summary_wrong_inconsistency.c +++ b/src/auditordb/pg_get_reserve_balance_summary_wrong_inconsistency.c @@ -65,6 +65,10 @@ reserve_balance_summary_wrong_inconsistency_cb (void *cls, { struct ReserveBalanceSummaryWrongInconsistencyContext *dcc = cls; struct PostgresClosure *pg = dcc->pg; + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "---found rbswi's in reserveblanace...\n"); + GNUNET_log (GNUNET_ERROR_TYPE_INFO, "---num_results: %u\n", num_results); + for (unsigned int i = 0; i < num_results; i++) { @@ -75,7 +79,6 @@ reserve_balance_summary_wrong_inconsistency_cb (void *cls, struct GNUNET_PQ_ResultSpec rs[] = { GNUNET_PQ_result_spec_uint64 ("row_id", &serial_id), - GNUNET_PQ_result_spec_auto_from_type ("reserve_pub", &dc.reserve_pub), TALER_PQ_RESULT_SPEC_AMOUNT ("exchange_amount", &dc.exchange_amount), TALER_PQ_RESULT_SPEC_AMOUNT ("auditor_amount", &dc.auditor_amount), @@ -118,11 +121,13 @@ TAH_PG_get_reserve_balance_summary_wrong_inconsistency ( void *cb_cls) { + uint64_t plimit = (uint64_t) ((limit < 0) ? -limit : limit); + struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_uint64 (&offset), GNUNET_PQ_query_param_bool (return_suppressed), - GNUNET_PQ_query_param_int64 (&limit), + GNUNET_PQ_query_param_uint64 (&plimit), GNUNET_PQ_query_param_end }; struct ReserveBalanceSummaryWrongInconsistencyContext dcc = { diff --git a/src/auditordb/pg_get_reserve_balance_summary_wrong_inconsistency.h b/src/auditordb/pg_get_reserve_balance_summary_wrong_inconsistency.h index 2b70e556e..8cafd4f44 100644 --- a/src/auditordb/pg_get_reserve_balance_summary_wrong_inconsistency.h +++ b/src/auditordb/pg_get_reserve_balance_summary_wrong_inconsistency.h @@ -1,6 +1,3 @@ - - - /* This file is part of TALER Copyright (C) 2024 Taler Systems SA @@ -46,6 +43,3 @@ TAH_PG_get_reserve_balance_summary_wrong_inconsistency ( void *cb_cls); #endif // SRC_PG_GET_RESERVE_BALANCE_SUMMARY_WRONG_INCONSISTENCY_H - - -
\ No newline at end of file diff --git a/src/auditordb/pg_get_reserve_in_inconsistency.c b/src/auditordb/pg_get_reserve_in_inconsistency.c index 1ad3559ac..5ce7785d3 100644 --- a/src/auditordb/pg_get_reserve_in_inconsistency.c +++ b/src/auditordb/pg_get_reserve_in_inconsistency.c @@ -122,11 +122,13 @@ TAH_PG_get_reserve_in_inconsistency ( void *cb_cls) { + uint64_t plimit = (uint64_t) ((limit < 0) ? -limit : limit); + struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_uint64 (&offset), GNUNET_PQ_query_param_bool (return_suppressed), - GNUNET_PQ_query_param_int64 (&limit), + GNUNET_PQ_query_param_uint64 (&plimit), GNUNET_PQ_query_param_end }; struct ReserveInInconsistencyContext dcc = { diff --git a/src/auditordb/pg_get_reserve_not_closed_inconsistency.c b/src/auditordb/pg_get_reserve_not_closed_inconsistency.c index 3a47f759a..e5583509e 100644 --- a/src/auditordb/pg_get_reserve_not_closed_inconsistency.c +++ b/src/auditordb/pg_get_reserve_not_closed_inconsistency.c @@ -78,7 +78,8 @@ reserve_not_closed_inconsistency_cb (void *cls, GNUNET_PQ_result_spec_auto_from_type ("reserve_pub", &dc.reserve_pub), TALER_PQ_RESULT_SPEC_AMOUNT ("balance", &dc.balance), - GNUNET_PQ_result_spec_int64 ("expiration_time", &dc.expiration_time), + GNUNET_PQ_result_spec_absolute_time ("expiration_time", + &dc.expiration_time), GNUNET_PQ_result_spec_auto_from_type ("diagnostic", &dc.diagnostic), GNUNET_PQ_result_spec_bool ("suppressed", &dc.suppressed), @@ -119,11 +120,13 @@ TAH_PG_get_reserve_not_closed_inconsistency ( void *cb_cls) { + uint64_t plimit = (uint64_t) ((limit < 0) ? -limit : limit); + struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_uint64 (&offset), GNUNET_PQ_query_param_bool (return_suppressed), - GNUNET_PQ_query_param_int64 (&limit), + GNUNET_PQ_query_param_uint64 (&plimit), GNUNET_PQ_query_param_end }; struct ReserveNotClosedInconsistencyContext dcc = { diff --git a/src/auditordb/pg_get_reserves.c b/src/auditordb/pg_get_reserves.c index 9bb817d5f..8ad1cb2ac 100644 --- a/src/auditordb/pg_get_reserves.c +++ b/src/auditordb/pg_get_reserves.c @@ -129,11 +129,13 @@ TAH_PG_get_reserves ( void *cb_cls) { + uint64_t plimit = (uint64_t) ((limit < 0) ? -limit : limit); + struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_uint64 (&offset), GNUNET_PQ_query_param_bool (return_suppressed), - GNUNET_PQ_query_param_int64 (&limit), + GNUNET_PQ_query_param_uint64 (&plimit), GNUNET_PQ_query_param_end }; struct ReservesContext dcc = { diff --git a/src/auditordb/pg_get_row_inconsistency.c b/src/auditordb/pg_get_row_inconsistency.c index f90d1cf0e..14e454f00 100644 --- a/src/auditordb/pg_get_row_inconsistency.c +++ b/src/auditordb/pg_get_row_inconsistency.c @@ -1,7 +1,18 @@ -// -// Created by parallels on 20/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "platform.h" #include "taler_error_codes.h" @@ -106,11 +117,13 @@ TAH_PG_get_row_inconsistency ( void *cb_cls) { + uint64_t plimit = (uint64_t) ((limit < 0) ? -limit : limit); + struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_uint64 (&offset), GNUNET_PQ_query_param_bool (return_suppressed), - GNUNET_PQ_query_param_int64 (&limit), + GNUNET_PQ_query_param_uint64 (&plimit), GNUNET_PQ_query_param_end }; struct RowInconsistencyContext dcc = { diff --git a/src/auditordb/pg_get_row_inconsistency.h b/src/auditordb/pg_get_row_inconsistency.h index ef0136f39..4aa13e36d 100644 --- a/src/auditordb/pg_get_row_inconsistency.h +++ b/src/auditordb/pg_get_row_inconsistency.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 20/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_GET_ROW_INCONSISTENCY_H #define SRC_PG_GET_ROW_INCONSISTENCY_H diff --git a/src/auditordb/pg_get_row_minor_inconsistencies.c b/src/auditordb/pg_get_row_minor_inconsistencies.c index 8308d5dbb..c6a15b155 100644 --- a/src/auditordb/pg_get_row_minor_inconsistencies.c +++ b/src/auditordb/pg_get_row_minor_inconsistencies.c @@ -64,7 +64,7 @@ row_minor_inconsistencies_cb (void *cls, unsigned int num_results) { struct RowMinorInconsistenciesContext *dcc = cls; - struct PostgresClosure *pg = dcc->pg; + // struct PostgresClosure *pg = dcc->pg; for (unsigned int i = 0; i < num_results; i++) { @@ -117,11 +117,13 @@ TAH_PG_get_row_minor_inconsistencies ( void *cb_cls) { + uint64_t plimit = (uint64_t) ((limit < 0) ? -limit : limit); + struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_uint64 (&offset), GNUNET_PQ_query_param_bool (return_suppressed), - GNUNET_PQ_query_param_int64 (&limit), + GNUNET_PQ_query_param_uint64 (&plimit), GNUNET_PQ_query_param_end }; struct RowMinorInconsistenciesContext dcc = { diff --git a/src/auditordb/pg_get_wire_format_inconsistency.c b/src/auditordb/pg_get_wire_format_inconsistency.c index b3ab1b60d..d94c851c8 100644 --- a/src/auditordb/pg_get_wire_format_inconsistency.c +++ b/src/auditordb/pg_get_wire_format_inconsistency.c @@ -118,11 +118,13 @@ TAH_PG_get_wire_format_inconsistency ( void *cb_cls) { + uint64_t plimit = (uint64_t) ((limit < 0) ? -limit : limit); + struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_uint64 (&offset), GNUNET_PQ_query_param_bool (return_suppressed), - GNUNET_PQ_query_param_int64 (&limit), + GNUNET_PQ_query_param_uint64 (&plimit), GNUNET_PQ_query_param_end }; struct WireFormatInconsistencyContext dcc = { diff --git a/src/auditordb/pg_get_wire_out_inconsistency.c b/src/auditordb/pg_get_wire_out_inconsistency.c index 3a7051ad3..d885a2fa1 100644 --- a/src/auditordb/pg_get_wire_out_inconsistency.c +++ b/src/auditordb/pg_get_wire_out_inconsistency.c @@ -76,8 +76,8 @@ wire_out_inconsistency_cb (void *cls, GNUNET_PQ_result_spec_uint64 ("row_id", &serial_id), - GNUNET_PQ_result_spec_auto_from_type ("destination_account", - &dc.destination_account), + GNUNET_PQ_result_spec_string ("destination_account", + &dc.destination_account), TALER_PQ_RESULT_SPEC_AMOUNT ("expected", &dc.expected), TALER_PQ_RESULT_SPEC_AMOUNT ("claimed", &dc.claimed), GNUNET_PQ_result_spec_bool ("suppressed", &dc.suppressed), @@ -119,11 +119,13 @@ TAH_PG_get_wire_out_inconsistency ( void *cb_cls) { + uint64_t plimit = (uint64_t) ((limit < 0) ? -limit : limit); + struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_uint64 (&offset), GNUNET_PQ_query_param_bool (return_suppressed), - GNUNET_PQ_query_param_int64 (&limit), + GNUNET_PQ_query_param_uint64 (&plimit), GNUNET_PQ_query_param_end }; struct WireOutInconsistencyContext dcc = { diff --git a/src/auditordb/pg_insert_amount_arithmetic_inconsistency.c b/src/auditordb/pg_insert_amount_arithmetic_inconsistency.c index 9d25a20a9..9f9dfb859 100644 --- a/src/auditordb/pg_insert_amount_arithmetic_inconsistency.c +++ b/src/auditordb/pg_insert_amount_arithmetic_inconsistency.c @@ -1,7 +1,18 @@ -// -// Created by parallels on 21/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "platform.h" #include "taler_pq_lib.h" @@ -18,7 +29,7 @@ TAH_PG_insert_amount_arithmetic_inconsistency ( struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { - GNUNET_PQ_query_param_auto_from_type (&dc->operation), + GNUNET_PQ_query_param_string (dc->operation), TALER_PQ_query_param_amount (pg->conn, &dc->exchange_amount), TALER_PQ_query_param_amount (pg->conn, diff --git a/src/auditordb/pg_insert_amount_arithmetic_inconsistency.h b/src/auditordb/pg_insert_amount_arithmetic_inconsistency.h index 410f6e683..31d94e279 100644 --- a/src/auditordb/pg_insert_amount_arithmetic_inconsistency.h +++ b/src/auditordb/pg_insert_amount_arithmetic_inconsistency.h @@ -1,7 +1,18 @@ -// -// Created by parallels on 21/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_INSERT_AMOUNT_ARITHMETIC_INCONSISTENCY_H #define SRC_PG_INSERT_AMOUNT_ARITHMETIC_INCONSISTENCY_H diff --git a/src/auditordb/pg_insert_auditor_closure_lags.h b/src/auditordb/pg_insert_auditor_closure_lags.h index 0a607b483..745a95093 100644 --- a/src/auditordb/pg_insert_auditor_closure_lags.h +++ b/src/auditordb/pg_insert_auditor_closure_lags.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_INSERT_AUDITOR_CLOSURE_LAGS_H #define SRC_PG_INSERT_AUDITOR_CLOSURE_LAGS_H diff --git a/src/auditordb/pg_insert_bad_sig_losses.c b/src/auditordb/pg_insert_bad_sig_losses.c index 72e7929f7..f4d423397 100644 --- a/src/auditordb/pg_insert_bad_sig_losses.c +++ b/src/auditordb/pg_insert_bad_sig_losses.c @@ -35,6 +35,12 @@ TAH_PG_insert_bad_sig_losses ( GNUNET_PQ_query_param_end }; + GNUNET_log (GNUNET_ERROR_TYPE_INFO, "--storing new bsl\n"); + GNUNET_log (GNUNET_ERROR_TYPE_INFO, "--operation %s\n", dc->operation); + GNUNET_log (GNUNET_ERROR_TYPE_INFO, "--loss %s\n", TALER_amount_to_string ( + &dc->loss)); + GNUNET_log (GNUNET_ERROR_TYPE_INFO, "--operation_specific_pub %s\n", + TALER_B2S (&dc->operation_specific_pub)); PREPARE (pg, "auditor_bad_sig_losses_insert", diff --git a/src/auditordb/pg_insert_bad_sig_losses.h b/src/auditordb/pg_insert_bad_sig_losses.h index 26b2182ed..fdad6a38b 100644 --- a/src/auditordb/pg_insert_bad_sig_losses.h +++ b/src/auditordb/pg_insert_bad_sig_losses.h @@ -1,7 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_INSERT_BAD_SIG_LOSSES_H #define SRC_PG_INSERT_BAD_SIG_LOSSES_H diff --git a/src/auditordb/pg_insert_balances.c b/src/auditordb/pg_insert_balances.c new file mode 100644 index 000000000..d6d4f35ce --- /dev/null +++ b/src/auditordb/pg_insert_balances.c @@ -0,0 +1,49 @@ +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ + + +#include "platform.h" +#include "taler_pq_lib.h" +#include "pg_helper.h" + +#include "pg_insert_balances.h" + +enum GNUNET_DB_QueryStatus +TAH_PG_insert_balances ( + void *cls, + const struct TALER_AUDITORDB_Balances *dc) +{ + struct PostgresClosure *pg = cls; + struct GNUNET_PQ_QueryParam params[] = { + + GNUNET_PQ_query_param_string (dc->balance_key), + TALER_PQ_query_param_amount (pg->conn, &dc->balance_value), + + + GNUNET_PQ_query_param_end + }; + + PREPARE (pg, + "auditor_balances_insert", + "INSERT INTO auditor_balances " + "( balance_key," + " balance_value" + ") VALUES ($1,$2);" + ); + return GNUNET_PQ_eval_prepared_non_select (pg->conn, + "auditor_balances_insert", + params); +} diff --git a/src/auditordb/pg_insert_balances.h b/src/auditordb/pg_insert_balances.h new file mode 100644 index 000000000..19d2bc046 --- /dev/null +++ b/src/auditordb/pg_insert_balances.h @@ -0,0 +1,37 @@ +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ + + +#ifndef SRC_PG_INSERT_BALANCES_H +#define SRC_PG_INSERT_BALANCES_H + +#include "taler_util.h" +#include "taler_auditordb_plugin.h" + + +/** + * Insert information about a bad sig loss into the database. + * + * @param cls the @e cls of this struct with the plugin-specific state + * @param dc deposit confirmation information to store + * @return query result status + */ +enum GNUNET_DB_QueryStatus +TAH_PG_insert_balances ( + void *cls, + const struct TALER_AUDITORDB_Balances *dc); + +#endif // SRC_PG_INSERT_BALANCES_H diff --git a/src/auditordb/pg_insert_coin_inconsistency.c b/src/auditordb/pg_insert_coin_inconsistency.c index 0aaf3205c..532f94c23 100644 --- a/src/auditordb/pg_insert_coin_inconsistency.c +++ b/src/auditordb/pg_insert_coin_inconsistency.c @@ -1,6 +1,18 @@ -// -// Created by parallels on 21/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "platform.h" diff --git a/src/auditordb/pg_insert_coin_inconsistency.h b/src/auditordb/pg_insert_coin_inconsistency.h index 2dac42497..64904a5b4 100644 --- a/src/auditordb/pg_insert_coin_inconsistency.h +++ b/src/auditordb/pg_insert_coin_inconsistency.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 21/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_INSERT_COIN_INCONSISTENCY_H #define SRC_PG_INSERT_COIN_INCONSISTENCY_H diff --git a/src/auditordb/pg_insert_denomination_key_validity_withdraw_inconsistency.c b/src/auditordb/pg_insert_denomination_key_validity_withdraw_inconsistency.c index bbf978d06..2d0cb3cf5 100644 --- a/src/auditordb/pg_insert_denomination_key_validity_withdraw_inconsistency.c +++ b/src/auditordb/pg_insert_denomination_key_validity_withdraw_inconsistency.c @@ -29,7 +29,7 @@ TAH_PG_insert_denomination_key_validity_withdraw_inconsistency ( struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { - GNUNET_PQ_query_param_int64 (&dc->execution_date), + GNUNET_PQ_query_param_absolute_time (&dc->execution_date), GNUNET_PQ_query_param_auto_from_type (&dc->reserve_pub), GNUNET_PQ_query_param_auto_from_type (&dc->denompub_h), diff --git a/src/auditordb/pg_insert_denomination_key_validity_withdraw_inconsistency.h b/src/auditordb/pg_insert_denomination_key_validity_withdraw_inconsistency.h index a8a5e57e4..08484a5bf 100644 --- a/src/auditordb/pg_insert_denomination_key_validity_withdraw_inconsistency.h +++ b/src/auditordb/pg_insert_denomination_key_validity_withdraw_inconsistency.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_INSERT_DENOMINATION_KEY_VALIDITY_WITHDRAW_INCONSISTENCY_H #define SRC_PG_INSERT_DENOMINATION_KEY_VALIDITY_WITHDRAW_INCONSISTENCY_H diff --git a/src/auditordb/pg_insert_denomination_pending.c b/src/auditordb/pg_insert_denomination_pending.c index dbea8c6a9..673b94352 100644 --- a/src/auditordb/pg_insert_denomination_pending.c +++ b/src/auditordb/pg_insert_denomination_pending.c @@ -35,7 +35,6 @@ TAH_PG_insert_denomination_pending ( GNUNET_PQ_query_param_int64 (&dc->num_issued), TALER_PQ_query_param_amount (pg->conn, &dc->denom_risk), TALER_PQ_query_param_amount (pg->conn, &dc->recoup_loss), - GNUNET_PQ_query_param_bool (dc->suppressed), GNUNET_PQ_query_param_end @@ -49,9 +48,8 @@ TAH_PG_insert_denomination_pending ( " denom_loss," " num_issued," " denom_risk," - " recoup_loss," - " suppressed" - ") VALUES ($1,$2,$3,$4,$5,$6,$7);" + " recoup_loss" + ") VALUES ($1,$2,$3,$4,$5,$6);" ); return GNUNET_PQ_eval_prepared_non_select (pg->conn, "auditor_denomination_pending_insert", diff --git a/src/auditordb/pg_insert_denominations_without_sigs.c b/src/auditordb/pg_insert_denominations_without_sigs.c index 30d2f0caf..897b4be41 100644 --- a/src/auditordb/pg_insert_denominations_without_sigs.c +++ b/src/auditordb/pg_insert_denominations_without_sigs.c @@ -31,9 +31,8 @@ TAH_PG_insert_denominations_without_sigs ( GNUNET_PQ_query_param_auto_from_type (&dc->denompub_h), TALER_PQ_query_param_amount (pg->conn, &dc->value), - GNUNET_PQ_query_param_int64 (&dc->start_time), - GNUNET_PQ_query_param_int64 (&dc->end_time), - GNUNET_PQ_query_param_bool (dc->suppressed), + GNUNET_PQ_query_param_absolute_time (&dc->start_time), + GNUNET_PQ_query_param_absolute_time (&dc->end_time), GNUNET_PQ_query_param_end @@ -42,13 +41,11 @@ TAH_PG_insert_denominations_without_sigs ( PREPARE (pg, "auditor_denominations_without_sigs_insert", "INSERT INTO auditor_denominations_without_sigs " - "( row_id," - " denompub_h," + "(denompub_h," " value," " start_time," - " end_time," - " suppressed" - ") VALUES ($1,$2,$3,$4,$5,$6);" + " end_time" + ") VALUES ($1,$2,$3,$4);" ); return GNUNET_PQ_eval_prepared_non_select (pg->conn, "auditor_denominations_without_sigs_insert", diff --git a/src/auditordb/pg_insert_deposit_confirmation.c b/src/auditordb/pg_insert_deposit_confirmation.c index 1b5205782..dbca04fe1 100644 --- a/src/auditordb/pg_insert_deposit_confirmation.c +++ b/src/auditordb/pg_insert_deposit_confirmation.c @@ -56,7 +56,7 @@ TAH_PG_insert_deposit_confirmation ( PREPARE (pg, "auditor_deposit_confirmation_insert", - "INSERT INTO deposit_confirmations " + "INSERT INTO auditor_deposit_confirmations " "(h_contract_terms" ",h_policy" ",h_wire" diff --git a/src/auditordb/pg_insert_emergency.c b/src/auditordb/pg_insert_emergency.c index 64ed9b8f6..a966be43b 100644 --- a/src/auditordb/pg_insert_emergency.c +++ b/src/auditordb/pg_insert_emergency.c @@ -32,8 +32,8 @@ TAH_PG_insert_emergency ( GNUNET_PQ_query_param_auto_from_type (&dc->denompub_h), TALER_PQ_query_param_amount (pg->conn, &dc->denom_risk), TALER_PQ_query_param_amount (pg->conn, &dc->denom_loss), - GNUNET_PQ_query_param_int64 (&dc->deposit_start), - GNUNET_PQ_query_param_int64 (&dc->deposit_end), + GNUNET_PQ_query_param_absolute_time (&dc->deposit_start), + GNUNET_PQ_query_param_absolute_time (&dc->deposit_end), TALER_PQ_query_param_amount (pg->conn,&dc->value), GNUNET_PQ_query_param_end diff --git a/src/auditordb/pg_insert_emergency.h b/src/auditordb/pg_insert_emergency.h index db8f39cbf..077602a96 100644 --- a/src/auditordb/pg_insert_emergency.h +++ b/src/auditordb/pg_insert_emergency.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_INSERT_EMERGENCY_H #define SRC_PG_INSERT_EMERGENCY_H diff --git a/src/auditordb/pg_insert_emergency_by_count.c b/src/auditordb/pg_insert_emergency_by_count.c index 6900a3e2e..2cebc8cac 100644 --- a/src/auditordb/pg_insert_emergency_by_count.c +++ b/src/auditordb/pg_insert_emergency_by_count.c @@ -34,8 +34,8 @@ TAH_PG_insert_emergency_by_count ( GNUNET_PQ_query_param_int64 (&dc->num_issued), GNUNET_PQ_query_param_int64 (&dc->num_known), TALER_PQ_query_param_amount (pg->conn, &dc->risk), - GNUNET_PQ_query_param_int64 (&dc->start), - GNUNET_PQ_query_param_int64 (&dc->deposit_end), + GNUNET_PQ_query_param_absolute_time (&dc->start), + GNUNET_PQ_query_param_absolute_time (&dc->deposit_end), TALER_PQ_query_param_amount (pg->conn, &dc->value), GNUNET_PQ_query_param_end diff --git a/src/auditordb/pg_insert_emergency_by_count.h b/src/auditordb/pg_insert_emergency_by_count.h index 4f4f6bb64..7fc694243 100644 --- a/src/auditordb/pg_insert_emergency_by_count.h +++ b/src/auditordb/pg_insert_emergency_by_count.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_INSERT_EMERGENCY_BY_COUNT_H #define SRC_PG_INSERT_EMERGENCY_BY_COUNT_H diff --git a/src/auditordb/pg_insert_exchange_signkeys.c b/src/auditordb/pg_insert_exchange_signkeys.c index 14928e8ae..356fdcd94 100644 --- a/src/auditordb/pg_insert_exchange_signkeys.c +++ b/src/auditordb/pg_insert_exchange_signkeys.c @@ -34,7 +34,6 @@ TAH_PG_insert_exchange_signkeys ( GNUNET_PQ_query_param_int64 (&dc->ep_valid_from), GNUNET_PQ_query_param_int64 (&dc->ep_expire_sign), GNUNET_PQ_query_param_int64 (&dc->ep_expire_legal), - GNUNET_PQ_query_param_bool (dc->suppressed), GNUNET_PQ_query_param_end @@ -47,9 +46,8 @@ TAH_PG_insert_exchange_signkeys ( " master_sig," " ep_valid_from," " ep_expire_sign," - " ep_expire_legal," - " suppressed" - ") VALUES ($1,$2,$3,$4,$5,$6);" + " ep_expire_legal" + ") VALUES ($1,$2,$3,$4,$5);" ); return GNUNET_PQ_eval_prepared_non_select (pg->conn, "auditor_exchange_signkeys_insert", diff --git a/src/auditordb/pg_insert_fee_time_inconsistency.c b/src/auditordb/pg_insert_fee_time_inconsistency.c index bd3f25515..857249711 100644 --- a/src/auditordb/pg_insert_fee_time_inconsistency.c +++ b/src/auditordb/pg_insert_fee_time_inconsistency.c @@ -30,9 +30,9 @@ TAH_PG_insert_fee_time_inconsistency ( struct GNUNET_PQ_QueryParam params[] = { - GNUNET_PQ_query_param_string (*dc->type), + GNUNET_PQ_query_param_string (dc->type), GNUNET_PQ_query_param_int64 (&dc->time), - GNUNET_PQ_query_param_string (*dc->diagnostic), + GNUNET_PQ_query_param_string (dc->diagnostic), GNUNET_PQ_query_param_end }; diff --git a/src/auditordb/pg_insert_fee_time_inconsistency.h b/src/auditordb/pg_insert_fee_time_inconsistency.h index 5718072e2..0d90fca41 100644 --- a/src/auditordb/pg_insert_fee_time_inconsistency.h +++ b/src/auditordb/pg_insert_fee_time_inconsistency.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_INSERT_FEE_TIME_INCONSISTENCY_H #define SRC_PG_INSERT_FEE_TIME_INCONSISTENCY_H diff --git a/src/auditordb/pg_insert_historic_denomination_revenue.c b/src/auditordb/pg_insert_historic_denomination_revenue.c index b46bde680..83f34e0f2 100644 --- a/src/auditordb/pg_insert_historic_denomination_revenue.c +++ b/src/auditordb/pg_insert_historic_denomination_revenue.c @@ -33,7 +33,6 @@ TAH_PG_insert_historic_denomination_revenue ( GNUNET_PQ_query_param_int64 (&dc->revenue_timestamp), TALER_PQ_query_param_amount (pg->conn, &dc->revenue_balance), TALER_PQ_query_param_amount (pg->conn, &dc->loss_balance), - GNUNET_PQ_query_param_bool (dc->suppressed), GNUNET_PQ_query_param_end @@ -45,9 +44,8 @@ TAH_PG_insert_historic_denomination_revenue ( "( denom_pub_hash," " revenue_timestamp," " revenue_balance," - " loss_balance," - " suppressed" - ") VALUES ($1,$2,$3,$4,$5);" + " loss_balance" + ") VALUES ($1,$2,$3,$4);" ); return GNUNET_PQ_eval_prepared_non_select (pg->conn, "auditor_historic_denomination_revenue_insert", diff --git a/src/auditordb/pg_insert_historic_reserve_summary.c b/src/auditordb/pg_insert_historic_reserve_summary.c index 7b70984c4..1db619c04 100644 --- a/src/auditordb/pg_insert_historic_reserve_summary.c +++ b/src/auditordb/pg_insert_historic_reserve_summary.c @@ -32,7 +32,6 @@ TAH_PG_insert_historic_reserve_summary ( GNUNET_PQ_query_param_int64 (&dc->start_date), GNUNET_PQ_query_param_int64 (&dc->end_date), TALER_PQ_query_param_amount (pg->conn, &dc->reserve_profits), - GNUNET_PQ_query_param_bool (dc->suppressed), GNUNET_PQ_query_param_end @@ -43,9 +42,8 @@ TAH_PG_insert_historic_reserve_summary ( "INSERT INTO auditor_historic_reserve_summary " "( start_date," " end_date," - " reserve_profits," - " suppressed" - ") VALUES ($1,$2,$3,$4);" + " reserve_profits" + ") VALUES ($1,$2,$3);" ); return GNUNET_PQ_eval_prepared_non_select (pg->conn, "auditor_historic_reserve_summary_insert", diff --git a/src/auditordb/pg_insert_misattribution_in_inconsistency.c b/src/auditordb/pg_insert_misattribution_in_inconsistency.c index 7d86a6ec1..843b8933e 100644 --- a/src/auditordb/pg_insert_misattribution_in_inconsistency.c +++ b/src/auditordb/pg_insert_misattribution_in_inconsistency.c @@ -32,7 +32,6 @@ TAH_PG_insert_misattribution_in_inconsistency ( TALER_PQ_query_param_amount (pg->conn, &dc->amount), GNUNET_PQ_query_param_int64 (&dc->bank_row), GNUNET_PQ_query_param_auto_from_type (&dc->reserve_pub), - GNUNET_PQ_query_param_bool (dc->suppressed), GNUNET_PQ_query_param_end @@ -44,9 +43,8 @@ TAH_PG_insert_misattribution_in_inconsistency ( "( row_id," " amount," " bank_row," - " reserve_pub," - " suppressed" - ") VALUES ($1,$2,$3,$4,$5);" + " reserve_pub" + ") VALUES ($1,$2,$3,$4);" ); return GNUNET_PQ_eval_prepared_non_select (pg->conn, "auditor_misattribution_in_inconsistency_insert", diff --git a/src/auditordb/pg_insert_purse_not_closed_inconsistencies.c b/src/auditordb/pg_insert_purse_not_closed_inconsistencies.c index 49eea8ffb..dd567eb01 100644 --- a/src/auditordb/pg_insert_purse_not_closed_inconsistencies.c +++ b/src/auditordb/pg_insert_purse_not_closed_inconsistencies.c @@ -31,7 +31,7 @@ TAH_PG_insert_purse_not_closed_inconsistencies ( GNUNET_PQ_query_param_auto_from_type (&dc->purse_pub), TALER_PQ_query_param_amount (pg->conn, &dc->amount), - GNUNET_PQ_query_param_int64 (&dc->expiration_date), + GNUNET_PQ_query_param_absolute_time (&dc->expiration_date), GNUNET_PQ_query_param_end }; diff --git a/src/auditordb/pg_insert_purse_not_closed_inconsistencies.h b/src/auditordb/pg_insert_purse_not_closed_inconsistencies.h index 1fead79b1..61705b69b 100644 --- a/src/auditordb/pg_insert_purse_not_closed_inconsistencies.h +++ b/src/auditordb/pg_insert_purse_not_closed_inconsistencies.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_INSERT_PURSE_NOT_CLOSED_INCONSISTENCIES_H #define SRC_PG_INSERT_PURSE_NOT_CLOSED_INCONSISTENCIES_H diff --git a/src/auditordb/pg_insert_purses.c b/src/auditordb/pg_insert_purses.c index ab7f305d1..2fdc24be2 100644 --- a/src/auditordb/pg_insert_purses.c +++ b/src/auditordb/pg_insert_purses.c @@ -34,7 +34,6 @@ TAH_PG_insert_purses ( TALER_PQ_query_param_amount (pg->conn, &dc->balance), TALER_PQ_query_param_amount (pg->conn, &dc->target), GNUNET_PQ_query_param_int64 (&dc->expiration_date), - GNUNET_PQ_query_param_bool (dc->suppressed), GNUNET_PQ_query_param_end @@ -47,9 +46,8 @@ TAH_PG_insert_purses ( " purse_pub," " balance," " target," - " expiration_date," - " suppressed" - ") VALUES ($1,$2,$3,$4,$5,$6);" + " expiration_date" + ") VALUES ($1,$2,$3,$4,$5);" ); return GNUNET_PQ_eval_prepared_non_select (pg->conn, "auditor_purses_insert", diff --git a/src/auditordb/pg_insert_refreshes_hanging.h b/src/auditordb/pg_insert_refreshes_hanging.h index 261b0a254..9965a5f62 100644 --- a/src/auditordb/pg_insert_refreshes_hanging.h +++ b/src/auditordb/pg_insert_refreshes_hanging.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_INSERT_REFRESHES_HANGING_H #define SRC_PG_INSERT_REFRESHES_HANGING_H diff --git a/src/auditordb/pg_insert_reserve_balance_insufficient_inconsistency.h b/src/auditordb/pg_insert_reserve_balance_insufficient_inconsistency.h index 205186549..49f262707 100644 --- a/src/auditordb/pg_insert_reserve_balance_insufficient_inconsistency.h +++ b/src/auditordb/pg_insert_reserve_balance_insufficient_inconsistency.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_INSERT_RESERVE_BALANCE_INSUFFICIENT_INCONSISTENCY_H #define SRC_PG_INSERT_RESERVE_BALANCE_INSUFFICIENT_INCONSISTENCY_H diff --git a/src/auditordb/pg_insert_reserve_balance_summary_wrong_inconsistency.c b/src/auditordb/pg_insert_reserve_balance_summary_wrong_inconsistency.c index 0e9d7036a..d5002d793 100644 --- a/src/auditordb/pg_insert_reserve_balance_summary_wrong_inconsistency.c +++ b/src/auditordb/pg_insert_reserve_balance_summary_wrong_inconsistency.c @@ -32,8 +32,6 @@ TAH_PG_insert_reserve_balance_summary_wrong_inconsistency ( GNUNET_PQ_query_param_auto_from_type (&dc->reserve_pub), TALER_PQ_query_param_amount (pg->conn, &dc->exchange_amount), TALER_PQ_query_param_amount (pg->conn, &dc->auditor_amount), - GNUNET_PQ_query_param_bool (dc->suppressed), - GNUNET_PQ_query_param_end }; @@ -41,11 +39,10 @@ TAH_PG_insert_reserve_balance_summary_wrong_inconsistency ( PREPARE (pg, "auditor_reserve_balance_summary_wrong_inconsistency_insert", "INSERT INTO auditor_reserve_balance_summary_wrong_inconsistency " - "( reserve_pub," + "(reserve_pub," " exchange_amount," - " auditor_amount," - " suppressed" - ") VALUES ($1,$2,$3,$4);" + " auditor_amount" + ") VALUES ($1,$2,$3);" ); return GNUNET_PQ_eval_prepared_non_select (pg->conn, "auditor_reserve_balance_summary_wrong_inconsistency_insert", diff --git a/src/auditordb/pg_insert_reserve_in_inconsistency.c b/src/auditordb/pg_insert_reserve_in_inconsistency.c index 7090e20df..ffdc6a8ad 100644 --- a/src/auditordb/pg_insert_reserve_in_inconsistency.c +++ b/src/auditordb/pg_insert_reserve_in_inconsistency.c @@ -35,7 +35,6 @@ TAH_PG_insert_reserve_in_inconsistency ( GNUNET_PQ_query_param_int64 (&dc->timestamp), GNUNET_PQ_query_param_auto_from_type (&dc->account), GNUNET_PQ_query_param_auto_from_type (&dc->diagnostic), - GNUNET_PQ_query_param_bool (dc->suppressed), GNUNET_PQ_query_param_end @@ -50,9 +49,8 @@ TAH_PG_insert_reserve_in_inconsistency ( " reserve_pub," " timestamp," " account," - " diagnostic," - " suppressed" - ") VALUES ($1,$2,$3,$4,$5,$6,$7,$8);" + " diagnostic" + ") VALUES ($1,$2,$3,$4,$5,$6,$7);" ); return GNUNET_PQ_eval_prepared_non_select (pg->conn, "auditor_reserve_in_inconsistency_insert", diff --git a/src/auditordb/pg_insert_reserve_not_closed_inconsistency.c b/src/auditordb/pg_insert_reserve_not_closed_inconsistency.c index 12fa11e7f..86d1393cb 100644 --- a/src/auditordb/pg_insert_reserve_not_closed_inconsistency.c +++ b/src/auditordb/pg_insert_reserve_not_closed_inconsistency.c @@ -31,9 +31,8 @@ TAH_PG_insert_reserve_not_closed_inconsistency ( GNUNET_PQ_query_param_auto_from_type (&dc->reserve_pub), TALER_PQ_query_param_amount (pg->conn, &dc->balance), - GNUNET_PQ_query_param_int64 (&dc->expiration_time), + GNUNET_PQ_query_param_absolute_time (&dc->expiration_time), GNUNET_PQ_query_param_auto_from_type (&dc->diagnostic), - GNUNET_PQ_query_param_bool (dc->suppressed), GNUNET_PQ_query_param_end @@ -45,9 +44,8 @@ TAH_PG_insert_reserve_not_closed_inconsistency ( "( reserve_pub," " balance," " expiration_time," - " diagnostic," - " suppressed" - ") VALUES ($1,$2,$3,$4,$5);" + " diagnostic" + ") VALUES ($1,$2,$3,$4);" ); return GNUNET_PQ_eval_prepared_non_select (pg->conn, "auditor_reserve_not_closed_inconsistency_insert", diff --git a/src/auditordb/pg_insert_reserves.c b/src/auditordb/pg_insert_reserves.c index d7626310e..1873f808b 100644 --- a/src/auditordb/pg_insert_reserves.c +++ b/src/auditordb/pg_insert_reserves.c @@ -40,7 +40,6 @@ TAH_PG_insert_reserves ( TALER_PQ_query_param_amount (pg->conn, &dc->history_fee_balance), GNUNET_PQ_query_param_int64 (&dc->expiration_date), GNUNET_PQ_query_param_string (dc->origin_account), - GNUNET_PQ_query_param_bool (dc->suppressed), GNUNET_PQ_query_param_end @@ -59,9 +58,8 @@ TAH_PG_insert_reserves ( " open_fee_balance," " history_fee_balance," " expiration_date," - " origin_account," - " suppressed" - ") VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12);" + " origin_account" + ") VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11);" ); return GNUNET_PQ_eval_prepared_non_select (pg->conn, "auditor_reserves_insert", diff --git a/src/auditordb/pg_insert_row_inconsistency.c b/src/auditordb/pg_insert_row_inconsistency.c index 253779665..d9155d68c 100644 --- a/src/auditordb/pg_insert_row_inconsistency.c +++ b/src/auditordb/pg_insert_row_inconsistency.c @@ -1,7 +1,18 @@ -// -// Created by parallels on 21/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "platform.h" #include "taler_pq_lib.h" diff --git a/src/auditordb/pg_insert_row_inconsistency.h b/src/auditordb/pg_insert_row_inconsistency.h index 654adcd3e..280ef2f04 100644 --- a/src/auditordb/pg_insert_row_inconsistency.h +++ b/src/auditordb/pg_insert_row_inconsistency.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 21/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_INSERT_ROW_INCONSISTENCY_H #define SRC_PG_INSERT_ROW_INCONSISTENCY_H diff --git a/src/auditordb/pg_insert_row_minor_inconsistencies.c b/src/auditordb/pg_insert_row_minor_inconsistencies.c index 2759d4c40..84607fa3c 100644 --- a/src/auditordb/pg_insert_row_minor_inconsistencies.c +++ b/src/auditordb/pg_insert_row_minor_inconsistencies.c @@ -31,7 +31,6 @@ TAH_PG_insert_row_minor_inconsistencies ( GNUNET_PQ_query_param_auto_from_type (&dc->row_table), GNUNET_PQ_query_param_auto_from_type (&dc->diagnostic), - GNUNET_PQ_query_param_bool (dc->suppressed), GNUNET_PQ_query_param_end @@ -42,9 +41,8 @@ TAH_PG_insert_row_minor_inconsistencies ( "INSERT INTO auditor_row_minor_inconsistencies " "( row_id," " row_table," - " diagnostic," - " suppressed" - ") VALUES ($1,$2,$3,$4);" + " diagnostic" + ") VALUES ($1,$2,$3);" ); return GNUNET_PQ_eval_prepared_non_select (pg->conn, "auditor_row_minor_inconsistencies_insert", diff --git a/src/auditordb/pg_insert_wire_format_inconsistency.c b/src/auditordb/pg_insert_wire_format_inconsistency.c index fb031d8f3..c4b5b16dc 100644 --- a/src/auditordb/pg_insert_wire_format_inconsistency.c +++ b/src/auditordb/pg_insert_wire_format_inconsistency.c @@ -32,7 +32,6 @@ TAH_PG_insert_wire_format_inconsistency ( TALER_PQ_query_param_amount (pg->conn, &dc->amount), GNUNET_PQ_query_param_int64 (&dc->wire_offset), GNUNET_PQ_query_param_auto_from_type (&dc->diagnostic), - GNUNET_PQ_query_param_bool (dc->suppressed), GNUNET_PQ_query_param_end @@ -44,9 +43,8 @@ TAH_PG_insert_wire_format_inconsistency ( "( row_id," " amount," " wire_offset," - " diagnostic," - " suppressed" - ") VALUES ($1,$2,$3,$4,$5);" + " diagnostic" + ") VALUES ($1,$2,$3,$4);" ); return GNUNET_PQ_eval_prepared_non_select (pg->conn, "auditor_wire_format_inconsistency_insert", diff --git a/src/auditordb/pg_insert_wire_out_inconsistency.c b/src/auditordb/pg_insert_wire_out_inconsistency.c index aa1021110..1505b4426 100644 --- a/src/auditordb/pg_insert_wire_out_inconsistency.c +++ b/src/auditordb/pg_insert_wire_out_inconsistency.c @@ -32,7 +32,6 @@ TAH_PG_insert_wire_out_inconsistency ( GNUNET_PQ_query_param_auto_from_type (&dc->destination_account), TALER_PQ_query_param_amount (pg->conn, &dc->expected), TALER_PQ_query_param_amount (pg->conn, &dc->claimed), - GNUNET_PQ_query_param_bool (dc->suppressed), GNUNET_PQ_query_param_end @@ -41,12 +40,10 @@ TAH_PG_insert_wire_out_inconsistency ( PREPARE (pg, "auditor_wire_out_inconsistency_insert", "INSERT INTO auditor_wire_out_inconsistency " - "( row_id," - " destination_account," + "( destination_account," " expected," - " claimed," - " suppressed" - ") VALUES ($1,$2,$3,$4,$5);" + " claimed" + ") VALUES ($1,$2,$3);" ); return GNUNET_PQ_eval_prepared_non_select (pg->conn, "auditor_wire_out_inconsistency_insert", diff --git a/src/auditordb/pg_update_bad_sig_losses.c b/src/auditordb/pg_update_bad_sig_losses.c index 2ca92d8e1..4fdb1ae94 100644 --- a/src/auditordb/pg_update_bad_sig_losses.c +++ b/src/auditordb/pg_update_bad_sig_losses.c @@ -1,7 +1,18 @@ -// -// Created by parallels on 08/04/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "platform.h" #include "taler_pq_lib.h" diff --git a/src/auditordb/pg_update_bad_sig_losses.h b/src/auditordb/pg_update_bad_sig_losses.h index affb6a74c..aa36bb847 100644 --- a/src/auditordb/pg_update_bad_sig_losses.h +++ b/src/auditordb/pg_update_bad_sig_losses.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 08/04/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_UPDATE_BAD_SIG_LOSSES_H #define SRC_PG_UPDATE_BAD_SIG_LOSSES_H diff --git a/src/auditordb/pg_update_balances.c b/src/auditordb/pg_update_balances.c new file mode 100644 index 000000000..110184ed0 --- /dev/null +++ b/src/auditordb/pg_update_balances.c @@ -0,0 +1,48 @@ +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ + + +#include "platform.h" +#include "taler_pq_lib.h" +#include "pg_helper.h" + +#include "pg_update_balances.h" + +/* +Update a given resource – for now this only means suppressing +*/ +enum GNUNET_DB_QueryStatus +TAH_PG_update_balances ( + void *cls, + const struct TALER_AUDITORDB_Generic_Update *gu) +{ + struct PostgresClosure *pg = cls; + struct GNUNET_PQ_QueryParam params[] = { + GNUNET_PQ_query_param_uint64 (&gu->row_id), + GNUNET_PQ_query_param_bool (gu->suppressed), + GNUNET_PQ_query_param_end + }; + + + PREPARE (pg, + "update_balances", + "UPDATE auditor_balances SET" + " suppressed=$2" + " WHERE row_id=$1"); + return GNUNET_PQ_eval_prepared_non_select (pg->conn, + "update_balances", + params); +} diff --git a/src/auditordb/pg_update_balances.h b/src/auditordb/pg_update_balances.h new file mode 100644 index 000000000..4253897e5 --- /dev/null +++ b/src/auditordb/pg_update_balances.h @@ -0,0 +1,29 @@ +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ + + +#ifndef SRC_PG_UPDATE_BALANCES_H +#define SRC_PG_UPDATE_BALANCES_H + +#include "taler_util.h" +#include "taler_auditordb_plugin.h" + +enum GNUNET_DB_QueryStatus +TAH_PG_update_balances ( + void *cls, + const struct TALER_AUDITORDB_Generic_Update *dc); + +#endif // SRC_PG_UPDATE_BALANCES_H diff --git a/src/auditordb/pg_update_fee_time_inconsistency.c b/src/auditordb/pg_update_fee_time_inconsistency.c new file mode 100644 index 000000000..fe324edf8 --- /dev/null +++ b/src/auditordb/pg_update_fee_time_inconsistency.c @@ -0,0 +1,48 @@ +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ + + +#include "platform.h" +#include "taler_pq_lib.h" +#include "pg_helper.h" + +#include "pg_update_fee_time_inconsistency.h" + +/* +Update a given resource – for now this only means suppressing +*/ +enum GNUNET_DB_QueryStatus +TAH_PG_update_fee_time_inconsistency ( + void *cls, + const struct TALER_AUDITORDB_Generic_Update *gu) +{ + struct PostgresClosure *pg = cls; + struct GNUNET_PQ_QueryParam params[] = { + GNUNET_PQ_query_param_uint64 (&gu->row_id), + GNUNET_PQ_query_param_bool (gu->suppressed), + GNUNET_PQ_query_param_end + }; + + + PREPARE (pg, + "update_fee_time_inconsistency", + "UPDATE auditor_fee_time_inconsistency SET" + " suppressed=$2" + " WHERE row_id=$1"); + return GNUNET_PQ_eval_prepared_non_select (pg->conn, + "update_fee_time_inconsistency", + params); +} diff --git a/src/auditordb/pg_update_fee_time_inconsistency.h b/src/auditordb/pg_update_fee_time_inconsistency.h new file mode 100644 index 000000000..ef55de19f --- /dev/null +++ b/src/auditordb/pg_update_fee_time_inconsistency.h @@ -0,0 +1,29 @@ +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ + + +#ifndef SRC_PG_UPDATE_FEE_TIME_INCONSISTENCY_H +#define SRC_PG_UPDATE_FEE_TIME_INCONSISTENCY_H + +#include "taler_util.h" +#include "taler_auditordb_plugin.h" + +enum GNUNET_DB_QueryStatus +TAH_PG_update_fee_time_inconsistency ( + void *cls, + const struct TALER_AUDITORDB_Generic_Update *dc); + +#endif // SRC_PG_UPDATE_FEE_TIME_INCONSISTENCY_H diff --git a/src/auditordb/plugin_auditordb_postgres.c b/src/auditordb/plugin_auditordb_postgres.c index 9eb5df7b4..72d52da32 100644 --- a/src/auditordb/plugin_auditordb_postgres.c +++ b/src/auditordb/plugin_auditordb_postgres.c @@ -105,6 +105,7 @@ #include "pg_get_fee_time_inconsistency.h" #include "pg_del_fee_time_inconsistency.h" #include "pg_insert_fee_time_inconsistency.h" +#include "pg_update_fee_time_inconsistency.h" #include "pg_get_purse_not_closed_inconsistencies.h" #include "pg_del_purse_not_closed_inconsistencies.h" @@ -188,6 +189,11 @@ #include "pg_insert_row_minor_inconsistencies.h" #include "pg_update_row_minor_inconsistencies.h" +#include "pg_get_balances.h" +#include "pg_del_balances.h" +#include "pg_insert_balances.h" +#include "pg_update_balances.h" + #define LOG(kind,...) GNUNET_log_from (kind, "taler-auditordb-postgres", \ __VA_ARGS__) @@ -736,100 +742,145 @@ libtaler_plugin_auditordb_postgres_init (void *cls) plugin->insert_refreshes_hanging = &TAH_PG_insert_refreshes_hanging; plugin->get_refreshes_hanging = &TAH_PG_get_refreshes_hanging; - plugin->update_emergency_by_count = &TAH_PG_update_emergency_by_count; - plugin->update_row_inconsistency = &TAH_PG_update_row_inconsistency; - plugin->update_purse_not_closed_inconsistencies = &TAH_PG_update_purse_not_closed_inconsistencies; - plugin->update_reserve_balance_insufficient_inconsistency = &TAH_PG_update_reserve_balance_insufficient_inconsistency; - plugin->update_coin_inconsistency = &TAH_PG_update_coin_inconsistency; - plugin->update_progress = &TAH_PG_update_progress; - plugin->update_denomination_key_validity_withdraw_inconsistency = &TAH_PG_update_denomination_key_validity_withdraw_inconsistency; - plugin->update_refreshes_hanging = &TAH_PG_update_refreshes_hanging; - plugin->update_emergency = &TAH_PG_update_emergency; - plugin->update_closure_lags = &TAH_PG_update_closure_lags; - - - plugin->delete_reserve_in_inconsistency = &TAH_PG_del_reserve_in_inconsistency; - plugin->insert_reserve_in_inconsistency = &TAH_PG_insert_reserve_in_inconsistency; - plugin->get_reserve_in_inconsistency = &TAH_PG_get_reserve_in_inconsistency; - plugin->update_reserve_in_inconsistency = &TAH_PG_update_reserve_in_inconsistency; - - - plugin->delete_reserve_not_closed_inconsistency = &TAH_PG_del_reserve_not_closed_inconsistency; - plugin->insert_reserve_not_closed_inconsistency = &TAH_PG_insert_reserve_not_closed_inconsistency; - plugin->get_reserve_not_closed_inconsistency = &TAH_PG_get_reserve_not_closed_inconsistency; - plugin->update_reserve_not_closed_inconsistency = &TAH_PG_update_reserve_not_closed_inconsistency; - - - plugin->delete_denominations_without_sigs = &TAH_PG_del_denominations_without_sigs; - plugin->insert_denominations_without_sigs = &TAH_PG_insert_denominations_without_sigs; - plugin->get_denominations_without_sigs = &TAH_PG_get_denominations_without_sigs; - plugin->update_denominations_without_sigs = &TAH_PG_update_denominations_without_sigs; - - - plugin->delete_misattribution_in_inconsistency = &TAH_PG_del_misattribution_in_inconsistency; - plugin->insert_misattribution_in_inconsistency = &TAH_PG_insert_misattribution_in_inconsistency; - plugin->get_misattribution_in_inconsistency = &TAH_PG_get_misattribution_in_inconsistency; - plugin->update_misattribution_in_inconsistency = &TAH_PG_update_misattribution_in_inconsistency; - - - plugin->delete_reserves = &TAH_PG_del_reserves; - plugin->insert_reserves = &TAH_PG_insert_reserves; - plugin->get_reserves = &TAH_PG_get_reserves; - plugin->update_reserves = &TAH_PG_update_reserves; - - - plugin->delete_purses = &TAH_PG_del_purses; - plugin->insert_purses = &TAH_PG_insert_purses; - plugin->get_purses = &TAH_PG_get_purses; - plugin->update_purses = &TAH_PG_update_purses; - - - plugin->delete_historic_denomination_revenue = &TAH_PG_del_historic_denomination_revenue; - plugin->insert_historic_denomination_revenue = &TAH_PG_insert_historic_denomination_revenue; - plugin->get_historic_denomination_revenue = &TAH_PG_get_historic_denomination_revenue; - plugin->update_historic_denomination_revenue = &TAH_PG_update_historic_denomination_revenue; - - - plugin->delete_denomination_pending = &TAH_PG_del_denomination_pending; - plugin->insert_denomination_pending = &TAH_PG_insert_denomination_pending; - plugin->get_denomination_pending = &TAH_PG_get_denomination_pending; - plugin->update_denomination_pending = &TAH_PG_update_denomination_pending; - - - plugin->delete_historic_reserve_summary = &TAH_PG_del_historic_reserve_summary; - plugin->insert_historic_reserve_summary = &TAH_PG_insert_historic_reserve_summary; - plugin->get_historic_reserve_summary = &TAH_PG_get_historic_reserve_summary; - plugin->update_historic_reserve_summary = &TAH_PG_update_historic_reserve_summary; - - - plugin->delete_exchange_signkeys = &TAH_PG_del_exchange_signkeys; - plugin->insert_exchange_signkeys = &TAH_PG_insert_exchange_signkeys; - plugin->get_exchange_signkeys = &TAH_PG_get_exchange_signkeys; - plugin->update_exchange_signkeys = &TAH_PG_update_exchange_signkeys; - - - plugin->delete_wire_format_inconsistency = &TAH_PG_del_wire_format_inconsistency; - plugin->insert_wire_format_inconsistency = &TAH_PG_insert_wire_format_inconsistency; - plugin->get_wire_format_inconsistency = &TAH_PG_get_wire_format_inconsistency; - plugin->update_wire_format_inconsistency = &TAH_PG_update_wire_format_inconsistency; - - - plugin->delete_wire_out_inconsistency = &TAH_PG_del_wire_out_inconsistency; - plugin->insert_wire_out_inconsistency = &TAH_PG_insert_wire_out_inconsistency; - plugin->get_wire_out_inconsistency = &TAH_PG_get_wire_out_inconsistency; - plugin->update_wire_out_inconsistency = &TAH_PG_update_wire_out_inconsistency; - - - plugin->delete_reserve_balance_summary_wrong_inconsistency = &TAH_PG_del_reserve_balance_summary_wrong_inconsistency; - plugin->insert_reserve_balance_summary_wrong_inconsistency = &TAH_PG_insert_reserve_balance_summary_wrong_inconsistency; - plugin->get_reserve_balance_summary_wrong_inconsistency = &TAH_PG_get_reserve_balance_summary_wrong_inconsistency; - plugin->update_reserve_balance_summary_wrong_inconsistency = &TAH_PG_update_reserve_balance_summary_wrong_inconsistency; - - - plugin->delete_row_minor_inconsistencies = &TAH_PG_del_row_minor_inconsistencies; - plugin->insert_row_minor_inconsistencies = &TAH_PG_insert_row_minor_inconsistencies; - plugin->get_row_minor_inconsistencies = &TAH_PG_get_row_minor_inconsistencies; - plugin->update_row_minor_inconsistencies = &TAH_PG_update_row_minor_inconsistencies; + plugin->update_emergency_by_count = &TAH_PG_update_emergency_by_count; + plugin->update_row_inconsistency = &TAH_PG_update_row_inconsistency; + plugin->update_purse_not_closed_inconsistencies = + &TAH_PG_update_purse_not_closed_inconsistencies; + plugin->update_reserve_balance_insufficient_inconsistency = + &TAH_PG_update_reserve_balance_insufficient_inconsistency; + plugin->update_coin_inconsistency = &TAH_PG_update_coin_inconsistency; + plugin->update_progress = &TAH_PG_update_progress; + plugin->update_denomination_key_validity_withdraw_inconsistency = + &TAH_PG_update_denomination_key_validity_withdraw_inconsistency; + plugin->update_refreshes_hanging = &TAH_PG_update_refreshes_hanging; + plugin->update_emergency = &TAH_PG_update_emergency; + plugin->update_closure_lags = &TAH_PG_update_closure_lags; + + + plugin->delete_reserve_in_inconsistency = + &TAH_PG_del_reserve_in_inconsistency; + plugin->insert_reserve_in_inconsistency = + &TAH_PG_insert_reserve_in_inconsistency; + plugin->get_reserve_in_inconsistency = &TAH_PG_get_reserve_in_inconsistency; + plugin->update_reserve_in_inconsistency = + &TAH_PG_update_reserve_in_inconsistency; + + + plugin->delete_reserve_not_closed_inconsistency = + &TAH_PG_del_reserve_not_closed_inconsistency; + plugin->insert_reserve_not_closed_inconsistency = + &TAH_PG_insert_reserve_not_closed_inconsistency; + plugin->get_reserve_not_closed_inconsistency = + &TAH_PG_get_reserve_not_closed_inconsistency; + plugin->update_reserve_not_closed_inconsistency = + &TAH_PG_update_reserve_not_closed_inconsistency; + + + plugin->delete_denominations_without_sigs = + &TAH_PG_del_denominations_without_sigs; + plugin->insert_denominations_without_sigs = + &TAH_PG_insert_denominations_without_sigs; + plugin->get_denominations_without_sigs = + &TAH_PG_get_denominations_without_sigs; + plugin->update_denominations_without_sigs = + &TAH_PG_update_denominations_without_sigs; + + + plugin->delete_misattribution_in_inconsistency = + &TAH_PG_del_misattribution_in_inconsistency; + plugin->insert_misattribution_in_inconsistency = + &TAH_PG_insert_misattribution_in_inconsistency; + plugin->get_misattribution_in_inconsistency = + &TAH_PG_get_misattribution_in_inconsistency; + plugin->update_misattribution_in_inconsistency = + &TAH_PG_update_misattribution_in_inconsistency; + + + plugin->delete_reserves = &TAH_PG_del_reserves; + plugin->insert_reserves = &TAH_PG_insert_reserves; + plugin->get_reserves = &TAH_PG_get_reserves; + plugin->update_reserves = &TAH_PG_update_reserves; + + + plugin->delete_purses = &TAH_PG_del_purses; + plugin->insert_purses = &TAH_PG_insert_purses; + plugin->get_purses = &TAH_PG_get_purses; + plugin->update_purses = &TAH_PG_update_purses; + + + plugin->delete_historic_denomination_revenue = + &TAH_PG_del_historic_denomination_revenue; + plugin->insert_historic_denomination_revenue = + &TAH_PG_insert_historic_denomination_revenue; + plugin->get_historic_denomination_revenue = + &TAH_PG_get_historic_denomination_revenue; + plugin->update_historic_denomination_revenue = + &TAH_PG_update_historic_denomination_revenue; + + + plugin->delete_denomination_pending = &TAH_PG_del_denomination_pending; + plugin->insert_denomination_pending = &TAH_PG_insert_denomination_pending; + plugin->get_denomination_pending = &TAH_PG_get_denomination_pending; + plugin->update_denomination_pending = &TAH_PG_update_denomination_pending; + + + plugin->delete_historic_reserve_summary = + &TAH_PG_del_historic_reserve_summary; + plugin->insert_historic_reserve_summary = + &TAH_PG_insert_historic_reserve_summary; + plugin->get_historic_reserve_summary = &TAH_PG_get_historic_reserve_summary; + plugin->update_historic_reserve_summary = + &TAH_PG_update_historic_reserve_summary; + + + plugin->delete_exchange_signkeys = &TAH_PG_del_exchange_signkeys; + plugin->insert_exchange_signkeys = &TAH_PG_insert_exchange_signkeys; + plugin->get_exchange_signkeys = &TAH_PG_get_exchange_signkeys; + plugin->update_exchange_signkeys = &TAH_PG_update_exchange_signkeys; + + + plugin->delete_wire_format_inconsistency = + &TAH_PG_del_wire_format_inconsistency; + plugin->insert_wire_format_inconsistency = + &TAH_PG_insert_wire_format_inconsistency; + plugin->get_wire_format_inconsistency = &TAH_PG_get_wire_format_inconsistency; + plugin->update_wire_format_inconsistency = + &TAH_PG_update_wire_format_inconsistency; + + + plugin->delete_wire_out_inconsistency = &TAH_PG_del_wire_out_inconsistency; + plugin->insert_wire_out_inconsistency = &TAH_PG_insert_wire_out_inconsistency; + plugin->get_wire_out_inconsistency = &TAH_PG_get_wire_out_inconsistency; + plugin->update_wire_out_inconsistency = &TAH_PG_update_wire_out_inconsistency; + + + plugin->delete_reserve_balance_summary_wrong_inconsistency = + &TAH_PG_del_reserve_balance_summary_wrong_inconsistency; + plugin->insert_reserve_balance_summary_wrong_inconsistency = + &TAH_PG_insert_reserve_balance_summary_wrong_inconsistency; + plugin->get_reserve_balance_summary_wrong_inconsistency = + &TAH_PG_get_reserve_balance_summary_wrong_inconsistency; + plugin->update_reserve_balance_summary_wrong_inconsistency = + &TAH_PG_update_reserve_balance_summary_wrong_inconsistency; + + + plugin->delete_row_minor_inconsistencies = + &TAH_PG_del_row_minor_inconsistencies; + plugin->insert_row_minor_inconsistencies = + &TAH_PG_insert_row_minor_inconsistencies; + plugin->get_row_minor_inconsistencies = &TAH_PG_get_row_minor_inconsistencies; + plugin->update_row_minor_inconsistencies = + &TAH_PG_update_row_minor_inconsistencies; + + plugin->delete_fee_time_inconsistency = &TAH_PG_del_fee_time_inconsistency; + plugin->insert_fee_time_inconsistency = &TAH_PG_insert_fee_time_inconsistency; + plugin->get_fee_time_inconsistency = &TAH_PG_get_fee_time_inconsistency; + plugin->update_fee_time_inconsistency = &TAH_PG_update_fee_time_inconsistency; + + plugin->delete_balances = &TAH_PG_del_balances; + plugin->insert_balances = &TAH_PG_insert_balances; + plugin->get_balances = &TAH_PG_get_balances; + plugin->update_balances = &TAH_PG_update_balances; return plugin; } |