summaryrefslogtreecommitdiff
path: root/src/exchangedb/test_exchangedb.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2022-01-11 12:47:35 +0100
committerChristian Grothoff <christian@grothoff.org>2022-01-11 12:47:35 +0100
commite7aeec04f4eb52caaa61b1ff9362f6fe0ffe0f2d (patch)
tree7e788144cff60c41a07e2bc136e86ddadf610274 /src/exchangedb/test_exchangedb.c
parentaaaaa9a103628d7694a4fb3bac6335501187cc00 (diff)
downloadexchange-e7aeec04f4eb52caaa61b1ff9362f6fe0ffe0f2d.tar.gz
exchange-e7aeec04f4eb52caaa61b1ff9362f6fe0ffe0f2d.tar.bz2
exchange-e7aeec04f4eb52caaa61b1ff9362f6fe0ffe0f2d.zip
The current recoup API is broken. I guess this is another example where "trivial" API changes turn out to have (multiple!) unexpected consequences.
The current "/recoup" API does not have clear idempotency semantics, as we've discussed on the phone. This is already bad by itself, as it makes it hard to write down what the API does other than "whatever the implementation does". However, it actually breaks correctness in this (admittedly kinda contrived, but not impossible) case: Say that we have a coin A obtained via withdrawal and a coin B obtained via refreshing coin A. Now the denominations of A gets revoked.. The wallet does a recoup of A for EUR:1. Now the denomination of B also gets revoked. The wallet recoups B (incidentally also for EUR:1) and now A can be recouped again for EUR:1. But now the exchange is in a state where it will refuse a legitimate recoup request for A because the detection for an idempotent request kicks in. This is IMHO bad API design, and the exchange should simply always recoup the maximum amount. Furthermore, we usually follow the principle of "API calls that take up DB space are paid". With the current recoup API, I can do many tiny recoup requests which the exchange then has to store, right? I guess it would not be a big change to remove the "amount" value from the recoup/recoup-refresh request bodies, right? - Florian
Diffstat (limited to 'src/exchangedb/test_exchangedb.c')
-rw-r--r--src/exchangedb/test_exchangedb.c4
1 files changed, 0 insertions, 4 deletions
diff --git a/src/exchangedb/test_exchangedb.c b/src/exchangedb/test_exchangedb.c
index a0c648b2d..6724e7b42 100644
--- a/src/exchangedb/test_exchangedb.c
+++ b/src/exchangedb/test_exchangedb.c
@@ -1766,7 +1766,6 @@ run (void *cls)
plugin->do_recoup_refresh (plugin->cls,
&deposit.coin.coin_pub,
rrc_serial,
- &value,
&coin_bks,
&new_coin.coin_pub,
new_known_coin_id,
@@ -1786,7 +1785,6 @@ run (void *cls)
struct TALER_EXCHANGEDB_KycStatus kyc;
bool recoup_ok;
bool internal_failure;
- struct TALER_Amount requested_amount;
struct GNUNET_TIME_Timestamp recoup_timestamp
= GNUNET_TIME_timestamp_get ();
@@ -1795,13 +1793,11 @@ run (void *cls)
plugin->reserves_get (plugin->cls,
&pre_reserve,
&kyc));
- requested_amount = value;
FAILIF (! TALER_amount_is_zero (&pre_reserve.balance));
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
plugin->do_recoup (plugin->cls,
&reserve_pub,
reserve_out_serial_id,
- &requested_amount,
&coin_blind,
&deposit.coin.coin_pub,
known_coin_id,