summaryrefslogtreecommitdiff
path: root/src/bank-lib/fakebank.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-08-07 17:50:53 +0200
committerChristian Grothoff <christian@grothoff.org>2021-08-07 17:50:53 +0200
commit8a60e6b62f173c1148686572e72ad552c3808325 (patch)
tree25db5bba3c0fe4df518d1bc601aeea28ecc458dc /src/bank-lib/fakebank.c
parent26e061c2128666fcbdfb94d92343ec12599a59a1 (diff)
downloadexchange-8a60e6b62f173c1148686572e72ad552c3808325.tar.gz
exchange-8a60e6b62f173c1148686572e72ad552c3808325.tar.bz2
exchange-8a60e6b62f173c1148686572e72ad552c3808325.zip
-fix fakebank/tewgc logic and add test case
Diffstat (limited to 'src/bank-lib/fakebank.c')
-rw-r--r--src/bank-lib/fakebank.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/bank-lib/fakebank.c b/src/bank-lib/fakebank.c
index 7dbbd531c..0e726e77c 100644
--- a/src/bank-lib/fakebank.c
+++ b/src/bank-lib/fakebank.c
@@ -1487,7 +1487,18 @@ handle_debit_history (struct TALER_FAKEBANK_Handle *h,
json_t *trans;
char *credit_payto;
- GNUNET_assert (T_DEBIT == pos->type);
+ if (T_DEBIT != pos->type)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "Unexpected CREDIT transaction #%llu for account `%s'\n",
+ (unsigned long long) pos->row_id,
+ account);
+ if (0 > ha.delta)
+ pos = pos->prev_in;
+ if (0 < ha.delta)
+ pos = pos->next_in;
+ continue;
+ }
GNUNET_asprintf (&credit_payto,
"payto://x-taler-bank/localhost/%s",
pos->credit_account->account_name);
@@ -1635,7 +1646,18 @@ handle_credit_history (struct TALER_FAKEBANK_Handle *h,
json_t *trans;
char *debit_payto;
- GNUNET_assert (T_CREDIT == pos->type);
+ if (T_CREDIT != pos->type)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "Unexpected DEBIT transaction #%llu for account `%s'\n",
+ (unsigned long long) pos->row_id,
+ account);
+ if (0 > ha.delta)
+ pos = pos->prev_in;
+ if (0 < ha.delta)
+ pos = pos->next_in;
+ continue;
+ }
GNUNET_asprintf (&debit_payto,
"payto://x-taler-bank/localhost/%s",
pos->debit_account->account_name);