From 421f59749ec806a59bb2078c4f5c4dc0d52032dd Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 20 May 2022 16:49:48 +0200 Subject: anti-gummy patch --- src/exchange/taler-exchange-wirewatch.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/exchange/taler-exchange-wirewatch.c') diff --git a/src/exchange/taler-exchange-wirewatch.c b/src/exchange/taler-exchange-wirewatch.c index 58c8f82a5..8e4538300 100644 --- a/src/exchange/taler-exchange-wirewatch.c +++ b/src/exchange/taler-exchange-wirewatch.c @@ -1,6 +1,6 @@ /* 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 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; + /** + * 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). */ @@ -585,6 +592,8 @@ history_cb (void *cls, wa->hh = NULL; return GNUNET_SYSERR; } + if (serial_id >= wa->max_row_off) + wa->delay = false; if (serial_id > wa->shard_end) { /* 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) wa->shard_end); wa->latest_row_off = serial_id - 1; - wa->delay = false; if (wa->started_transaction) { do_commit (wa); @@ -660,7 +668,6 @@ history_cb (void *cls, /* normal case */ break; } - wa->delay = false; wa->latest_row_off = serial_id; return GNUNET_OK; } @@ -760,6 +767,7 @@ find_transfers (void *cls) wa_pos->shard_end - wa_pos->batch_start); GNUNET_assert (NULL == wa_pos->hh); 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->ai->auth, wa_pos->batch_start, -- cgit v1.2.3