From f3ceeb00ea81833433a781bc412bb539c453cd24 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 8 Jun 2022 17:05:51 +0200 Subject: -expand auditordb to track progress for p2p payments --- src/auditordb/auditor-0001.sql | 5 +++ src/auditordb/plugin_auditordb_postgres.c | 51 ++++++++++++++++++++++++++----- 2 files changed, 48 insertions(+), 8 deletions(-) (limited to 'src/auditordb') diff --git a/src/auditordb/auditor-0001.sql b/src/auditordb/auditor-0001.sql index 0faa890d7..ae22ff34d 100644 --- a/src/auditordb/auditor-0001.sql +++ b/src/auditordb/auditor-0001.sql @@ -47,6 +47,10 @@ CREATE TABLE IF NOT EXISTS auditor_progress_reserve ,last_reserve_out_serial_id INT8 NOT NULL DEFAULT 0 ,last_reserve_recoup_serial_id INT8 NOT NULL DEFAULT 0 ,last_reserve_close_serial_id INT8 NOT NULL DEFAULT 0 + ,last_purse_merges_serial_id INT8 NOT NULL DEFAULT 0 + ,last_account_merges_serial_id INT8 NOT NULL DEFAULT 0 + ,last_history_requests_serial_id INT8 NOT NULL DEFAULT 0 + ,last_close_requests_serial_id INT8 NOT NULL DEFAULT 0 ,PRIMARY KEY (master_pub) ); COMMENT ON TABLE auditor_progress_reserve @@ -82,6 +86,7 @@ CREATE TABLE IF NOT EXISTS auditor_progress_coin ,last_refund_serial_id INT8 NOT NULL DEFAULT 0 ,last_recoup_serial_id INT8 NOT NULL DEFAULT 0 ,last_recoup_refresh_serial_id INT8 NOT NULL DEFAULT 0 + ,last_purse_deposits_serial_id INT8 NOT NULL DEFAULT 0 ,PRIMARY KEY (master_pub) ); COMMENT ON TABLE auditor_progress_coin diff --git a/src/auditordb/plugin_auditordb_postgres.c b/src/auditordb/plugin_auditordb_postgres.c index 6cee2b23a..26560465a 100644 --- a/src/auditordb/plugin_auditordb_postgres.c +++ b/src/auditordb/plugin_auditordb_postgres.c @@ -230,8 +230,12 @@ setup_connection (struct PostgresClosure *pg) ",last_reserve_out_serial_id=$2" ",last_reserve_recoup_serial_id=$3" ",last_reserve_close_serial_id=$4" - " WHERE master_pub=$5", - 5), + ",last_purse_merges_serial_id=$5" + ",last_account_merges_serial_id=$6" + ",last_history_requests_serial_id=$7" + ",last_close_requests_serial_id=$8" + " WHERE master_pub=$9", + 9), /* Used in #postgres_get_auditor_progress_reserve() */ GNUNET_PQ_make_prepare ("auditor_progress_select_reserve", "SELECT" @@ -239,6 +243,10 @@ setup_connection (struct PostgresClosure *pg) ",last_reserve_out_serial_id" ",last_reserve_recoup_serial_id" ",last_reserve_close_serial_id" + ",last_purse_merges_serial_id" + ",last_account_merges_serial_id" + ",last_history_requests_serial_id" + ",last_close_requests_serial_id" " FROM auditor_progress_reserve" " WHERE master_pub=$1;", 1), @@ -250,8 +258,12 @@ setup_connection (struct PostgresClosure *pg) ",last_reserve_out_serial_id" ",last_reserve_recoup_serial_id" ",last_reserve_close_serial_id" - ") VALUES ($1,$2,$3,$4,$5);", - 5), + ",last_purse_merges_serial_id" + ",last_account_merges_serial_id" + ",last_history_requests_serial_id" + ",last_close_requests_serial_id" + ") VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9);", + 9), /* Used in #postgres_update_auditor_progress_aggregation() */ GNUNET_PQ_make_prepare ("auditor_progress_update_aggregation", "UPDATE auditor_progress_aggregation SET " @@ -301,8 +313,9 @@ setup_connection (struct PostgresClosure *pg) ",last_refund_serial_id=$4" ",last_recoup_serial_id=$5" ",last_recoup_refresh_serial_id=$6" - " WHERE master_pub=$7", - 7), + ",last_purse_deposits_serial_id=$7" + " WHERE master_pub=$8", + 8), /* Used in #postgres_get_auditor_progress_coin() */ GNUNET_PQ_make_prepare ("auditor_progress_select_coin", "SELECT" @@ -312,6 +325,7 @@ setup_connection (struct PostgresClosure *pg) ",last_refund_serial_id" ",last_recoup_serial_id" ",last_recoup_refresh_serial_id" + ",last_purse_deposits_serial_id" " FROM auditor_progress_coin" " WHERE master_pub=$1;", 1), @@ -325,8 +339,9 @@ setup_connection (struct PostgresClosure *pg) ",last_refund_serial_id" ",last_recoup_serial_id" ",last_recoup_refresh_serial_id" - ") VALUES ($1,$2,$3,$4,$5,$6,$7);", - 7), + ",last_purse_deposits_serial_id" + ") VALUES ($1,$2,$3,$4,$5,$6,$7,$8);", + 8), /* Used in #postgres_insert_wire_auditor_account_progress() */ GNUNET_PQ_make_prepare ("wire_auditor_account_progress_insert", "INSERT INTO wire_auditor_account_progress " @@ -1225,6 +1240,10 @@ postgres_insert_auditor_progress_reserve ( GNUNET_PQ_query_param_uint64 (&ppr->last_reserve_out_serial_id), GNUNET_PQ_query_param_uint64 (&ppr->last_reserve_recoup_serial_id), GNUNET_PQ_query_param_uint64 (&ppr->last_reserve_close_serial_id), + GNUNET_PQ_query_param_uint64 (&ppr->last_purse_merges_serial_id), + GNUNET_PQ_query_param_uint64 (&ppr->last_account_merges_serial_id), + GNUNET_PQ_query_param_uint64 (&ppr->last_history_requests_serial_id), + GNUNET_PQ_query_param_uint64 (&ppr->last_close_requests_serial_id), GNUNET_PQ_query_param_end }; @@ -1255,6 +1274,10 @@ postgres_update_auditor_progress_reserve ( GNUNET_PQ_query_param_uint64 (&ppr->last_reserve_out_serial_id), GNUNET_PQ_query_param_uint64 (&ppr->last_reserve_recoup_serial_id), GNUNET_PQ_query_param_uint64 (&ppr->last_reserve_close_serial_id), + GNUNET_PQ_query_param_uint64 (&ppr->last_purse_merges_serial_id), + GNUNET_PQ_query_param_uint64 (&ppr->last_account_merges_serial_id), + GNUNET_PQ_query_param_uint64 (&ppr->last_history_requests_serial_id), + GNUNET_PQ_query_param_uint64 (&ppr->last_close_requests_serial_id), GNUNET_PQ_query_param_auto_from_type (master_pub), GNUNET_PQ_query_param_end }; @@ -1293,6 +1316,14 @@ postgres_get_auditor_progress_reserve ( &ppr->last_reserve_recoup_serial_id), GNUNET_PQ_result_spec_uint64 ("last_reserve_close_serial_id", &ppr->last_reserve_close_serial_id), + GNUNET_PQ_result_spec_uint64 ("last_purse_merges_serial_id", + &ppr->last_purse_merges_serial_id), + GNUNET_PQ_result_spec_uint64 ("last_account_merges_serial_id", + &ppr->last_account_merges_serial_id), + GNUNET_PQ_result_spec_uint64 ("last_history_requests_serial_id", + &ppr->last_history_requests_serial_id), + GNUNET_PQ_result_spec_uint64 ("last_close_requests_serial_id", + &ppr->last_close_requests_serial_id), GNUNET_PQ_result_spec_end }; @@ -1503,6 +1534,7 @@ postgres_insert_auditor_progress_coin ( GNUNET_PQ_query_param_uint64 (&ppc->last_refund_serial_id), GNUNET_PQ_query_param_uint64 (&ppc->last_recoup_serial_id), GNUNET_PQ_query_param_uint64 (&ppc->last_recoup_refresh_serial_id), + GNUNET_PQ_query_param_uint64 (&ppc->last_purse_deposits_serial_id), GNUNET_PQ_query_param_end }; @@ -1535,6 +1567,7 @@ postgres_update_auditor_progress_coin ( GNUNET_PQ_query_param_uint64 (&ppc->last_refund_serial_id), GNUNET_PQ_query_param_uint64 (&ppc->last_recoup_serial_id), GNUNET_PQ_query_param_uint64 (&ppc->last_recoup_refresh_serial_id), + GNUNET_PQ_query_param_uint64 (&ppc->last_purse_deposits_serial_id), GNUNET_PQ_query_param_auto_from_type (master_pub), GNUNET_PQ_query_param_end }; @@ -1577,6 +1610,8 @@ postgres_get_auditor_progress_coin ( &ppc->last_recoup_serial_id), GNUNET_PQ_result_spec_uint64 ("last_recoup_refresh_serial_id", &ppc->last_recoup_refresh_serial_id), + GNUNET_PQ_result_spec_uint64 ("last_purse_deposits_serial_id", + &ppc->last_purse_deposits_serial_id), GNUNET_PQ_result_spec_end }; -- cgit v1.2.3