deal with some minor FIXMEs in auditor

This commit is contained in:
Christian Grothoff 2017-03-18 22:38:31 +01:00
parent 69ac028a13
commit 0f5ce284c4
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
4 changed files with 48 additions and 136 deletions

View File

@ -25,15 +25,18 @@
* given in the 'wire_out' table. This needs to be checked separately! * given in the 'wire_out' table. This needs to be checked separately!
* *
* TODO: * TODO:
* - COMPLETE: implement misc. FIXMEs * - FIXME: do proper transaction history check in #check_transaction_history()
* - COMPLETE: deal with risk / expired denomination keys in #sync_denomination * - COMPLETE: deal with risk / expired denomination keys in #sync_denomination()
* - SANITY: rename operations to better describe what they do! * - SANITY: rename functions/operations to better describe what they do!
* - OPTIMIZE/SIMPLIFY: modify auditordb to return DK when we inquire about deposit/refresh/refund, * - OPTIMIZE/SIMPLIFY: modify auditordb to return DK when we inquire about deposit/refresh/refund,
* so we can avoid the costly #get_coin_summary with the transaction history building * so we can avoid the costly #get_coin_summary with the transaction history building
* (at least during #analyze_coins); the logic may be partially useful in * (at least during #analyze_coins); the logic may be partially useful in
* #analyze_merchants (but we won't need the cache!) * #analyze_merchants (but we won't need the cache!)
* - MAJOR: check that aggregation records exist for deposits past payment deadline
* (or that there was a full refund and thus there is no aggregation)
* Conceptual issue: how do we deal with deposits that we already checked
* in the past? => Need a very separate check / pass for this!
* - BEAUTIFY: write reporting logic to output nice report beyond GNUNET_log() * - BEAUTIFY: write reporting logic to output nice report beyond GNUNET_log()
* - write logic to deal with emergency (#3887) -- and emergency-related tables!
*/ */
#include "platform.h" #include "platform.h"
#include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_util_lib.h>
@ -416,18 +419,6 @@ struct ReserveSummary
*/ */
struct GNUNET_TIME_Absolute a_expiration_date; struct GNUNET_TIME_Absolute a_expiration_date;
/**
* Previous last processed reserve_in serial ID, as remembered by the auditor.
* (updated on-the-fly in #handle_reserve_in()).
*/
uint64_t a_last_reserve_in_serial_id;
/**
* Previous last processed reserve_out serial ID, as remembered by the auditor.
* (updated on-the-fly in #handle_reserve_out()).
*/
uint64_t a_last_reserve_out_serial_id;
/** /**
* Did we have a previous reserve info? Used to decide between * Did we have a previous reserve info? Used to decide between
* UPDATE and INSERT later. Initialized in * UPDATE and INSERT later. Initialized in
@ -460,9 +451,7 @@ load_auditor_reserve_summary (struct ReserveSummary *rs)
&rowid, &rowid,
&rs->a_balance, &rs->a_balance,
&rs->a_withdraw_fee_balance, &rs->a_withdraw_fee_balance,
&rs->a_expiration_date, &rs->a_expiration_date);
&rs->a_last_reserve_in_serial_id,
&rs->a_last_reserve_out_serial_id);
if (GNUNET_SYSERR == ret) if (GNUNET_SYSERR == ret)
{ {
GNUNET_break (0); GNUNET_break (0);
@ -585,8 +574,6 @@ handle_reserve_in (void *cls,
&rs->total_in, &rs->total_in,
credit)); credit));
} }
GNUNET_assert (rowid >= rs->a_last_reserve_in_serial_id);
rs->a_last_reserve_in_serial_id = rowid + 1;
expiry = GNUNET_TIME_absolute_add (execution_date, expiry = GNUNET_TIME_absolute_add (execution_date,
TALER_IDLE_RESERVE_EXPIRATION_TIME); TALER_IDLE_RESERVE_EXPIRATION_TIME);
rs->a_expiration_date = GNUNET_TIME_absolute_max (rs->a_expiration_date, rs->a_expiration_date = GNUNET_TIME_absolute_max (rs->a_expiration_date,
@ -718,8 +705,6 @@ handle_reserve_out (void *cls,
&rs->total_out, &rs->total_out,
amount_with_fee)); amount_with_fee));
} }
GNUNET_assert (rowid >= rs->a_last_reserve_out_serial_id);
rs->a_last_reserve_out_serial_id = rowid + 1;
TALER_amount_ntoh (&withdraw_fee, TALER_amount_ntoh (&withdraw_fee,
&dki->properties.fee_withdraw); &dki->properties.fee_withdraw);
@ -862,9 +847,7 @@ verify_reserve_balance (void *cls,
&master_pub, &master_pub,
&balance, &balance,
&rs->a_withdraw_fee_balance, &rs->a_withdraw_fee_balance,
rs->a_expiration_date, rs->a_expiration_date);
rs->a_last_reserve_in_serial_id,
rs->a_last_reserve_out_serial_id);
else else
ret = adb->insert_reserve_info (adb->cls, ret = adb->insert_reserve_info (adb->cls,
asession, asession,
@ -872,9 +855,7 @@ verify_reserve_balance (void *cls,
&master_pub, &master_pub,
&balance, &balance,
&rs->a_withdraw_fee_balance, &rs->a_withdraw_fee_balance,
rs->a_expiration_date, rs->a_expiration_date);
rs->a_last_reserve_in_serial_id,
rs->a_last_reserve_out_serial_id);
if ( (GNUNET_YES != if ( (GNUNET_YES !=
TALER_amount_add (&rc->total_balance, TALER_amount_add (&rc->total_balance,
@ -1203,9 +1184,9 @@ sync_denomination (void *cls,
int ret; int ret;
// FIXME: if expired, insert remaining balance historic denomination revenue, // COMPLETE: if expired, insert remaining balance historic denomination revenue,
// DELETE denomination balance, and REDUCE cc->risk exposure! // DELETE denomination balance, and REDUCE cc->risk exposure!
if (0) if (0 /* COMPLETE: add expiration check! */)
{ {
if (ds->in_db) if (ds->in_db)
ret = adb->del_denomination_balance (adb->cls, ret = adb->del_denomination_balance (adb->cls,
@ -1306,7 +1287,7 @@ free_coin (void *cls,
* @param coin_pub public key of the coin to get information about * @param coin_pub public key of the coin to get information about
* @return NULL on error * @return NULL on error
*/ */
// FIXME: replace by something that just gets the denomination hash! // OPTIMIZE/SIMPLIFY: replace by something that just gets the denomination hash!
// (makes this part WAY more efficient!) // (makes this part WAY more efficient!)
static struct CoinSummary * static struct CoinSummary *
get_coin_summary (struct CoinContext *cc, get_coin_summary (struct CoinContext *cc,
@ -1774,10 +1755,6 @@ deposit_cb (void *cls,
} }
} }
/* TODO: *if* past pay_deadline, check that aggregation record
exists for the deposit, and if NOT, check that full _refund_
exists. */
return GNUNET_OK; return GNUNET_OK;
} }
@ -1903,7 +1880,7 @@ analyze_coins (void *cls)
/* setup 'cc' */ /* setup 'cc' */
cc.ret = GNUNET_OK; cc.ret = GNUNET_OK;
// FIXME: FIX misnomer "denomination_summary", as this is no longer exactly about denominations! // SANITY: FIX misnomer "denomination_summary", as this is no longer exactly about denominations!
dret = adb->get_denomination_summary (adb->cls, dret = adb->get_denomination_summary (adb->cls,
asession, asession,
&master_pub, &master_pub,
@ -1945,7 +1922,7 @@ analyze_coins (void *cls)
if (GNUNET_OK != if (GNUNET_OK !=
edb->select_reserves_out_above_serial_id (edb->cls, edb->select_reserves_out_above_serial_id (edb->cls,
esession, esession,
42LL, // FIXME pp.last_reserve_out_serial_id,
&withdraw_cb, &withdraw_cb,
&cc)) &cc))
{ {
@ -1957,7 +1934,7 @@ analyze_coins (void *cls)
if (GNUNET_OK != if (GNUNET_OK !=
edb->select_refreshs_above_serial_id (edb->cls, edb->select_refreshs_above_serial_id (edb->cls,
esession, esession,
42LL, // FIXME pp.last_melt_serial_id,
&refresh_session_cb, &refresh_session_cb,
&cc)) &cc))
{ {
@ -1969,7 +1946,7 @@ analyze_coins (void *cls)
if (GNUNET_OK != if (GNUNET_OK !=
edb->select_deposits_above_serial_id (edb->cls, edb->select_deposits_above_serial_id (edb->cls,
esession, esession,
42LL, // FIXME pp.last_deposit_serial_id,
&deposit_cb, &deposit_cb,
&cc)) &cc))
{ {
@ -1981,7 +1958,7 @@ analyze_coins (void *cls)
if (GNUNET_OK != if (GNUNET_OK !=
edb->select_refunds_above_serial_id (edb->cls, edb->select_refunds_above_serial_id (edb->cls,
esession, esession,
42LL, // FIXME pp.last_refund_serial_id,
&refund_cb, &refund_cb,
&cc)) &cc))
{ {
@ -1999,7 +1976,7 @@ analyze_coins (void *cls)
&cc); &cc);
GNUNET_CONTAINER_multihashmap_destroy (cc.coins); GNUNET_CONTAINER_multihashmap_destroy (cc.coins);
// FIXME: FIX misnomer "denomination_summary", as this is no longer about denominations! // SANITY: FIX misnomer "denomination_summary", as this is no longer about denominations!
if (GNUNET_YES == dret) if (GNUNET_YES == dret)
dret = adb->update_denomination_summary (adb->cls, dret = adb->update_denomination_summary (adb->cls,
asession, asession,
@ -2547,7 +2524,7 @@ analyze_merchants (void *cls)
if (GNUNET_SYSERR == if (GNUNET_SYSERR ==
edb->select_wire_out_above_serial_id (edb->cls, edb->select_wire_out_above_serial_id (edb->cls,
esession, esession,
42 /* FIXME */, pp.last_wire_out_serial_id,
&check_wire_out_cb, &check_wire_out_cb,
&mc)) &mc))
{ {
@ -2618,7 +2595,7 @@ incremental_processing (Analysis analysis,
(unsigned long long) pp.last_deposit_serial_id, (unsigned long long) pp.last_deposit_serial_id,
(unsigned long long) pp.last_melt_serial_id, (unsigned long long) pp.last_melt_serial_id,
(unsigned long long) pp.last_refund_serial_id, (unsigned long long) pp.last_refund_serial_id,
(unsigned long long) pp.last_prewire_serial_id); (unsigned long long) pp.last_wire_out_serial_id);
} }
ret = analysis (analysis_cls); ret = analysis (analysis_cls);
if (GNUNET_OK != ret) if (GNUNET_OK != ret)
@ -2643,7 +2620,7 @@ incremental_processing (Analysis analysis,
(unsigned long long) pp.last_deposit_serial_id, (unsigned long long) pp.last_deposit_serial_id,
(unsigned long long) pp.last_melt_serial_id, (unsigned long long) pp.last_melt_serial_id,
(unsigned long long) pp.last_refund_serial_id, (unsigned long long) pp.last_refund_serial_id,
(unsigned long long) pp.last_prewire_serial_id); (unsigned long long) pp.last_wire_out_serial_id);
return GNUNET_OK; return GNUNET_OK;
} }

View File

@ -279,7 +279,7 @@ postgres_create_tables (void *cls)
",last_deposit_serial_id INT8 NOT NULL" ",last_deposit_serial_id INT8 NOT NULL"
",last_melt_serial_id INT8 NOT NULL" ",last_melt_serial_id INT8 NOT NULL"
",last_refund_serial_id INT8 NOT NULL" ",last_refund_serial_id INT8 NOT NULL"
",last_prewire_serial_id INT8 NOT NULL" ",last_wire_out_serial_id INT8 NOT NULL"
")"); ")");
/* Table with all of the customer reserves and their respective /* Table with all of the customer reserves and their respective
@ -298,8 +298,6 @@ postgres_create_tables (void *cls)
",withdraw_fee_balance_frac INT4 NOT NULL" ",withdraw_fee_balance_frac INT4 NOT NULL"
",withdraw_fee_balance_curr VARCHAR("TALER_CURRENCY_LEN_STR") NOT NULL" ",withdraw_fee_balance_curr VARCHAR("TALER_CURRENCY_LEN_STR") NOT NULL"
",expiration_date INT8 NOT NULL" ",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" ",auditor_reserves_rowid BIGSERIAL"
")"); ")");
@ -552,7 +550,7 @@ postgres_prepare (PGconn *db_conn)
",last_deposit_serial_id" ",last_deposit_serial_id"
",last_melt_serial_id" ",last_melt_serial_id"
",last_refund_serial_id" ",last_refund_serial_id"
",last_prewire_serial_id" ",last_wire_out_serial_id"
") VALUES ($1,$2,$3,$4,$5,$6,$7);", ") VALUES ($1,$2,$3,$4,$5,$6,$7);",
7, NULL); 7, NULL);
@ -564,7 +562,7 @@ postgres_prepare (PGconn *db_conn)
",last_deposit_serial_id=$3" ",last_deposit_serial_id=$3"
",last_melt_serial_id=$4" ",last_melt_serial_id=$4"
",last_refund_serial_id=$5" ",last_refund_serial_id=$5"
",last_prewire_serial_id=$6" ",last_wire_out_serial_id=$6"
" WHERE master_pub=$7", " WHERE master_pub=$7",
7, NULL); 7, NULL);
@ -576,7 +574,7 @@ postgres_prepare (PGconn *db_conn)
",last_deposit_serial_id" ",last_deposit_serial_id"
",last_melt_serial_id" ",last_melt_serial_id"
",last_refund_serial_id" ",last_refund_serial_id"
",last_prewire_serial_id" ",last_wire_out_serial_id"
" FROM auditor_progress" " FROM auditor_progress"
" WHERE master_pub=$1;", " WHERE master_pub=$1;",
1, NULL); 1, NULL);
@ -593,10 +591,8 @@ postgres_prepare (PGconn *db_conn)
",withdraw_fee_balance_frac" ",withdraw_fee_balance_frac"
",withdraw_fee_balance_curr" ",withdraw_fee_balance_curr"
",expiration_date" ",expiration_date"
",last_reserve_in_serial_id" ") VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9);",
",last_reserve_out_serial_id" 9, NULL);
") VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11);",
11, NULL);
/* Used in #postgres_update_reserve_info() */ /* Used in #postgres_update_reserve_info() */
PREPARE ("auditor_reserves_update", PREPARE ("auditor_reserves_update",
@ -608,10 +604,8 @@ postgres_prepare (PGconn *db_conn)
",withdraw_fee_balance_frac=$5" ",withdraw_fee_balance_frac=$5"
",withdraw_fee_balance_curr=$6" ",withdraw_fee_balance_curr=$6"
",expiration_date=$7" ",expiration_date=$7"
",last_reserve_in_serial_id=$8" " WHERE reserve_pub=$8 AND master_pub=$9;",
",last_reserve_out_serial_id=$9" 9, NULL);
" WHERE reserve_pub=$10 AND master_pub=$11;",
11, NULL);
/* Used in #postgres_get_reserve_info() */ /* Used in #postgres_get_reserve_info() */
PREPARE ("auditor_reserves_select", PREPARE ("auditor_reserves_select",
@ -623,8 +617,6 @@ postgres_prepare (PGconn *db_conn)
",withdraw_fee_balance_frac" ",withdraw_fee_balance_frac"
",withdraw_fee_balance_curr" ",withdraw_fee_balance_curr"
",expiration_date" ",expiration_date"
",last_reserve_in_serial_id"
",last_reserve_out_serial_id"
",auditor_reserves_rowid" ",auditor_reserves_rowid"
" FROM auditor_reserves" " FROM auditor_reserves"
" WHERE reserve_pub=$1 AND master_pub=$2;", " WHERE reserve_pub=$1 AND master_pub=$2;",
@ -1278,7 +1270,7 @@ postgres_insert_auditor_progress (void *cls,
GNUNET_PQ_query_param_uint64 (&pp->last_deposit_serial_id), GNUNET_PQ_query_param_uint64 (&pp->last_deposit_serial_id),
GNUNET_PQ_query_param_uint64 (&pp->last_melt_serial_id), GNUNET_PQ_query_param_uint64 (&pp->last_melt_serial_id),
GNUNET_PQ_query_param_uint64 (&pp->last_refund_serial_id), GNUNET_PQ_query_param_uint64 (&pp->last_refund_serial_id),
GNUNET_PQ_query_param_uint64 (&pp->last_prewire_serial_id), GNUNET_PQ_query_param_uint64 (&pp->last_wire_out_serial_id),
GNUNET_PQ_query_param_end GNUNET_PQ_query_param_end
}; };
int ret; int ret;
@ -1323,7 +1315,7 @@ postgres_update_auditor_progress (void *cls,
GNUNET_PQ_query_param_uint64 (&pp->last_deposit_serial_id), GNUNET_PQ_query_param_uint64 (&pp->last_deposit_serial_id),
GNUNET_PQ_query_param_uint64 (&pp->last_melt_serial_id), GNUNET_PQ_query_param_uint64 (&pp->last_melt_serial_id),
GNUNET_PQ_query_param_uint64 (&pp->last_refund_serial_id), GNUNET_PQ_query_param_uint64 (&pp->last_refund_serial_id),
GNUNET_PQ_query_param_uint64 (&pp->last_prewire_serial_id), GNUNET_PQ_query_param_uint64 (&pp->last_wire_out_serial_id),
GNUNET_PQ_query_param_auto_from_type (master_pub), GNUNET_PQ_query_param_auto_from_type (master_pub),
GNUNET_PQ_query_param_end GNUNET_PQ_query_param_end
}; };
@ -1373,7 +1365,7 @@ postgres_get_auditor_progress (void *cls,
GNUNET_PQ_result_spec_uint64 ("last_deposit_serial_id", &pp->last_deposit_serial_id), GNUNET_PQ_result_spec_uint64 ("last_deposit_serial_id", &pp->last_deposit_serial_id),
GNUNET_PQ_result_spec_uint64 ("last_melt_serial_id", &pp->last_melt_serial_id), GNUNET_PQ_result_spec_uint64 ("last_melt_serial_id", &pp->last_melt_serial_id),
GNUNET_PQ_result_spec_uint64 ("last_refund_serial_id", &pp->last_refund_serial_id), GNUNET_PQ_result_spec_uint64 ("last_refund_serial_id", &pp->last_refund_serial_id),
GNUNET_PQ_result_spec_uint64 ("last_prewire_serial_id", &pp->last_prewire_serial_id), GNUNET_PQ_result_spec_uint64 ("last_wire_out_serial_id", &pp->last_wire_out_serial_id),
GNUNET_PQ_result_spec_end GNUNET_PQ_result_spec_end
}; };
@ -1424,10 +1416,6 @@ postgres_get_auditor_progress (void *cls,
* @param withdraw_fee_balance amount the exchange gained in withdraw fees * @param withdraw_fee_balance amount the exchange gained in withdraw fees
* due to withdrawals from this reserve * due to withdrawals from this reserve
* @param expiration_date expiration date of the reserve * @param expiration_date expiration date of the reserve
* @param last_reserve_in_serial_id up to which point did we consider
* incoming transfers for the above information
* @param last_reserve_out_serial_id up to which point did we consider
* withdrawals for the above information
* @return #GNUNET_OK on success; #GNUNET_SYSERR on failure * @return #GNUNET_OK on success; #GNUNET_SYSERR on failure
*/ */
static int static int
@ -1437,9 +1425,7 @@ postgres_insert_reserve_info (void *cls,
const struct TALER_MasterPublicKeyP *master_pub, const struct TALER_MasterPublicKeyP *master_pub,
const struct TALER_Amount *reserve_balance, const struct TALER_Amount *reserve_balance,
const struct TALER_Amount *withdraw_fee_balance, const struct TALER_Amount *withdraw_fee_balance,
struct GNUNET_TIME_Absolute expiration_date, struct GNUNET_TIME_Absolute expiration_date)
uint64_t last_reserve_in_serial_id,
uint64_t last_reserve_out_serial_id)
{ {
PGresult *result; PGresult *result;
int ret; int ret;
@ -1449,8 +1435,6 @@ postgres_insert_reserve_info (void *cls,
TALER_PQ_query_param_amount (reserve_balance), TALER_PQ_query_param_amount (reserve_balance),
TALER_PQ_query_param_amount (withdraw_fee_balance), TALER_PQ_query_param_amount (withdraw_fee_balance),
GNUNET_PQ_query_param_auto_from_type (&expiration_date), GNUNET_PQ_query_param_auto_from_type (&expiration_date),
GNUNET_PQ_query_param_uint64 (&last_reserve_in_serial_id),
GNUNET_PQ_query_param_uint64 (&last_reserve_out_serial_id),
GNUNET_PQ_query_param_end GNUNET_PQ_query_param_end
}; };
@ -1487,10 +1471,6 @@ postgres_insert_reserve_info (void *cls,
* @param withdraw_fee_balance amount the exchange gained in withdraw fees * @param withdraw_fee_balance amount the exchange gained in withdraw fees
* due to withdrawals from this reserve * due to withdrawals from this reserve
* @param expiration_date expiration date of the reserve * @param expiration_date expiration date of the reserve
* @param last_reserve_in_serial_id up to which point did we consider
* incoming transfers for the above information
* @param last_reserve_out_serial_id up to which point did we consider
* withdrawals for the above information
* @return #GNUNET_OK on success; #GNUNET_SYSERR on failure * @return #GNUNET_OK on success; #GNUNET_SYSERR on failure
*/ */
static int static int
@ -1500,9 +1480,7 @@ postgres_update_reserve_info (void *cls,
const struct TALER_MasterPublicKeyP *master_pub, const struct TALER_MasterPublicKeyP *master_pub,
const struct TALER_Amount *reserve_balance, const struct TALER_Amount *reserve_balance,
const struct TALER_Amount *withdraw_fee_balance, const struct TALER_Amount *withdraw_fee_balance,
struct GNUNET_TIME_Absolute expiration_date, struct GNUNET_TIME_Absolute expiration_date)
uint64_t last_reserve_in_serial_id,
uint64_t last_reserve_out_serial_id)
{ {
PGresult *result; PGresult *result;
int ret; int ret;
@ -1510,8 +1488,6 @@ postgres_update_reserve_info (void *cls,
TALER_PQ_query_param_amount (reserve_balance), TALER_PQ_query_param_amount (reserve_balance),
TALER_PQ_query_param_amount (withdraw_fee_balance), TALER_PQ_query_param_amount (withdraw_fee_balance),
GNUNET_PQ_query_param_auto_from_type (&expiration_date), GNUNET_PQ_query_param_auto_from_type (&expiration_date),
GNUNET_PQ_query_param_uint64 (&last_reserve_in_serial_id),
GNUNET_PQ_query_param_uint64 (&last_reserve_out_serial_id),
GNUNET_PQ_query_param_auto_from_type (reserve_pub), GNUNET_PQ_query_param_auto_from_type (reserve_pub),
GNUNET_PQ_query_param_auto_from_type (master_pub), GNUNET_PQ_query_param_auto_from_type (master_pub),
GNUNET_PQ_query_param_end GNUNET_PQ_query_param_end
@ -1591,10 +1567,6 @@ postgres_del_reserve_info (void *cls,
* @param[out] withdraw_fee_balance amount the exchange gained in withdraw fees * @param[out] withdraw_fee_balance amount the exchange gained in withdraw fees
* due to withdrawals from this reserve * due to withdrawals from this reserve
* @param[out] expiration_date expiration date of the reserve * @param[out] expiration_date expiration date of the reserve
* @param[out] last_reserve_in_serial_id up to which point did we consider
* incoming transfers for the above information
* @param[out] last_reserve_out_serial_id up to which point did we consider
* withdrawals for the above information
* @return #GNUNET_OK on success; #GNUNET_NO if there is no known * @return #GNUNET_OK on success; #GNUNET_NO if there is no known
* record about this reserve; #GNUNET_SYSERR on failure * record about this reserve; #GNUNET_SYSERR on failure
*/ */
@ -1606,9 +1578,7 @@ postgres_get_reserve_info (void *cls,
uint64_t *rowid, uint64_t *rowid,
struct TALER_Amount *reserve_balance, struct TALER_Amount *reserve_balance,
struct TALER_Amount *withdraw_fee_balance, struct TALER_Amount *withdraw_fee_balance,
struct GNUNET_TIME_Absolute *expiration_date, struct GNUNET_TIME_Absolute *expiration_date)
uint64_t *last_reserve_in_serial_id,
uint64_t *last_reserve_out_serial_id)
{ {
struct GNUNET_PQ_QueryParam params[] = { struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (reserve_pub), GNUNET_PQ_query_param_auto_from_type (reserve_pub),
@ -1641,8 +1611,6 @@ postgres_get_reserve_info (void *cls,
TALER_PQ_result_spec_amount ("reserve_balance", reserve_balance), TALER_PQ_result_spec_amount ("reserve_balance", reserve_balance),
TALER_PQ_result_spec_amount ("withdraw_fee_balance", withdraw_fee_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_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_uint64 ("auditor_reserves_rowid", rowid),
GNUNET_PQ_result_spec_end GNUNET_PQ_result_spec_end
}; };

View File

@ -208,7 +208,7 @@ run (void *cls)
.last_deposit_serial_id = 123, .last_deposit_serial_id = 123,
.last_melt_serial_id = 456, .last_melt_serial_id = 456,
.last_refund_serial_id = 789, .last_refund_serial_id = 789,
.last_prewire_serial_id = 555 .last_wire_out_serial_id = 555
}; };
struct TALER_AUDITORDB_ProgressPoint pp2 = { struct TALER_AUDITORDB_ProgressPoint pp2 = {
.last_reserve_in_serial_id = 0, .last_reserve_in_serial_id = 0,
@ -216,7 +216,7 @@ run (void *cls)
.last_deposit_serial_id = 0, .last_deposit_serial_id = 0,
.last_melt_serial_id = 0, .last_melt_serial_id = 0,
.last_refund_serial_id = 0, .last_refund_serial_id = 0,
.last_prewire_serial_id = 0 .last_wire_out_serial_id = 0
}; };
FAILIF (GNUNET_OK != FAILIF (GNUNET_OK !=
@ -232,7 +232,7 @@ run (void *cls)
pp.last_deposit_serial_id++; pp.last_deposit_serial_id++;
pp.last_melt_serial_id++; pp.last_melt_serial_id++;
pp.last_refund_serial_id++; pp.last_refund_serial_id++;
pp.last_prewire_serial_id++; pp.last_wire_out_serial_id++;
FAILIF (GNUNET_OK != FAILIF (GNUNET_OK !=
plugin->update_auditor_progress (plugin->cls, plugin->update_auditor_progress (plugin->cls,
@ -253,7 +253,7 @@ run (void *cls)
(pp.last_deposit_serial_id != pp2.last_deposit_serial_id) || (pp.last_deposit_serial_id != pp2.last_deposit_serial_id) ||
(pp.last_melt_serial_id != pp2.last_melt_serial_id) || (pp.last_melt_serial_id != pp2.last_melt_serial_id) ||
(pp.last_refund_serial_id != pp2.last_refund_serial_id) || (pp.last_refund_serial_id != pp2.last_refund_serial_id) ||
(pp.last_prewire_serial_id != pp2.last_prewire_serial_id) ); (pp.last_wire_out_serial_id != pp2.last_wire_out_serial_id) );
GNUNET_log (GNUNET_ERROR_TYPE_INFO, GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Test: insert_reserve_info\n"); "Test: insert_reserve_info\n");
@ -275,16 +275,11 @@ run (void *cls)
&master_pub, &master_pub,
&reserve_balance, &reserve_balance,
&withdraw_fee_balance, &withdraw_fee_balance,
past, past));
pp.last_reserve_in_serial_id,
pp.last_reserve_out_serial_id));
GNUNET_log (GNUNET_ERROR_TYPE_INFO, GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Test: update_reserve_info\n"); "Test: update_reserve_info\n");
pp.last_reserve_in_serial_id++;
pp.last_reserve_out_serial_id++;
FAILIF (GNUNET_OK != FAILIF (GNUNET_OK !=
plugin->update_reserve_info (plugin->cls, plugin->update_reserve_info (plugin->cls,
session, session,
@ -292,9 +287,7 @@ run (void *cls)
&master_pub, &master_pub,
&reserve_balance, &reserve_balance,
&withdraw_fee_balance, &withdraw_fee_balance,
future, future));
pp.last_reserve_in_serial_id,
pp.last_reserve_out_serial_id));
GNUNET_log (GNUNET_ERROR_TYPE_INFO, GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Test: get_reserve_info\n"); "Test: get_reserve_info\n");
@ -307,15 +300,11 @@ run (void *cls)
&rowid, &rowid,
&reserve_balance2, &reserve_balance2,
&withdraw_fee_balance2, &withdraw_fee_balance2,
&date, &date));
&pp2.last_reserve_in_serial_id,
&pp2.last_reserve_out_serial_id));
FAILIF (0 != memcmp (&date, &future, sizeof (future)) FAILIF (0 != memcmp (&date, &future, sizeof (future))
|| 0 != memcmp (&reserve_balance2, &reserve_balance, sizeof (reserve_balance)) || 0 != memcmp (&reserve_balance2, &reserve_balance, sizeof (reserve_balance))
|| 0 != memcmp (&withdraw_fee_balance2, &withdraw_fee_balance, sizeof (withdraw_fee_balance)) || 0 != memcmp (&withdraw_fee_balance2, &withdraw_fee_balance, sizeof (withdraw_fee_balance)));
|| pp2.last_reserve_in_serial_id != pp.last_reserve_in_serial_id
|| pp2.last_reserve_out_serial_id != pp.last_reserve_out_serial_id);
GNUNET_log (GNUNET_ERROR_TYPE_INFO, GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Test: insert_reserve_summary\n"); "Test: insert_reserve_summary\n");

View File

@ -146,11 +146,7 @@ struct TALER_AUDITORDB_ProgressPoint
/** /**
* last_prewire_serial_id serial ID of the last prewire transfer the auditor processed * last_prewire_serial_id serial ID of the last prewire transfer the auditor processed
*/ */
uint64_t last_prewire_serial_id; uint64_t last_wire_out_serial_id;
// FIXME: the above does not quite work, as independent transactions
// touch certain tables (i.e. reserves_out), so we need some of
// these counters more than once!
}; };
@ -358,10 +354,6 @@ struct TALER_AUDITORDB_Plugin
* @param withdraw_fee_balance amount the exchange gained in withdraw fees * @param withdraw_fee_balance amount the exchange gained in withdraw fees
* due to withdrawals from this reserve * due to withdrawals from this reserve
* @param expiration_date expiration date of the reserve * @param expiration_date expiration date of the reserve
* @param last_reserve_in_serial_id up to which point did we consider
* incoming transfers for the above information
* @param last_reserve_out_serial_id up to which point did we consider
* withdrawals for the above information
* @return #GNUNET_OK on success; #GNUNET_SYSERR on failure * @return #GNUNET_OK on success; #GNUNET_SYSERR on failure
*/ */
int int
@ -371,9 +363,7 @@ struct TALER_AUDITORDB_Plugin
const struct TALER_MasterPublicKeyP *master_pub, const struct TALER_MasterPublicKeyP *master_pub,
const struct TALER_Amount *reserve_balance, const struct TALER_Amount *reserve_balance,
const struct TALER_Amount *withdraw_fee_balance, const struct TALER_Amount *withdraw_fee_balance,
struct GNUNET_TIME_Absolute expiration_date, struct GNUNET_TIME_Absolute expiration_date);
uint64_t last_reserve_in_serial_id,
uint64_t last_reserve_out_serial_id);
/** /**
@ -388,10 +378,6 @@ struct TALER_AUDITORDB_Plugin
* @param withdraw_fee_balance amount the exchange gained in withdraw fees * @param withdraw_fee_balance amount the exchange gained in withdraw fees
* due to withdrawals from this reserve * due to withdrawals from this reserve
* @param expiration_date expiration date of the reserve * @param expiration_date expiration date of the reserve
* @param last_reserve_in_serial_id up to which point did we consider
* incoming transfers for the above information
* @param last_reserve_out_serial_id up to which point did we consider
* withdrawals for the above information
* @return #GNUNET_OK on success; #GNUNET_SYSERR on failure * @return #GNUNET_OK on success; #GNUNET_SYSERR on failure
*/ */
int int
@ -401,9 +387,7 @@ struct TALER_AUDITORDB_Plugin
const struct TALER_MasterPublicKeyP *master_pub, const struct TALER_MasterPublicKeyP *master_pub,
const struct TALER_Amount *reserve_balance, const struct TALER_Amount *reserve_balance,
const struct TALER_Amount *withdraw_fee_balance, const struct TALER_Amount *withdraw_fee_balance,
struct GNUNET_TIME_Absolute expiration_date, struct GNUNET_TIME_Absolute expiration_date);
uint64_t last_reserve_in_serial_id,
uint64_t last_reserve_out_serial_id);
/** /**
@ -418,10 +402,6 @@ struct TALER_AUDITORDB_Plugin
* @param[out] withdraw_fee_balance amount the exchange gained in withdraw fees * @param[out] withdraw_fee_balance amount the exchange gained in withdraw fees
* due to withdrawals from this reserve * due to withdrawals from this reserve
* @param[out] expiration_date expiration date of the reserve * @param[out] expiration_date expiration date of the reserve
* @param[out] last_reserve_in_serial_id up to which point did we consider
* incoming transfers for the above information
* @param[out] last_reserve_out_serial_id up to which point did we consider
* withdrawals for the above information
* @return #GNUNET_OK on success; #GNUNET_NO if there is no known * @return #GNUNET_OK on success; #GNUNET_NO if there is no known
* record about this reserve; #GNUNET_SYSERR on failure * record about this reserve; #GNUNET_SYSERR on failure
*/ */
@ -433,9 +413,7 @@ struct TALER_AUDITORDB_Plugin
uint64_t *rowid, uint64_t *rowid,
struct TALER_Amount *reserve_balance, struct TALER_Amount *reserve_balance,
struct TALER_Amount *withdraw_fee_balance, struct TALER_Amount *withdraw_fee_balance,
struct GNUNET_TIME_Absolute *expiration_date, struct GNUNET_TIME_Absolute *expiration_date);
uint64_t *last_reserve_in_serial_id,
uint64_t *last_reserve_out_serial_id);
/** /**