first bit of auditor-wire cleanup

This commit is contained in:
Christian Grothoff 2020-03-22 16:23:41 +01:00
parent ba22ad7a42
commit 2539956026
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC

View File

@ -1256,10 +1256,8 @@ check_exchange_wire_out (struct WireAccount *wa)
qs = TALER_ARL_edb->select_wire_out_above_serial_id_by_account ( qs = TALER_ARL_edb->select_wire_out_above_serial_id_by_account (
TALER_ARL_edb->cls, TALER_ARL_edb->cls,
TALER_ARL_esession, TALER_ARL_esession,
wa-> wa->section_name,
section_name, wa->pp.last_wire_out_serial_id,
wa->pp.
last_wire_out_serial_id,
&wire_out_cb, &wire_out_cb,
wa); wa);
if (0 > qs) if (0 > qs)
@ -1407,9 +1405,9 @@ process_debits (void *cls)
wa); wa);
if (NULL == wa->dhh) if (NULL == wa->dhh)
{ {
fprintf (stderr, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to obtain bank transaction history for `%s'\n", "Failed to obtain bank transaction history for `%s'\n",
wa->section_name); wa->section_name);
commit (GNUNET_DB_STATUS_HARD_ERROR); commit (GNUNET_DB_STATUS_HARD_ERROR);
global_ret = 1; global_ret = 1;
GNUNET_SCHEDULER_shutdown (); GNUNET_SCHEDULER_shutdown ();
@ -1482,8 +1480,7 @@ reserve_in_cb (void *cls,
TALER_amount2s (credit), TALER_amount2s (credit),
TALER_B2S (reserve_pub)); TALER_B2S (reserve_pub));
slen = strlen (sender_account_details) + 1; slen = strlen (sender_account_details) + 1;
rii = GNUNET_malloc (sizeof (struct ReserveInInfo) rii = GNUNET_malloc (sizeof (struct ReserveInInfo) + slen);
+ slen);
rii->rowid = rowid; rii->rowid = rowid;
rii->details.amount = *credit; rii->details.amount = *credit;
rii->details.execution_date = execution_date; rii->details.execution_date = execution_date;
@ -1800,12 +1797,9 @@ process_credits (void *cls)
qs = TALER_ARL_edb->select_reserves_in_above_serial_id_by_account ( qs = TALER_ARL_edb->select_reserves_in_above_serial_id_by_account (
TALER_ARL_edb->cls, TALER_ARL_edb->cls,
TALER_ARL_esession, TALER_ARL_esession,
wa-> wa->section_name,
section_name, wa->pp.last_reserve_in_serial_id,
wa->pp. &reserve_in_cb,
last_reserve_in_serial_id,
&
reserve_in_cb,
wa); wa);
if (0 > qs) if (0 > qs)
{ {
@ -1826,8 +1820,8 @@ process_credits (void *cls)
wa); wa);
if (NULL == wa->chh) if (NULL == wa->chh)
{ {
fprintf (stderr, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to obtain bank transaction history\n"); "Failed to obtain bank transaction history\n");
commit (GNUNET_DB_STATUS_HARD_ERROR); commit (GNUNET_DB_STATUS_HARD_ERROR);
global_ret = 1; global_ret = 1;
GNUNET_SCHEDULER_shutdown (); GNUNET_SCHEDULER_shutdown ();
@ -1925,35 +1919,33 @@ reserve_closed_cb (void *cls,
static enum GNUNET_DB_QueryStatus static enum GNUNET_DB_QueryStatus
begin_transaction (void) begin_transaction (void)
{ {
int ret;
TALER_ARL_esession = TALER_ARL_edb->get_session (TALER_ARL_edb->cls); TALER_ARL_esession = TALER_ARL_edb->get_session (TALER_ARL_edb->cls);
if (NULL == TALER_ARL_esession) if (NULL == TALER_ARL_esession)
{ {
fprintf (stderr, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to initialize exchange session.\n"); "Failed to initialize exchange database session.\n");
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
TALER_ARL_asession = TALER_ARL_adb->get_session (TALER_ARL_adb->cls); TALER_ARL_asession = TALER_ARL_adb->get_session (TALER_ARL_adb->cls);
if (NULL == TALER_ARL_asession) if (NULL == TALER_ARL_asession)
{ {
fprintf (stderr, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to initialize auditor session.\n"); "Failed to initialize auditor database session.\n");
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
ret = TALER_ARL_adb->start (TALER_ARL_adb->cls, if (GNUNET_OK !=
TALER_ARL_asession); TALER_ARL_adb->start (TALER_ARL_adb->cls,
if (GNUNET_OK != ret) TALER_ARL_asession))
{ {
GNUNET_break (0); GNUNET_break (0);
return GNUNET_DB_STATUS_HARD_ERROR; return GNUNET_DB_STATUS_HARD_ERROR;
} }
TALER_ARL_edb->preflight (TALER_ARL_edb->cls, TALER_ARL_edb->preflight (TALER_ARL_edb->cls,
TALER_ARL_esession); TALER_ARL_esession);
ret = TALER_ARL_edb->start (TALER_ARL_edb->cls, if (GNUNET_OK !=
TALER_ARL_esession, TALER_ARL_edb->start (TALER_ARL_edb->cls,
"wire auditor"); TALER_ARL_esession,
if (GNUNET_OK != ret) "wire auditor"))
{ {
GNUNET_break (0); GNUNET_break (0);
return GNUNET_DB_STATUS_HARD_ERROR; return GNUNET_DB_STATUS_HARD_ERROR;
@ -1965,13 +1957,11 @@ begin_transaction (void)
wa->qsx = TALER_ARL_adb->get_wire_auditor_account_progress ( wa->qsx = TALER_ARL_adb->get_wire_auditor_account_progress (
TALER_ARL_adb->cls, TALER_ARL_adb->cls,
TALER_ARL_asession, TALER_ARL_asession,
& &TALER_ARL_master_pub,
TALER_ARL_master_pub,
wa->section_name, wa->section_name,
&wa->pp, &wa->pp,
&wa->in_wire_off, &wa->in_wire_off,
&wa-> &wa->out_wire_off);
out_wire_off);
if (0 > wa->qsx) if (0 > wa->qsx)
{ {
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == wa->qsx); GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == wa->qsx);
@ -2008,10 +1998,8 @@ begin_transaction (void)
qs = TALER_ARL_edb->select_reserve_closed_above_serial_id ( qs = TALER_ARL_edb->select_reserve_closed_above_serial_id (
TALER_ARL_edb->cls, TALER_ARL_edb->cls,
TALER_ARL_esession, TALER_ARL_esession,
pp. pp.last_reserve_close_uuid,
last_reserve_close_uuid, &reserve_closed_cb,
&
reserve_closed_cb,
NULL); NULL);
if (0 > qs) if (0 > qs)
{ {
@ -2054,13 +2042,12 @@ process_account_cb (void *cls,
ai->section_name, ai->section_name,
&wa->auth)) &wa->auth))
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to access bank account `%s'\n",
wa->section_name);
GNUNET_break (0); GNUNET_break (0);
GNUNET_free (wa->section_name); GNUNET_free (wa->section_name);
GNUNET_free (wa); GNUNET_free (wa);
fprintf (stderr,
"Failed to access bank account `%s'\n",
wa->section_name);
global_ret = 1; global_ret = 1;
GNUNET_SCHEDULER_shutdown (); GNUNET_SCHEDULER_shutdown ();
return; return;
@ -2225,4 +2212,4 @@ main (int argc,
} }
/* end of taler-wire-auditor.c */ /* end of taler-helper-auditor-wire.c */