anti-gummy patch

This commit is contained in:
Christian Grothoff 2022-05-20 16:49:48 +02:00
parent 68b155aab5
commit 421f59749e
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC

View File

@ -1,6 +1,6 @@
/* /*
This file is part of TALER This file is part of TALER
Copyright (C) 2016--2021 Taler Systems SA Copyright (C) 2016--2022 Taler Systems SA
TALER is free software; you can redistribute it and/or modify it under the TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License as published by the Free Software terms of the GNU Affero General Public License as published by the Free Software
@ -84,6 +84,13 @@ struct WireAccount
*/ */
uint64_t latest_row_off; uint64_t latest_row_off;
/**
* Maximum row offset this transaction may yield. If we got the
* maximum number of rows, we must not @e delay before running
* the next transaction.
*/
uint64_t max_row_off;
/** /**
* Offset where our current shard begins (inclusive). * Offset where our current shard begins (inclusive).
*/ */
@ -585,6 +592,8 @@ history_cb (void *cls,
wa->hh = NULL; wa->hh = NULL;
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
if (serial_id >= wa->max_row_off)
wa->delay = false;
if (serial_id > wa->shard_end) if (serial_id > wa->shard_end)
{ {
/* we are done with the current shard, commit and stop this iteration! */ /* we are done with the current shard, commit and stop this iteration! */
@ -593,7 +602,6 @@ history_cb (void *cls,
(unsigned long long) serial_id, (unsigned long long) serial_id,
(unsigned long long) wa->shard_end); (unsigned long long) wa->shard_end);
wa->latest_row_off = serial_id - 1; wa->latest_row_off = serial_id - 1;
wa->delay = false;
if (wa->started_transaction) if (wa->started_transaction)
{ {
do_commit (wa); do_commit (wa);
@ -660,7 +668,6 @@ history_cb (void *cls,
/* normal case */ /* normal case */
break; break;
} }
wa->delay = false;
wa->latest_row_off = serial_id; wa->latest_row_off = serial_id;
return GNUNET_OK; return GNUNET_OK;
} }
@ -760,6 +767,7 @@ find_transfers (void *cls)
wa_pos->shard_end - wa_pos->batch_start); wa_pos->shard_end - wa_pos->batch_start);
GNUNET_assert (NULL == wa_pos->hh); GNUNET_assert (NULL == wa_pos->hh);
wa_pos->latest_row_off = wa_pos->batch_start; wa_pos->latest_row_off = wa_pos->batch_start;
wa_pos->max_row_off = wa_pos->batch_start + limit - 1;
wa_pos->hh = TALER_BANK_credit_history (ctx, wa_pos->hh = TALER_BANK_credit_history (ctx,
wa_pos->ai->auth, wa_pos->ai->auth,
wa_pos->batch_start, wa_pos->batch_start,