misc purse deletion fixes

This commit is contained in:
Christian Grothoff 2022-12-29 00:34:36 +01:00
parent 880c14909b
commit 5df74558de
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
5 changed files with 23 additions and 5 deletions

View File

@ -127,6 +127,7 @@ TEH_handler_purses_delete (
} }
if (decided) if (decided)
{ {
GNUNET_break_op (0);
return TALER_MHD_reply_with_ec ( return TALER_MHD_reply_with_ec (
connection, connection,
TALER_EC_EXCHANGE_PURSE_DELETE_ALREADY_DECIDED, TALER_EC_EXCHANGE_PURSE_DELETE_ALREADY_DECIDED,

View File

@ -14,7 +14,7 @@
-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> -- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
-- --
CREATE OR REPLACE FUNCTION exchange_do_delete_purse( CREATE OR REPLACE FUNCTION exchange_do_purse_delete(
IN in_purse_pub BYTEA, IN in_purse_pub BYTEA,
IN in_purse_sig BYTEA, IN in_purse_sig BYTEA,
IN in_now INT8, IN in_now INT8,
@ -28,7 +28,7 @@ DECLARE
my_in_reserve_quota BOOLEAN; my_in_reserve_quota BOOLEAN;
BEGIN BEGIN
SELECT COUNT(*) FROM purse_decision PERFORM refunded FROM purse_decision
WHERE purse_pub=in_purse_pub; WHERE purse_pub=in_purse_pub;
IF FOUND IF FOUND
THEN THEN
@ -49,7 +49,7 @@ THEN
END IF; END IF;
-- store reserve deletion -- store reserve deletion
INSERT INTO purse_deletion INSERT INTO exchange.purse_deletion
(purse_pub (purse_pub
,purse_sig) ,purse_sig)
VALUES VALUES
@ -115,5 +115,5 @@ END LOOP;
END $$; END $$;
COMMENT ON FUNCTION exchange_do_delete_purse(BYTEA,BYTEA,INT8) COMMENT ON FUNCTION exchange_do_purse_delete(BYTEA,BYTEA,INT8)
IS 'Delete a previously undecided purse and refund the coins (if any).'; IS 'Delete a previously undecided purse and refund the coins (if any).';

View File

@ -28,11 +28,11 @@ SET search_path TO exchange;
#include "exchange_do_recoup_to_reserve.sql" #include "exchange_do_recoup_to_reserve.sql"
#include "exchange_do_recoup_to_coin.sql" #include "exchange_do_recoup_to_coin.sql"
#include "exchange_do_gc.sql" #include "exchange_do_gc.sql"
#include "exchange_do_purse_delete.sql"
#include "exchange_do_purse_deposit.sql" #include "exchange_do_purse_deposit.sql"
#include "exchange_do_purse_merge.sql" #include "exchange_do_purse_merge.sql"
#include "exchange_do_reserve_purse.sql" #include "exchange_do_reserve_purse.sql"
#include "exchange_do_expire_purse.sql" #include "exchange_do_expire_purse.sql"
#include "exchange_do_delete_purse.sql"
#include "exchange_do_history_request.sql" #include "exchange_do_history_request.sql"
#include "exchange_do_reserve_open_deposit.sql" #include "exchange_do_reserve_open_deposit.sql"
#include "exchange_do_reserve_open.sql" #include "exchange_do_reserve_open.sql"

View File

@ -208,6 +208,10 @@ TALER_EXCHANGE_purse_delete (
GNUNET_free (xhdr); GNUNET_free (xhdr);
} }
eh = TALER_EXCHANGE_curl_easy_get_ (pdh->url); eh = TALER_EXCHANGE_curl_easy_get_ (pdh->url);
GNUNET_assert (CURLE_OK ==
curl_easy_setopt (eh,
CURLOPT_CUSTOMREQUEST,
MHD_HTTP_METHOD_DELETE));
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"URL for purse delete: `%s'\n", "URL for purse delete: `%s'\n",
pdh->url); pdh->url);

View File

@ -158,6 +158,19 @@ run (void *cls,
TALER_TESTING_cmd_end () TALER_TESTING_cmd_end ()
}; };
struct TALER_TESTING_Command push[] = { struct TALER_TESTING_Command push[] = {
TALER_TESTING_cmd_purse_create_with_deposit (
"purse-with-deposit-for-delete",
MHD_HTTP_OK,
"{\"amount\":\"EUR:1\",\"summary\":\"ice cream\"}",
true, /* upload contract */
GNUNET_TIME_UNIT_MINUTES, /* expiration */
"withdraw-coin-1",
"EUR:1.01",
NULL),
TALER_TESTING_cmd_purse_delete (
"purse-with-deposit-delete",
MHD_HTTP_NO_CONTENT,
"purse-with-deposit-for-delete"),
TALER_TESTING_cmd_purse_create_with_deposit ( TALER_TESTING_cmd_purse_create_with_deposit (
"purse-with-deposit", "purse-with-deposit",
MHD_HTTP_OK, MHD_HTTP_OK,