summaryrefslogtreecommitdiff
path: root/src/exchange/taler-exchange-httpd_purses_deposit.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2022-12-09 13:33:57 +0100
committerChristian Grothoff <christian@grothoff.org>2022-12-09 13:33:57 +0100
commitd1c160d1b9bddfcd6f77148ae8a03944571fec25 (patch)
treef981900b86fa96e8e0baaa5c00c299d5c924e1dc /src/exchange/taler-exchange-httpd_purses_deposit.c
parentf9cc76ad3c4d7a8c720e971a1a9cba1bb79fa974 (diff)
downloadexchange-d1c160d1b9bddfcd6f77148ae8a03944571fec25.tar.gz
exchange-d1c160d1b9bddfcd6f77148ae8a03944571fec25.tar.bz2
exchange-d1c160d1b9bddfcd6f77148ae8a03944571fec25.zip
properly handle GONE case on purse deposit
Diffstat (limited to 'src/exchange/taler-exchange-httpd_purses_deposit.c')
-rw-r--r--src/exchange/taler-exchange-httpd_purses_deposit.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/exchange/taler-exchange-httpd_purses_deposit.c b/src/exchange/taler-exchange-httpd_purses_deposit.c
index 0875ed2e6..4bebebf6f 100644
--- a/src/exchange/taler-exchange-httpd_purses_deposit.c
+++ b/src/exchange/taler-exchange-httpd_purses_deposit.c
@@ -166,6 +166,7 @@ deposit_transaction (void *cls,
struct TEH_PurseDepositedCoin *coin = &pcc->coins[i];
bool balance_ok = false;
bool conflict = true;
+ bool too_late = true;
qs = TEH_make_coin_known (&coin->cpi,
connection,
@@ -180,6 +181,7 @@ deposit_transaction (void *cls,
&coin->coin_sig,
&coin->amount_minus_fee,
&balance_ok,
+ &too_late,
&conflict);
if (qs <= 0)
{
@@ -204,9 +206,16 @@ deposit_transaction (void *cls,
&coin->cpi.coin_pub);
return GNUNET_DB_STATUS_HARD_ERROR;
}
- // FIXME: there is also a 'conflict' case where the purse was already
- // decided (fully paid up OR expired), we should probably distinguish
- // those better!
+ if (too_late)
+ {
+ TEH_plugin->rollback (TEH_plugin->cls);
+ *mhd_ret
+ = TALER_MHD_reply_with_ec (
+ connection,
+ TALER_EC_EXCHANGE_PURSE_DEPOSIT_DECIDED_ALREADY,
+ NULL);
+ return GNUNET_DB_STATUS_HARD_ERROR;
+ }
if (conflict)
{
struct TALER_Amount amount;