better diagnostics from fakebank

This commit is contained in:
Christian Grothoff 2017-12-10 21:19:30 +01:00
parent 0b9ffa874f
commit 878c68faf6
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC

View File

@ -170,19 +170,21 @@ TALER_FAKEBANK_check (struct TALER_FAKEBANK_Handle *h,
"Did not find matching transaction!\nI have:\n"); "Did not find matching transaction!\nI have:\n");
for (struct Transaction *t = h->transactions_head; NULL != t; t = t->next) for (struct Transaction *t = h->transactions_head; NULL != t; t = t->next)
{ {
char *s;
if (GNUNET_YES == t->checked) if (GNUNET_YES == t->checked)
continue; continue;
s = TALER_amount_to_string (&t->amount);
fprintf (stderr, fprintf (stderr,
"%llu -> %llu (%s) from %s\n", "%llu -> %llu (%s) from %s\n",
(unsigned long long) t->debit_account, (unsigned long long) t->debit_account,
(unsigned long long) t->credit_account, (unsigned long long) t->credit_account,
s, TALER_amount2s (&t->amount),
t->exchange_base_url); t->exchange_base_url);
GNUNET_free (s);
} }
fprintf (stderr,
"I wanted:\n%llu -> %llu (%s) from %s\n",
(unsigned long long) want_debit,
(unsigned long long) want_credit,
TALER_amount2s (want_amount),
exchange_base_url);
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
@ -828,9 +830,10 @@ handle_history (struct TALER_FAKEBANK_Handle *h,
? pos->credit_account ? pos->credit_account
: pos->debit_account), : pos->debit_account),
"wt_subject", subject); "wt_subject", subject);
GNUNET_assert (NULL != trans);
GNUNET_free (subject); GNUNET_free (subject);
json_array_append (history, GNUNET_assert (0 == json_array_append (history,
trans); trans));
if (count > 0) if (count > 0)
{ {
pos = pos->next; pos = pos->next;
@ -860,7 +863,8 @@ handle_history (struct TALER_FAKEBANK_Handle *h,
} }
jresponse = json_pack ("{s:o}", jresponse = json_pack ("{s:o}",
"data", history); "data",
history);
if (NULL == jresponse) if (NULL == jresponse)
{ {
GNUNET_break (0); GNUNET_break (0);