diff --git a/src/auditor/taler-auditor.c b/src/auditor/taler-auditor.c index e70615c64..94a72632d 100644 --- a/src/auditor/taler-auditor.c +++ b/src/auditor/taler-auditor.c @@ -26,7 +26,6 @@ * * TODO: * - modify auditordb to allow multiple last serial IDs per table in progress tracking - * - modify auditordb to return row ID where we need it for diagnostics * - implement coin/denomination audit * - implement merchant deposit audit * - see if we need more tables there @@ -367,11 +366,13 @@ static int load_auditor_reserve_summary (struct ReserveSummary *rs) { int ret; + uint64_t rowid; ret = adb->get_reserve_info (adb->cls, asession, &rs->reserve_pub, &master_pub, + &rowid, &rs->a_balance, &rs->a_withdraw_fee_balance, &rs->a_expiration_date, @@ -402,7 +403,7 @@ load_auditor_reserve_summary (struct ReserveSummary *rs) &rs->a_balance)) ) { report_row_inconsistency ("auditor-reserve-info", - UINT64_MAX, /* FIXME: modify API to get rowid! */ + rowid, "currencies for reserve differ"); /* TODO: find a sane way to continue... */ GNUNET_break (0); diff --git a/src/auditordb/plugin_auditordb_postgres.c b/src/auditordb/plugin_auditordb_postgres.c index 989e54aea..1784fdf5e 100644 --- a/src/auditordb/plugin_auditordb_postgres.c +++ b/src/auditordb/plugin_auditordb_postgres.c @@ -300,6 +300,7 @@ postgres_create_tables (void *cls) ",expiration_date INT8 NOT NULL" ",last_reserve_in_serial_id INT8 NOT NULL" ",last_reserve_out_serial_id INT8 NOT NULL" + ",auditor_reserves_rowid BIGSERIAL" ")"); SQLEXEC_INDEX("CREATE INDEX auditor_reserves_by_reserve_pub " @@ -645,6 +646,7 @@ postgres_prepare (PGconn *db_conn) ",expiration_date" ",last_reserve_in_serial_id" ",last_reserve_out_serial_id" + ",auditor_reserves_rowid" " FROM auditor_reserves" " WHERE reserve_pub=$1 AND master_pub=$2;", 2, NULL); @@ -1656,6 +1658,7 @@ postgres_del_reserve_info (void *cls, * @param session connection to use * @param reserve_pub public key of the reserve * @param master_pub master public key of the exchange + * @param[out] rowid which row did we get the information from * @param[out] reserve_balance amount stored in the reserve * @param[out] withdraw_fee_balance amount the exchange gained in withdraw fees * due to withdrawals from this reserve @@ -1672,6 +1675,7 @@ postgres_get_reserve_info (void *cls, struct TALER_AUDITORDB_Session *session, const struct TALER_ReservePublicKeyP *reserve_pub, const struct TALER_MasterPublicKeyP *master_pub, + uint64_t *rowid, struct TALER_Amount *reserve_balance, struct TALER_Amount *withdraw_fee_balance, struct GNUNET_TIME_Absolute *expiration_date, @@ -1708,12 +1712,10 @@ postgres_get_reserve_info (void *cls, struct GNUNET_PQ_ResultSpec rs[] = { TALER_PQ_result_spec_amount ("reserve_balance", reserve_balance), TALER_PQ_result_spec_amount ("withdraw_fee_balance", withdraw_fee_balance), - GNUNET_PQ_result_spec_auto_from_type ("expiration_date", expiration_date), - GNUNET_PQ_result_spec_uint64 ("last_reserve_in_serial_id", last_reserve_in_serial_id), GNUNET_PQ_result_spec_uint64 ("last_reserve_out_serial_id", last_reserve_out_serial_id), - + GNUNET_PQ_result_spec_uint64 ("auditor_reserves_rowid", rowid), GNUNET_PQ_result_spec_end }; if (GNUNET_OK != diff --git a/src/auditordb/test_auditordb.c b/src/auditordb/test_auditordb.c index 5f110865d..95e79bdb3 100644 --- a/src/auditordb/test_auditordb.c +++ b/src/auditordb/test_auditordb.c @@ -73,6 +73,7 @@ run (void *cls) { struct GNUNET_CONFIGURATION_Handle *cfg = cls; struct TALER_AUDITORDB_Session *session; + uint64_t rowid; GNUNET_log (GNUNET_ERROR_TYPE_INFO, "loading database plugin\n"); @@ -303,6 +304,7 @@ run (void *cls) session, &reserve_pub, &master_pub, + &rowid, &reserve_balance2, &withdraw_fee_balance2, &date, diff --git a/src/include/taler_auditordb_plugin.h b/src/include/taler_auditordb_plugin.h index dfec1c76e..80e6eb243 100644 --- a/src/include/taler_auditordb_plugin.h +++ b/src/include/taler_auditordb_plugin.h @@ -413,6 +413,7 @@ struct TALER_AUDITORDB_Plugin * @param session connection to use * @param reserve_pub public key of the reserve * @param master_pub master public key of the exchange + * @param[out] rowid which row did we get the information from * @param[out] reserve_balance amount stored in the reserve * @param[out] withdraw_fee_balance amount the exchange gained in withdraw fees * due to withdrawals from this reserve @@ -429,6 +430,7 @@ struct TALER_AUDITORDB_Plugin struct TALER_AUDITORDB_Session *session, const struct TALER_ReservePublicKeyP *reserve_pub, const struct TALER_MasterPublicKeyP *master_pub, + uint64_t *rowid, struct TALER_Amount *reserve_balance, struct TALER_Amount *withdraw_fee_balance, struct GNUNET_TIME_Absolute *expiration_date,