commit 88c04f61150c2334015439b27bfd5c8a52849ef9 parent f93e54134818d14c87d5a3cbf97d1c0874155a16 Author: Christian Grothoff <christian@grothoff.org> Date: Tue, 4 Aug 2026 15:34:14 +0200 fix issue where race might create concurrent payment requests for the same challenge Diffstat:
| M | src/stasis/get_pending_challenge_payment.c | | | 9 | ++++++++- |
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/stasis/get_pending_challenge_payment.c b/src/stasis/get_pending_challenge_payment.c @@ -67,7 +67,14 @@ ANASTASIS_DB_get_pending_challenge_payment ( " AND" " truth_uuid=$1" " AND" - " creation_date > $2;"); + " creation_date > $2" + /* Nothing stops a truth from having more than one pending offer: + the callers check for one and then insert after a round trip to + the merchant, so two concurrent challenge requests race and both + insert. Without this the singleton select would then report a + hard error. Point the client at the most recent offer. */ + " ORDER BY creation_date DESC" + " LIMIT 1;"); return GNUNET_PQ_eval_prepared_singleton_select (pg->conn, "get_pending_challenge_payment", params,