[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-exchange] branch master updated: fix for foreign key constraint p
From: |
gnunet |
Subject: |
[taler-exchange] branch master updated: fix for foreign key constraint problem for free purses on purse creation from reserve |
Date: |
Mon, 16 Jan 2023 15:45:41 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository exchange.
The following commit(s) were added to refs/heads/master by this push:
new 6596e6c7 fix for foreign key constraint problem for free purses on
purse creation from reserve
6596e6c7 is described below
commit 6596e6c72362d3cbc6b383feb22b3a99717dbf66
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Mon Jan 16 15:45:35 2023 +0100
fix for foreign key constraint problem for free purses on purse creation
from reserve
---
src/exchangedb/exchange_do_reserve_purse.sql | 12 +++++++++++-
src/exchangedb/pg_do_reserve_purse.c | 11 +++++++++++
src/exchangedb/pg_reserves_in_insert.c | 4 ++--
3 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/src/exchangedb/exchange_do_reserve_purse.sql
b/src/exchangedb/exchange_do_reserve_purse.sql
index a110c85a..4f65c660 100644
--- a/src/exchangedb/exchange_do_reserve_purse.sql
+++ b/src/exchangedb/exchange_do_reserve_purse.sql
@@ -18,6 +18,8 @@ CREATE OR REPLACE FUNCTION exchange_do_reserve_purse(
IN in_purse_pub BYTEA,
IN in_merge_sig BYTEA,
IN in_merge_timestamp INT8,
+ IN in_reserve_expiration INT8,
+ IN in_reserve_gc INT8,
IN in_reserve_sig BYTEA,
IN in_reserve_quota BOOLEAN,
IN in_purse_fee_val INT8,
@@ -105,6 +107,14 @@ ELSE
out_no_funds=TRUE;
RETURN;
END IF;
+ INSERT INTO exchange.reserves
+ (reserve_pub
+ ,expiration_date
+ ,gc_date)
+ VALUES
+ (in_reserve_pub
+ ,in_reserve_expiration
+ ,in_reserve_gc);
ELSE
UPDATE exchange.reserves
SET
@@ -149,7 +159,7 @@ INSERT INTO exchange.account_merges
END $$;
-COMMENT ON FUNCTION exchange_do_reserve_purse(BYTEA, BYTEA, INT8, BYTEA,
BOOLEAN, INT8, INT4, BYTEA, BYTEA)
+COMMENT ON FUNCTION exchange_do_reserve_purse(BYTEA, BYTEA, INT8, INT8, INT8,
BYTEA, BOOLEAN, INT8, INT4, BYTEA, BYTEA)
IS 'Create a purse for a reserve.';
diff --git a/src/exchangedb/pg_do_reserve_purse.c
b/src/exchangedb/pg_do_reserve_purse.c
index cb8f83d4..e8d3b7f1 100644
--- a/src/exchangedb/pg_do_reserve_purse.c
+++ b/src/exchangedb/pg_do_reserve_purse.c
@@ -57,10 +57,21 @@ TEH_PG_do_reserve_purse (
struct PostgresClosure *pg = cls;
struct TALER_Amount zero_fee;
struct TALER_PaytoHashP h_payto;
+ struct GNUNET_TIME_Timestamp reserve_expiration
+ = GNUNET_TIME_absolute_to_timestamp (
+ GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (),
+ pg->idle_reserve_expiration_time));
+ struct GNUNET_TIME_Timestamp reserve_gc
+ = GNUNET_TIME_absolute_to_timestamp (
+ GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (),
+ pg->legal_reserve_expiration_time));
+
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (purse_pub),
GNUNET_PQ_query_param_auto_from_type (merge_sig),
GNUNET_PQ_query_param_timestamp (&merge_timestamp),
+ GNUNET_PQ_query_param_timestamp (&reserve_expiration),
+ GNUNET_PQ_query_param_timestamp (&reserve_gc),
GNUNET_PQ_query_param_auto_from_type (reserve_sig),
GNUNET_PQ_query_param_bool (NULL == purse_fee),
TALER_PQ_query_param_amount (NULL == purse_fee
diff --git a/src/exchangedb/pg_reserves_in_insert.c
b/src/exchangedb/pg_reserves_in_insert.c
index 428e1923..0fdc4a16 100644
--- a/src/exchangedb/pg_reserves_in_insert.c
+++ b/src/exchangedb/pg_reserves_in_insert.c
@@ -199,7 +199,7 @@ TEH_PG_reserves_in_insert (void *cls,
(We are only run in a larger transaction for performance.) */
enum GNUNET_DB_QueryStatus cs;
- cs = TEH_PG_commit(pg);
+ cs = TEH_PG_commit (pg);
if (cs < 0)
return cs;
if (GNUNET_OK !=
@@ -257,7 +257,7 @@ TEH_PG_reserves_in_insert (void *cls,
updated_reserve.gc = GNUNET_TIME_timestamp_max (gc,
reserve.gc);
qs3 = TEH_PG_reserves_update (pg,
- &updated_reserve);
+ &updated_reserve);
switch (qs3)
{
case GNUNET_DB_STATUS_HARD_ERROR:
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-exchange] branch master updated: fix for foreign key constraint problem for free purses on purse creation from reserve,
gnunet <=