diff options
Diffstat (limited to 'src/exchange')
| -rw-r--r-- | src/exchange/taler-exchange-httpd_purses_create.c | 11 | ||||
| -rw-r--r-- | src/exchange/taler-exchange-httpd_purses_deposit.c | 15 |
2 files changed, 23 insertions, 3 deletions
diff --git a/src/exchange/taler-exchange-httpd_purses_create.c b/src/exchange/taler-exchange-httpd_purses_create.c index f3da2c85..130f9fae 100644 --- a/src/exchange/taler-exchange-httpd_purses_create.c +++ b/src/exchange/taler-exchange-httpd_purses_create.c @@ -201,6 +201,7 @@ create_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, @@ -215,6 +216,7 @@ create_transaction (void *cls, &coin->coin_sig, &coin->amount_minus_fee, &balance_ok, + &too_late, &conflict); if (qs <= 0) { @@ -243,6 +245,15 @@ create_transaction (void *cls, &coin->cpi.coin_pub); return GNUNET_DB_STATUS_HARD_ERROR; } + if (too_late) + { + *mhd_ret + = TALER_MHD_reply_with_ec ( + connection, + TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE, + "too late to deposit on purse creation"); + return GNUNET_DB_STATUS_HARD_ERROR; + } if (conflict) { struct TALER_Amount amount; diff --git a/src/exchange/taler-exchange-httpd_purses_deposit.c b/src/exchange/taler-exchange-httpd_purses_deposit.c index 0875ed2e..4bebebf6 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; |
