This commit is contained in:
Christian Grothoff 2023-05-21 19:20:09 +02:00
parent aa8d44aab3
commit d36f1b3b6a
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
2 changed files with 25 additions and 25 deletions

View File

@ -1063,12 +1063,18 @@ main (int argc,
{
/* If we use the fakebank, we MUST reset the database as the fakebank
will have forgotten everything... */
GNUNET_assert (GNUNET_OK ==
TALER_TESTING_prepare_exchange (cfg_filename,
(GNUNET_YES == use_fakebank)
? GNUNET_YES
: GNUNET_NO,
&ec));
if (GNUNET_OK !=
TALER_TESTING_prepare_exchange (cfg_filename,
(GNUNET_YES == use_fakebank)
? GNUNET_YES
: GNUNET_NO,
&ec))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to prepare the exchange for launch\n");
GNUNET_free (cfg_filename);
return BAD_CONFIG_FILE;
}
}
else
{

View File

@ -975,6 +975,10 @@ END $$;
CREATE TYPE exchange_do_array_reserve_insert_return_type
AS
(transaction_duplicate BOOLEAN
,ruuid INT8);
CREATE OR REPLACE FUNCTION exchange_do_array_reserves_insert(
IN in_gc_date INT8,
@ -987,9 +991,8 @@ CREATE OR REPLACE FUNCTION exchange_do_array_reserves_insert(
IN ina_execution_date INT8[],
IN ina_wire_source_h_payto BYTEA[],
IN ina_payto_uri VARCHAR[],
IN ina_notify TEXT[],
OUT transaction_duplicate BOOLEAN,
OUT ruuid INT8)
IN ina_notify TEXT[])
RETURNS SETOF exchange_do_array_reserve_insert_return_type
LANGUAGE plpgsql
AS $$
DECLARE
@ -1015,8 +1018,7 @@ BEGIN
,UNNEST (ina_payto_uri) AS payto_uri
ON CONFLICT DO NOTHING;
OPEN curs FOR
WITH reserve_changes AS (
FOR i IN
SELECT
reserve_pub
,wire_ref
@ -1035,16 +1037,8 @@ BEGIN
,UNNEST (ina_exchange_account_name) AS exchange_account_name
,UNNEST (ina_execution_date) AS execution_date
,UNNEST (ina_wire_source_h_payto) AS wire_source_h_payto
,UNNEST (ina_notify) AS notify;
<<loop>> LOOP
FETCH FROM curs INTO i;
IF NOT FOUND
THEN
EXIT loop;
END IF;
,UNNEST (ina_notify) AS notify
LOOP
INSERT INTO reserves
(reserve_pub
,current_balance_val
@ -1060,7 +1054,7 @@ BEGIN
)
ON CONFLICT DO NOTHING
RETURNING reserve_uuid
INTO uuid;
INTO uuid;
conflict = NOT FOUND;
INSERT INTO reserves_in
@ -1079,6 +1073,7 @@ BEGIN
,i.exchange_account_section
,i.wire_source_h_payto
,i.execution_date
)
ON CONFLICT DO NOTHING;
IF NOT FOUND
@ -1098,9 +1093,8 @@ BEGIN
END IF;
dup = FALSE;
END IF;
RETURN (dup,uuid);
END LOOP loop_reserve;
CLOSE curs;
RETURN NEXT (dup,uuid);
END LOOP;
RETURN;
END $$;