From e7aeec04f4eb52caaa61b1ff9362f6fe0ffe0f2d Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 11 Jan 2022 12:47:35 +0100 Subject: 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 --- src/testing/testing_api_cmd_recoup.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src/testing/testing_api_cmd_recoup.c') diff --git a/src/testing/testing_api_cmd_recoup.c b/src/testing/testing_api_cmd_recoup.c index 6290f255e..7bd477377 100644 --- a/src/testing/testing_api_cmd_recoup.c +++ b/src/testing/testing_api_cmd_recoup.c @@ -318,7 +318,6 @@ recoup_run (void *cls, denom_pub, coin_sig, &planchet, - &ps->reserve_history.amount, &recoup_cb, ps); GNUNET_assert (NULL != ps->ph); -- cgit v1.2.3