aboutsummaryrefslogtreecommitdiff
path: root/src/exchangedb
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-11-17 15:53:16 +0100
committerChristian Grothoff <christian@grothoff.org>2016-11-17 15:53:16 +0100
commite140ca9dcef9bd86f9c9214872107693ef8c441c (patch)
tree170cd7378b25cdcc7e3452f0b6953c1f1551550d /src/exchangedb
parentbb7c58921eb56d464ed2b8a3a6fbbed9c82919d8 (diff)
handle more nicely the case that concurrent withdraws have changed history, causing us to see a different balance just before the commit; in this case, just retry the transaction; this should fix #4794
Diffstat (limited to 'src/exchangedb')
-rw-r--r--src/exchangedb/plugin_exchangedb_postgres.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c
index 0a7f93f77..7ae8b5753 100644
--- a/src/exchangedb/plugin_exchangedb_postgres.c
+++ b/src/exchangedb/plugin_exchangedb_postgres.c
@@ -1971,7 +1971,7 @@ postgres_get_withdraw_info (void *cls,
* @param collectable corresponding collectable coin (blind signature)
* if a coin is found
* @return #GNUNET_SYSERR on internal error
- * #GNUNET_NO if the collectable was not found
+ * #GNUNET_NO if we failed but should retry the transaction
* #GNUNET_YES on success
*/
static int
@@ -2018,8 +2018,13 @@ postgres_insert_withdraw_info (void *cls,
&reserve.balance,
&collectable->amount_with_fee))
{
- /* Should have been checked before we got here... */
- GNUNET_break (0); /* FIXME: this actually happens: #4794 */
+ /* The reserve history was checked to make sure there is enough of a balance
+ left before we tried this; however, concurrent operations may have changed
+ the situation by now. We should re-try the transaction. */
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Withdrawal from reserve `%s' refused due to balance missmatch. Retrying.\n",
+ TALER_B2S (&collectable->reserve_pub));
+ ret = GNUNET_NO;
goto cleanup;
}
expiry = GNUNET_TIME_absolute_add (now,