-preparatory steps to expand auditor to know about purse and history fees
This commit is contained in:
parent
568d27abe5
commit
83be3173d4
@ -132,6 +132,16 @@ static struct TALER_Amount total_irregular_recoups;
|
|||||||
*/
|
*/
|
||||||
static struct TALER_Amount total_withdraw_fee_income;
|
static struct TALER_Amount total_withdraw_fee_income;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Total purse fees earned.
|
||||||
|
*/
|
||||||
|
static struct TALER_Amount total_purse_fee_income;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Total history fees earned.
|
||||||
|
*/
|
||||||
|
static struct TALER_Amount total_history_fee_income;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Array of reports about coin operations with bad signatures.
|
* Array of reports about coin operations with bad signatures.
|
||||||
*/
|
*/
|
||||||
@ -297,7 +307,7 @@ struct ReserveSummary
|
|||||||
* #load_auditor_reserve_summary() together with the a-* values
|
* #load_auditor_reserve_summary() together with the a-* values
|
||||||
* (if available).
|
* (if available).
|
||||||
*/
|
*/
|
||||||
int had_ri;
|
bool had_ri;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -331,7 +341,7 @@ load_auditor_reserve_summary (struct ReserveSummary *rs)
|
|||||||
}
|
}
|
||||||
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
|
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
|
||||||
{
|
{
|
||||||
rs->had_ri = GNUNET_NO;
|
rs->had_ri = false;
|
||||||
GNUNET_assert (GNUNET_OK ==
|
GNUNET_assert (GNUNET_OK ==
|
||||||
TALER_amount_set_zero (rs->total_in.currency,
|
TALER_amount_set_zero (rs->total_in.currency,
|
||||||
&rs->balance_at_previous_audit));
|
&rs->balance_at_previous_audit));
|
||||||
@ -344,7 +354,7 @@ load_auditor_reserve_summary (struct ReserveSummary *rs)
|
|||||||
TALER_amount2s (&rs->balance_at_previous_audit));
|
TALER_amount2s (&rs->balance_at_previous_audit));
|
||||||
return GNUNET_DB_STATUS_SUCCESS_NO_RESULTS;
|
return GNUNET_DB_STATUS_SUCCESS_NO_RESULTS;
|
||||||
}
|
}
|
||||||
rs->had_ri = GNUNET_YES;
|
rs->had_ri = true;
|
||||||
if ( (GNUNET_YES !=
|
if ( (GNUNET_YES !=
|
||||||
TALER_amount_cmp_currency (&rs->balance_at_previous_audit,
|
TALER_amount_cmp_currency (&rs->balance_at_previous_audit,
|
||||||
&rs->a_withdraw_fee_balance)) ||
|
&rs->a_withdraw_fee_balance)) ||
|
||||||
@ -401,7 +411,7 @@ struct ReserveContext
|
|||||||
* @param execution_date when did we receive the funds
|
* @param execution_date when did we receive the funds
|
||||||
* @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop
|
* @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop
|
||||||
*/
|
*/
|
||||||
static int
|
static enum GNUNET_GenericReturnValue
|
||||||
handle_reserve_in (void *cls,
|
handle_reserve_in (void *cls,
|
||||||
uint64_t rowid,
|
uint64_t rowid,
|
||||||
const struct TALER_ReservePublicKeyP *reserve_pub,
|
const struct TALER_ReservePublicKeyP *reserve_pub,
|
||||||
@ -901,7 +911,7 @@ get_closing_fee (const char *receiver_account,
|
|||||||
* @param transfer_details details about the wire transfer
|
* @param transfer_details details about the wire transfer
|
||||||
* @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop
|
* @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop
|
||||||
*/
|
*/
|
||||||
static int
|
static enum GNUNET_GenericReturnValue
|
||||||
handle_reserve_closed (
|
handle_reserve_closed (
|
||||||
void *cls,
|
void *cls,
|
||||||
uint64_t rowid,
|
uint64_t rowid,
|
||||||
@ -981,7 +991,7 @@ handle_reserve_closed (
|
|||||||
}
|
}
|
||||||
if (NULL == rs->sender_account)
|
if (NULL == rs->sender_account)
|
||||||
{
|
{
|
||||||
GNUNET_break (GNUNET_NO == rs->had_ri);
|
GNUNET_break (! rs->had_ri);
|
||||||
report_row_inconsistency ("reserves_close",
|
report_row_inconsistency ("reserves_close",
|
||||||
rowid,
|
rowid,
|
||||||
"target account not verified, auditor does not know reserve");
|
"target account not verified, auditor does not know reserve");
|
||||||
@ -1014,7 +1024,7 @@ handle_reserve_closed (
|
|||||||
* @param value a `struct ReserveSummary`
|
* @param value a `struct ReserveSummary`
|
||||||
* @return #GNUNET_OK to process more entries
|
* @return #GNUNET_OK to process more entries
|
||||||
*/
|
*/
|
||||||
static int
|
static enum GNUNET_GenericReturnValue
|
||||||
verify_reserve_balance (void *cls,
|
verify_reserve_balance (void *cls,
|
||||||
const struct GNUNET_HashCode *key,
|
const struct GNUNET_HashCode *key,
|
||||||
void *value)
|
void *value)
|
||||||
@ -1332,17 +1342,24 @@ analyze_reserves (void *cls)
|
|||||||
{
|
{
|
||||||
ppr_start = ppr;
|
ppr_start = ppr;
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
||||||
"Resuming reserve audit at %llu/%llu/%llu/%llu\n",
|
"Resuming reserve audit at %llu/%llu/%llu/%llu/%llu/%llu/%llu/%llu/%llu\n",
|
||||||
(unsigned long long) ppr.last_reserve_in_serial_id,
|
(unsigned long long) ppr.last_reserve_in_serial_id,
|
||||||
(unsigned long long) ppr.last_reserve_out_serial_id,
|
(unsigned long long) ppr.last_reserve_out_serial_id,
|
||||||
(unsigned long long) ppr.last_reserve_recoup_serial_id,
|
(unsigned long long) ppr.last_reserve_recoup_serial_id,
|
||||||
(unsigned long long) ppr.last_reserve_close_serial_id);
|
(unsigned long long) ppr.last_reserve_close_serial_id,
|
||||||
|
(unsigned long long) ppr.last_purse_merges_serial_id,
|
||||||
|
(unsigned long long) ppr.last_purse_deposits_serial_id,
|
||||||
|
(unsigned long long) ppr.last_account_merges_serial_id,
|
||||||
|
(unsigned long long) ppr.last_history_requests_serial_id,
|
||||||
|
(unsigned long long) ppr.last_close_requests_serial_id);
|
||||||
}
|
}
|
||||||
rc.qs = GNUNET_DB_STATUS_SUCCESS_ONE_RESULT;
|
rc.qs = GNUNET_DB_STATUS_SUCCESS_ONE_RESULT;
|
||||||
qsx = TALER_ARL_adb->get_reserve_summary (TALER_ARL_adb->cls,
|
qsx = TALER_ARL_adb->get_reserve_summary (TALER_ARL_adb->cls,
|
||||||
&TALER_ARL_master_pub,
|
&TALER_ARL_master_pub,
|
||||||
&total_escrow_balance,
|
&total_escrow_balance,
|
||||||
&total_withdraw_fee_income);
|
&total_withdraw_fee_income,
|
||||||
|
&total_purse_fee_income,
|
||||||
|
&total_history_fee_income);
|
||||||
if (qsx < 0)
|
if (qsx < 0)
|
||||||
{
|
{
|
||||||
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qsx);
|
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qsx);
|
||||||
@ -1393,7 +1410,59 @@ analyze_reserves (void *cls)
|
|||||||
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
|
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
|
||||||
return qs;
|
return qs;
|
||||||
}
|
}
|
||||||
|
#if FIXME
|
||||||
|
qs = TALER_ARL_edb->select_purse_merges_above_serial_id (
|
||||||
|
TALER_ARL_edb->cls,
|
||||||
|
ppr.last_purse_merge_serial_id,
|
||||||
|
&handle_purse_merged,
|
||||||
|
&rc);
|
||||||
|
if (qs < 0)
|
||||||
|
{
|
||||||
|
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
|
||||||
|
return qs;
|
||||||
|
}
|
||||||
|
|
||||||
|
qs = TALER_ARL_edb->select_purse_deposits_above_serial_id (
|
||||||
|
TALER_ARL_edb->cls,
|
||||||
|
ppr.last_purse_deposits_serial_id,
|
||||||
|
&handle_purse_deposits,
|
||||||
|
&rc);
|
||||||
|
if (qs < 0)
|
||||||
|
{
|
||||||
|
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
|
||||||
|
return qs;
|
||||||
|
}
|
||||||
|
qs = TALER_ARL_edb->select_account_merges_above_serial_id (
|
||||||
|
TALER_ARL_edb->cls,
|
||||||
|
ppr.last_account_merge_serial_id,
|
||||||
|
&handle_account_merged,
|
||||||
|
&rc);
|
||||||
|
if (qs < 0)
|
||||||
|
{
|
||||||
|
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
|
||||||
|
return qs;
|
||||||
|
}
|
||||||
|
qs = TALER_ARL_edb->select_history_requests_above_serial_id (
|
||||||
|
TALER_ARL_edb->cls,
|
||||||
|
ppr.last_history_requests_serial_id,
|
||||||
|
&handle_history_request,
|
||||||
|
&rc);
|
||||||
|
if (qs < 0)
|
||||||
|
{
|
||||||
|
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
|
||||||
|
return qs;
|
||||||
|
}
|
||||||
|
qs = TALER_ARL_edb->select_close_requests_above_serial_id (
|
||||||
|
TALER_ARL_edb->cls,
|
||||||
|
ppr.last_close_requests_serial_id,
|
||||||
|
&handle_close_request,
|
||||||
|
&rc);
|
||||||
|
if (qs < 0)
|
||||||
|
{
|
||||||
|
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
|
||||||
|
return qs;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
GNUNET_CONTAINER_multihashmap_iterate (rc.reserves,
|
GNUNET_CONTAINER_multihashmap_iterate (rc.reserves,
|
||||||
&verify_reserve_balance,
|
&verify_reserve_balance,
|
||||||
&rc);
|
&rc);
|
||||||
@ -1410,14 +1479,18 @@ analyze_reserves (void *cls)
|
|||||||
qs = TALER_ARL_adb->insert_reserve_summary (TALER_ARL_adb->cls,
|
qs = TALER_ARL_adb->insert_reserve_summary (TALER_ARL_adb->cls,
|
||||||
&TALER_ARL_master_pub,
|
&TALER_ARL_master_pub,
|
||||||
&total_escrow_balance,
|
&total_escrow_balance,
|
||||||
&total_withdraw_fee_income);
|
&total_withdraw_fee_income,
|
||||||
|
&total_purse_fee_income,
|
||||||
|
&total_history_fee_income);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qs = TALER_ARL_adb->update_reserve_summary (TALER_ARL_adb->cls,
|
qs = TALER_ARL_adb->update_reserve_summary (TALER_ARL_adb->cls,
|
||||||
&TALER_ARL_master_pub,
|
&TALER_ARL_master_pub,
|
||||||
&total_escrow_balance,
|
&total_escrow_balance,
|
||||||
&total_withdraw_fee_income);
|
&total_withdraw_fee_income,
|
||||||
|
&total_purse_fee_income,
|
||||||
|
&total_history_fee_income);
|
||||||
}
|
}
|
||||||
if (0 >= qs)
|
if (0 >= qs)
|
||||||
{
|
{
|
||||||
@ -1440,11 +1513,16 @@ analyze_reserves (void *cls)
|
|||||||
return qs;
|
return qs;
|
||||||
}
|
}
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
||||||
"Concluded reserve audit step at %llu/%llu/%llu/%llu\n",
|
"Concluded reserve audit step at %llu/%llu/%llu/%llu/%llu/%llu/%llu/%llu/%llu\n",
|
||||||
(unsigned long long) ppr.last_reserve_in_serial_id,
|
(unsigned long long) ppr.last_reserve_in_serial_id,
|
||||||
(unsigned long long) ppr.last_reserve_out_serial_id,
|
(unsigned long long) ppr.last_reserve_out_serial_id,
|
||||||
(unsigned long long) ppr.last_reserve_recoup_serial_id,
|
(unsigned long long) ppr.last_reserve_recoup_serial_id,
|
||||||
(unsigned long long) ppr.last_reserve_close_serial_id);
|
(unsigned long long) ppr.last_reserve_close_serial_id,
|
||||||
|
(unsigned long long) ppr.last_purse_merges_serial_id,
|
||||||
|
(unsigned long long) ppr.last_purse_deposits_serial_id,
|
||||||
|
(unsigned long long) ppr.last_account_merges_serial_id,
|
||||||
|
(unsigned long long) ppr.last_history_requests_serial_id,
|
||||||
|
(unsigned long long) ppr.last_close_requests_serial_id);
|
||||||
return GNUNET_DB_STATUS_SUCCESS_ONE_RESULT;
|
return GNUNET_DB_STATUS_SUCCESS_ONE_RESULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1497,6 +1575,12 @@ run (void *cls,
|
|||||||
GNUNET_assert (GNUNET_OK ==
|
GNUNET_assert (GNUNET_OK ==
|
||||||
TALER_amount_set_zero (TALER_ARL_currency,
|
TALER_amount_set_zero (TALER_ARL_currency,
|
||||||
&total_withdraw_fee_income));
|
&total_withdraw_fee_income));
|
||||||
|
GNUNET_assert (GNUNET_OK ==
|
||||||
|
TALER_amount_set_zero (TALER_ARL_currency,
|
||||||
|
&total_history_fee_income));
|
||||||
|
GNUNET_assert (GNUNET_OK ==
|
||||||
|
TALER_amount_set_zero (TALER_ARL_currency,
|
||||||
|
&total_purse_fee_income));
|
||||||
GNUNET_assert (GNUNET_OK ==
|
GNUNET_assert (GNUNET_OK ==
|
||||||
TALER_amount_set_zero (TALER_ARL_currency,
|
TALER_amount_set_zero (TALER_ARL_currency,
|
||||||
&total_balance_insufficient_loss));
|
&total_balance_insufficient_loss));
|
||||||
@ -1560,11 +1644,14 @@ run (void *cls,
|
|||||||
&total_balance_summary_delta_plus),
|
&total_balance_summary_delta_plus),
|
||||||
TALER_JSON_pack_amount ("total_balance_summary_delta_minus",
|
TALER_JSON_pack_amount ("total_balance_summary_delta_minus",
|
||||||
&total_balance_summary_delta_minus),
|
&total_balance_summary_delta_minus),
|
||||||
/* blocks #2 */
|
|
||||||
TALER_JSON_pack_amount ("total_escrow_balance",
|
TALER_JSON_pack_amount ("total_escrow_balance",
|
||||||
&total_escrow_balance),
|
&total_escrow_balance),
|
||||||
TALER_JSON_pack_amount ("total_withdraw_fee_income",
|
TALER_JSON_pack_amount ("total_withdraw_fee_income",
|
||||||
&total_withdraw_fee_income),
|
&total_withdraw_fee_income),
|
||||||
|
TALER_JSON_pack_amount ("total_history_fee_income",
|
||||||
|
&total_history_fee_income),
|
||||||
|
TALER_JSON_pack_amount ("total_purse_fee_income",
|
||||||
|
&total_purse_fee_income),
|
||||||
/* Tested in test-auditor.sh #21 */
|
/* Tested in test-auditor.sh #21 */
|
||||||
GNUNET_JSON_pack_array_steal ("reserve_not_closed_inconsistencies",
|
GNUNET_JSON_pack_array_steal ("reserve_not_closed_inconsistencies",
|
||||||
report_reserve_not_closed_inconsistencies),
|
report_reserve_not_closed_inconsistencies),
|
||||||
@ -1611,7 +1698,17 @@ run (void *cls,
|
|||||||
GNUNET_JSON_pack_uint64 ("end_ppr_reserve_recoup_serial_id",
|
GNUNET_JSON_pack_uint64 ("end_ppr_reserve_recoup_serial_id",
|
||||||
ppr.last_reserve_recoup_serial_id),
|
ppr.last_reserve_recoup_serial_id),
|
||||||
GNUNET_JSON_pack_uint64 ("end_ppr_reserve_close_serial_id",
|
GNUNET_JSON_pack_uint64 ("end_ppr_reserve_close_serial_id",
|
||||||
ppr.last_reserve_close_serial_id)));
|
ppr.last_reserve_close_serial_id),
|
||||||
|
GNUNET_JSON_pack_uint64 ("end_ppr_purse_merges_serial_id",
|
||||||
|
ppr.last_purse_merges_serial_id),
|
||||||
|
GNUNET_JSON_pack_uint64 ("end_ppr_purse_deposits_serial_id",
|
||||||
|
ppr.last_purse_deposits_serial_id),
|
||||||
|
GNUNET_JSON_pack_uint64 ("end_ppr_account_merges_serial_id",
|
||||||
|
ppr.last_account_merges_serial_id),
|
||||||
|
GNUNET_JSON_pack_uint64 ("end_ppr_history_requests_serial_id",
|
||||||
|
ppr.last_history_requests_serial_id),
|
||||||
|
GNUNET_JSON_pack_uint64 ("end_ppr_close_requests_serial_id",
|
||||||
|
ppr.last_close_requests_serial_id)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -48,6 +48,7 @@ CREATE TABLE IF NOT EXISTS auditor_progress_reserve
|
|||||||
,last_reserve_recoup_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_reserve_close_serial_id INT8 NOT NULL DEFAULT 0
|
||||||
,last_purse_merges_serial_id INT8 NOT NULL DEFAULT 0
|
,last_purse_merges_serial_id INT8 NOT NULL DEFAULT 0
|
||||||
|
,last_purse_deposits_serial_id INT8 NOT NULL DEFAULT 0
|
||||||
,last_account_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_history_requests_serial_id INT8 NOT NULL DEFAULT 0
|
||||||
,last_close_requests_serial_id INT8 NOT NULL DEFAULT 0
|
,last_close_requests_serial_id INT8 NOT NULL DEFAULT 0
|
||||||
@ -142,6 +143,10 @@ CREATE TABLE IF NOT EXISTS auditor_reserve_balance
|
|||||||
,reserve_balance_frac INT4 NOT NULL
|
,reserve_balance_frac INT4 NOT NULL
|
||||||
,withdraw_fee_balance_val INT8 NOT NULL
|
,withdraw_fee_balance_val INT8 NOT NULL
|
||||||
,withdraw_fee_balance_frac INT4 NOT NULL
|
,withdraw_fee_balance_frac INT4 NOT NULL
|
||||||
|
,purse_fee_balance_val INT8 NOT NULL
|
||||||
|
,purse_fee_balance_frac INT4 NOT NULL
|
||||||
|
,history_fee_balance_val INT8 NOT NULL
|
||||||
|
,history_fee_balance_frac INT4 NOT NULL
|
||||||
);
|
);
|
||||||
COMMENT ON TABLE auditor_reserve_balance
|
COMMENT ON TABLE auditor_reserve_balance
|
||||||
IS 'sum of the balances of all customer reserves (by exchange master public key)';
|
IS 'sum of the balances of all customer reserves (by exchange master public key)';
|
||||||
|
@ -231,11 +231,12 @@ setup_connection (struct PostgresClosure *pg)
|
|||||||
",last_reserve_recoup_serial_id=$3"
|
",last_reserve_recoup_serial_id=$3"
|
||||||
",last_reserve_close_serial_id=$4"
|
",last_reserve_close_serial_id=$4"
|
||||||
",last_purse_merges_serial_id=$5"
|
",last_purse_merges_serial_id=$5"
|
||||||
",last_account_merges_serial_id=$6"
|
",last_purse_deposits_serial_id=$6"
|
||||||
",last_history_requests_serial_id=$7"
|
",last_account_merges_serial_id=$7"
|
||||||
",last_close_requests_serial_id=$8"
|
",last_history_requests_serial_id=$8"
|
||||||
" WHERE master_pub=$9",
|
",last_close_requests_serial_id=$9"
|
||||||
9),
|
" WHERE master_pub=$10",
|
||||||
|
10),
|
||||||
/* Used in #postgres_get_auditor_progress_reserve() */
|
/* Used in #postgres_get_auditor_progress_reserve() */
|
||||||
GNUNET_PQ_make_prepare ("auditor_progress_select_reserve",
|
GNUNET_PQ_make_prepare ("auditor_progress_select_reserve",
|
||||||
"SELECT"
|
"SELECT"
|
||||||
@ -244,6 +245,7 @@ setup_connection (struct PostgresClosure *pg)
|
|||||||
",last_reserve_recoup_serial_id"
|
",last_reserve_recoup_serial_id"
|
||||||
",last_reserve_close_serial_id"
|
",last_reserve_close_serial_id"
|
||||||
",last_purse_merges_serial_id"
|
",last_purse_merges_serial_id"
|
||||||
|
",last_purse_deposits_serial_id"
|
||||||
",last_account_merges_serial_id"
|
",last_account_merges_serial_id"
|
||||||
",last_history_requests_serial_id"
|
",last_history_requests_serial_id"
|
||||||
",last_close_requests_serial_id"
|
",last_close_requests_serial_id"
|
||||||
@ -259,11 +261,12 @@ setup_connection (struct PostgresClosure *pg)
|
|||||||
",last_reserve_recoup_serial_id"
|
",last_reserve_recoup_serial_id"
|
||||||
",last_reserve_close_serial_id"
|
",last_reserve_close_serial_id"
|
||||||
",last_purse_merges_serial_id"
|
",last_purse_merges_serial_id"
|
||||||
|
",last_purse_deposits_serial_id"
|
||||||
",last_account_merges_serial_id"
|
",last_account_merges_serial_id"
|
||||||
",last_history_requests_serial_id"
|
",last_history_requests_serial_id"
|
||||||
",last_close_requests_serial_id"
|
",last_close_requests_serial_id"
|
||||||
") VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9);",
|
") VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10);",
|
||||||
9),
|
10),
|
||||||
/* Used in #postgres_update_auditor_progress_aggregation() */
|
/* Used in #postgres_update_auditor_progress_aggregation() */
|
||||||
GNUNET_PQ_make_prepare ("auditor_progress_update_aggregation",
|
GNUNET_PQ_make_prepare ("auditor_progress_update_aggregation",
|
||||||
"UPDATE auditor_progress_aggregation SET "
|
"UPDATE auditor_progress_aggregation SET "
|
||||||
@ -448,8 +451,12 @@ setup_connection (struct PostgresClosure *pg)
|
|||||||
",reserve_balance_frac"
|
",reserve_balance_frac"
|
||||||
",withdraw_fee_balance_val"
|
",withdraw_fee_balance_val"
|
||||||
",withdraw_fee_balance_frac"
|
",withdraw_fee_balance_frac"
|
||||||
") VALUES ($1,$2,$3,$4,$5)",
|
",purse_fee_balance_val"
|
||||||
5),
|
",purse_fee_balance_frac"
|
||||||
|
",history_fee_balance_val"
|
||||||
|
",history_fee_balance_frac"
|
||||||
|
") VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9)",
|
||||||
|
9),
|
||||||
/* Used in #postgres_update_reserve_summary() */
|
/* Used in #postgres_update_reserve_summary() */
|
||||||
GNUNET_PQ_make_prepare ("auditor_reserve_balance_update",
|
GNUNET_PQ_make_prepare ("auditor_reserve_balance_update",
|
||||||
"UPDATE auditor_reserve_balance SET"
|
"UPDATE auditor_reserve_balance SET"
|
||||||
@ -457,8 +464,12 @@ setup_connection (struct PostgresClosure *pg)
|
|||||||
",reserve_balance_frac=$2"
|
",reserve_balance_frac=$2"
|
||||||
",withdraw_fee_balance_val=$3"
|
",withdraw_fee_balance_val=$3"
|
||||||
",withdraw_fee_balance_frac=$4"
|
",withdraw_fee_balance_frac=$4"
|
||||||
" WHERE master_pub=$5;",
|
",purse_fee_balance_val=$5"
|
||||||
5),
|
",purse_fee_balance_frac=$6"
|
||||||
|
",history_fee_balance_val=$7"
|
||||||
|
",history_fee_balance_frac=$8"
|
||||||
|
" WHERE master_pub=$9;",
|
||||||
|
9),
|
||||||
/* Used in #postgres_get_reserve_summary() */
|
/* Used in #postgres_get_reserve_summary() */
|
||||||
GNUNET_PQ_make_prepare ("auditor_reserve_balance_select",
|
GNUNET_PQ_make_prepare ("auditor_reserve_balance_select",
|
||||||
"SELECT"
|
"SELECT"
|
||||||
@ -466,6 +477,10 @@ setup_connection (struct PostgresClosure *pg)
|
|||||||
",reserve_balance_frac"
|
",reserve_balance_frac"
|
||||||
",withdraw_fee_balance_val"
|
",withdraw_fee_balance_val"
|
||||||
",withdraw_fee_balance_frac"
|
",withdraw_fee_balance_frac"
|
||||||
|
",purse_fee_balance_val"
|
||||||
|
",purse_fee_balance_frac"
|
||||||
|
",history_fee_balance_val"
|
||||||
|
",history_fee_balance_frac"
|
||||||
" FROM auditor_reserve_balance"
|
" FROM auditor_reserve_balance"
|
||||||
" WHERE master_pub=$1;",
|
" WHERE master_pub=$1;",
|
||||||
1),
|
1),
|
||||||
@ -1244,6 +1259,7 @@ postgres_insert_auditor_progress_reserve (
|
|||||||
GNUNET_PQ_query_param_uint64 (&ppr->last_reserve_recoup_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_reserve_close_serial_id),
|
||||||
GNUNET_PQ_query_param_uint64 (&ppr->last_purse_merges_serial_id),
|
GNUNET_PQ_query_param_uint64 (&ppr->last_purse_merges_serial_id),
|
||||||
|
GNUNET_PQ_query_param_uint64 (&ppr->last_purse_deposits_serial_id),
|
||||||
GNUNET_PQ_query_param_uint64 (&ppr->last_account_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_history_requests_serial_id),
|
||||||
GNUNET_PQ_query_param_uint64 (&ppr->last_close_requests_serial_id),
|
GNUNET_PQ_query_param_uint64 (&ppr->last_close_requests_serial_id),
|
||||||
@ -1278,6 +1294,7 @@ postgres_update_auditor_progress_reserve (
|
|||||||
GNUNET_PQ_query_param_uint64 (&ppr->last_reserve_recoup_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_reserve_close_serial_id),
|
||||||
GNUNET_PQ_query_param_uint64 (&ppr->last_purse_merges_serial_id),
|
GNUNET_PQ_query_param_uint64 (&ppr->last_purse_merges_serial_id),
|
||||||
|
GNUNET_PQ_query_param_uint64 (&ppr->last_purse_deposits_serial_id),
|
||||||
GNUNET_PQ_query_param_uint64 (&ppr->last_account_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_history_requests_serial_id),
|
||||||
GNUNET_PQ_query_param_uint64 (&ppr->last_close_requests_serial_id),
|
GNUNET_PQ_query_param_uint64 (&ppr->last_close_requests_serial_id),
|
||||||
@ -1321,6 +1338,8 @@ postgres_get_auditor_progress_reserve (
|
|||||||
&ppr->last_reserve_close_serial_id),
|
&ppr->last_reserve_close_serial_id),
|
||||||
GNUNET_PQ_result_spec_uint64 ("last_purse_merges_serial_id",
|
GNUNET_PQ_result_spec_uint64 ("last_purse_merges_serial_id",
|
||||||
&ppr->last_purse_merges_serial_id),
|
&ppr->last_purse_merges_serial_id),
|
||||||
|
GNUNET_PQ_result_spec_uint64 ("last_purse_deposits_serial_id",
|
||||||
|
&ppr->last_purse_deposits_serial_id),
|
||||||
GNUNET_PQ_result_spec_uint64 ("last_account_merges_serial_id",
|
GNUNET_PQ_result_spec_uint64 ("last_account_merges_serial_id",
|
||||||
&ppr->last_account_merges_serial_id),
|
&ppr->last_account_merges_serial_id),
|
||||||
GNUNET_PQ_result_spec_uint64 ("last_history_requests_serial_id",
|
GNUNET_PQ_result_spec_uint64 ("last_history_requests_serial_id",
|
||||||
@ -2007,7 +2026,8 @@ postgres_get_reserve_info (void *cls,
|
|||||||
* @param master_pub master public key of the exchange
|
* @param master_pub master public key of the exchange
|
||||||
* @param reserve_balance amount stored in the reserve
|
* @param reserve_balance amount stored in the reserve
|
||||||
* @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
|
* @param purse_fee_balance amount the exchange gained in purse fees
|
||||||
|
* @param history_fee_balance amount the exchange gained in history fees
|
||||||
* @return transaction status code
|
* @return transaction status code
|
||||||
*/
|
*/
|
||||||
static enum GNUNET_DB_QueryStatus
|
static enum GNUNET_DB_QueryStatus
|
||||||
@ -2015,13 +2035,17 @@ postgres_insert_reserve_summary (
|
|||||||
void *cls,
|
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,
|
||||||
|
const struct TALER_Amount *purse_fee_balance,
|
||||||
|
const struct TALER_Amount *history_fee_balance)
|
||||||
{
|
{
|
||||||
struct PostgresClosure *pg = cls;
|
struct PostgresClosure *pg = cls;
|
||||||
struct GNUNET_PQ_QueryParam params[] = {
|
struct GNUNET_PQ_QueryParam params[] = {
|
||||||
GNUNET_PQ_query_param_auto_from_type (master_pub),
|
GNUNET_PQ_query_param_auto_from_type (master_pub),
|
||||||
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),
|
||||||
|
TALER_PQ_query_param_amount (purse_fee_balance),
|
||||||
|
TALER_PQ_query_param_amount (history_fee_balance),
|
||||||
GNUNET_PQ_query_param_end
|
GNUNET_PQ_query_param_end
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -2051,12 +2075,16 @@ postgres_update_reserve_summary (
|
|||||||
void *cls,
|
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,
|
||||||
|
const struct TALER_Amount *purse_fee_balance,
|
||||||
|
const struct TALER_Amount *history_fee_balance)
|
||||||
{
|
{
|
||||||
struct PostgresClosure *pg = cls;
|
struct PostgresClosure *pg = cls;
|
||||||
struct GNUNET_PQ_QueryParam params[] = {
|
struct GNUNET_PQ_QueryParam params[] = {
|
||||||
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),
|
||||||
|
TALER_PQ_query_param_amount (purse_fee_balance),
|
||||||
|
TALER_PQ_query_param_amount (history_fee_balance),
|
||||||
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
|
||||||
};
|
};
|
||||||
@ -2072,16 +2100,19 @@ postgres_update_reserve_summary (
|
|||||||
*
|
*
|
||||||
* @param cls the @e cls of this struct with the plugin-specific state
|
* @param cls the @e cls of this struct with the plugin-specific state
|
||||||
* @param master_pub master public key of the exchange
|
* @param master_pub master public key of the exchange
|
||||||
* @param[out] reserve_balance amount stored in the reserve
|
* @param[out] reserve_balance amount stored in reserves
|
||||||
* @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
|
* @param[out] purse_fee_balance amount the exchange gained in purse fees
|
||||||
|
* @param[out] history_fee_balance amount the exchange gained in history fees
|
||||||
* @return transaction status code
|
* @return transaction status code
|
||||||
*/
|
*/
|
||||||
static enum GNUNET_DB_QueryStatus
|
static enum GNUNET_DB_QueryStatus
|
||||||
postgres_get_reserve_summary (void *cls,
|
postgres_get_reserve_summary (void *cls,
|
||||||
const struct TALER_MasterPublicKeyP *master_pub,
|
const struct TALER_MasterPublicKeyP *master_pub,
|
||||||
struct TALER_Amount *reserve_balance,
|
struct TALER_Amount *reserve_balance,
|
||||||
struct TALER_Amount *withdraw_fee_balance)
|
struct TALER_Amount *withdraw_fee_balance,
|
||||||
|
struct TALER_Amount *purse_fee_balance,
|
||||||
|
struct TALER_Amount *history_fee_balance)
|
||||||
{
|
{
|
||||||
struct PostgresClosure *pg = cls;
|
struct PostgresClosure *pg = cls;
|
||||||
struct GNUNET_PQ_QueryParam params[] = {
|
struct GNUNET_PQ_QueryParam params[] = {
|
||||||
@ -2091,7 +2122,8 @@ postgres_get_reserve_summary (void *cls,
|
|||||||
struct GNUNET_PQ_ResultSpec rs[] = {
|
struct GNUNET_PQ_ResultSpec rs[] = {
|
||||||
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),
|
||||||
|
TALER_PQ_RESULT_SPEC_AMOUNT ("purse_fee_balance", purse_fee_balance),
|
||||||
|
TALER_PQ_RESULT_SPEC_AMOUNT ("history_fee_balance", history_fee_balance),
|
||||||
GNUNET_PQ_result_spec_end
|
GNUNET_PQ_result_spec_end
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -163,6 +163,12 @@ struct TALER_AUDITORDB_ProgressPointReserve
|
|||||||
*/
|
*/
|
||||||
uint64_t last_purse_merges_serial_id;
|
uint64_t last_purse_merges_serial_id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Serial ID of the last purse_deposits
|
||||||
|
* entry the auditor processed.
|
||||||
|
*/
|
||||||
|
uint64_t last_purse_deposits_serial_id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* serial ID of the last account_merges
|
* serial ID of the last account_merges
|
||||||
* entry the auditor processed.
|
* entry the auditor processed.
|
||||||
@ -979,14 +985,17 @@ struct TALER_AUDITORDB_Plugin
|
|||||||
* @param master_pub master public key of the exchange
|
* @param master_pub master public key of the exchange
|
||||||
* @param reserve_balance amount stored in the reserve
|
* @param reserve_balance amount stored in the reserve
|
||||||
* @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
|
* @param purse_fee_balance amount the exchange gained in purse fees
|
||||||
|
* @param history_fee_balance amount the exchange gained in history fees
|
||||||
* @return transaction status code
|
* @return transaction status code
|
||||||
*/
|
*/
|
||||||
enum GNUNET_DB_QueryStatus
|
enum GNUNET_DB_QueryStatus
|
||||||
(*insert_reserve_summary)(void *cls,
|
(*insert_reserve_summary)(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,
|
||||||
|
const struct TALER_Amount *purse_fee_balance,
|
||||||
|
const struct TALER_Amount *history_fee_balance);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -997,14 +1006,17 @@ struct TALER_AUDITORDB_Plugin
|
|||||||
* @param master_pub master public key of the exchange
|
* @param master_pub master public key of the exchange
|
||||||
* @param reserve_balance amount stored in the reserve
|
* @param reserve_balance amount stored in the reserve
|
||||||
* @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
|
* @param purse_fee_balance amount the exchange gained in purse fees
|
||||||
|
* @param history_fee_balance amount the exchange gained in history fees
|
||||||
* @return transaction status code
|
* @return transaction status code
|
||||||
*/
|
*/
|
||||||
enum GNUNET_DB_QueryStatus
|
enum GNUNET_DB_QueryStatus
|
||||||
(*update_reserve_summary)(void *cls,
|
(*update_reserve_summary)(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,
|
||||||
|
const struct TALER_Amount *purse_fee_balance,
|
||||||
|
const struct TALER_Amount *history_fee_balance);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1012,16 +1024,19 @@ struct TALER_AUDITORDB_Plugin
|
|||||||
*
|
*
|
||||||
* @param cls the @e cls of this struct with the plugin-specific state
|
* @param cls the @e cls of this struct with the plugin-specific state
|
||||||
* @param master_pub master public key of the exchange
|
* @param master_pub master public key of the exchange
|
||||||
* @param[out] reserve_balance amount stored in the reserve
|
* @param[out] reserve_balance amount stored in reserves
|
||||||
* @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
|
* @param[out] purse_fee_balance amount the exchange gained in purse fees
|
||||||
|
* @param[out] history_fee_balance amount the exchange gained in history fees
|
||||||
* @return transaction status code
|
* @return transaction status code
|
||||||
*/
|
*/
|
||||||
enum GNUNET_DB_QueryStatus
|
enum GNUNET_DB_QueryStatus
|
||||||
(*get_reserve_summary)(void *cls,
|
(*get_reserve_summary)(void *cls,
|
||||||
const struct TALER_MasterPublicKeyP *master_pub,
|
const struct TALER_MasterPublicKeyP *master_pub,
|
||||||
struct TALER_Amount *reserve_balance,
|
struct TALER_Amount *reserve_balance,
|
||||||
struct TALER_Amount *withdraw_fee_balance);
|
struct TALER_Amount *withdraw_fee_balance,
|
||||||
|
struct TALER_Amount *purse_fee_balance,
|
||||||
|
struct TALER_Amount *history_fee_balance);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user