diff options
Diffstat (limited to 'src/exchange/taler-exchange-httpd_withdraw.c')
-rw-r--r-- | src/exchange/taler-exchange-httpd_withdraw.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/exchange/taler-exchange-httpd_withdraw.c b/src/exchange/taler-exchange-httpd_withdraw.c index 86d2c62b..8d001488 100644 --- a/src/exchange/taler-exchange-httpd_withdraw.c +++ b/src/exchange/taler-exchange-httpd_withdraw.c @@ -97,6 +97,7 @@ withdraw_transaction (void *cls, enum GNUNET_DB_QueryStatus qs; bool found = false; bool balance_ok = false; + bool nonce_ok = false; struct GNUNET_TIME_Timestamp now; uint64_t ruuid; const struct TALER_CsNonce *nonce; @@ -108,16 +109,13 @@ withdraw_transaction (void *cls, (TALER_DENOMINATION_CS == bp->cipher) ? &bp->details.cs_blinded_planchet.nonce : NULL; - // FIXME: what error is returned on nonce reuse? - // Should expand function to return this error - // specifically, and then we should return a - // TALER_EC_EXCHANGE_WITHDRAW_NONCE_REUSE, qs = TEH_plugin->do_withdraw (TEH_plugin->cls, nonce, &wc->collectable, now, &found, &balance_ok, + &nonce_ok, &wc->kyc, &ruuid); if (0 > qs) @@ -146,6 +144,15 @@ withdraw_transaction (void *cls, &wc->collectable.reserve_pub); return GNUNET_DB_STATUS_HARD_ERROR; } + if (! nonce_ok) + { + TEH_plugin->rollback (TEH_plugin->cls); + *mhd_ret = TALER_MHD_reply_with_error (connection, + MHD_HTTP_CONFLICT, + TALER_EC_EXCHANGE_WITHDRAW_NONCE_REUSE, + NULL); + return GNUNET_DB_STATUS_HARD_ERROR; + } if ( (TEH_KYC_NONE != TEH_kyc_config.mode) && (! wc->kyc.ok) && (TALER_EXCHANGEDB_KYC_W2W == wc->kyc.type) ) |