exchange

Base system with REST service to issue digital coins, run by the payment service provider
Log | Files | Refs | Submodules | README | LICENSE

commit 3acaf80c3b2f388d07a9d8c00bf432e253c0fae1
parent 52e5368797adc1971cbd9050bbf3c3d0387c0846
Author: Christian Grothoff <christian@grothoff.org>
Date:   Sun, 11 Oct 2026 14:36:06 +0200

fix off-by-one (incl. vs. excl.)

Diffstat:
Msrc/exchangedb/begin_revolving_shard.c | 4+++-
Msrc/exchangedb/test_revolving_work_shards.c | 4++--
2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/exchangedb/begin_revolving_shard.c b/src/exchangedb/begin_revolving_shard.c @@ -104,7 +104,9 @@ TALER_EXCHANGEDB_begin_revolving_shard ( GNUNET_PQ_query_param_end }; - *end_row = GNUNET_MIN (shard_limit, + /* @a shard_limit is exclusive, @a end_row inclusive; the aggregator + passes 2^31, which would not even fit the INT4 column. */ + *end_row = GNUNET_MIN (shard_limit - 1, *start_row + shard_size - 1); now = GNUNET_TIME_absolute_get (); GNUNET_log (GNUNET_ERROR_TYPE_INFO, diff --git a/src/exchangedb/test_revolving_work_shards.c b/src/exchangedb/test_revolving_work_shards.c @@ -92,7 +92,7 @@ check_claim_fresh (struct TALER_EXCHANGEDB_PostgresContext *pg) &start, &end)); FAILIF (20 != start); - FAILIF (25 != end); + FAILIF (24 != end); FAILIF (3 != TDB_count (pg, "FROM revolving_work_shards" " WHERE job_name='rws-claim'" @@ -194,7 +194,7 @@ check_single_shard (struct TALER_EXCHANGEDB_PostgresContext *pg) &start, &end)); FAILIF (0 != start); - FAILIF (4 != end); + FAILIF (3 != end); FAILIF (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS != TALER_EXCHANGEDB_begin_revolving_shard (pg, "rws-single",