gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-exchange] branch master updated: -implement sketch for pg_do_rese


From: gnunet
Subject: [taler-exchange] branch master updated: -implement sketch for pg_do_reserve_open.c
Date: Mon, 03 Oct 2022 19:34:16 +0200

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 4a487b17 -implement sketch for pg_do_reserve_open.c
4a487b17 is described below

commit 4a487b179c013886721c4aa06af9c75e9aad508c
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Mon Oct 3 19:34:11 2022 +0200

    -implement sketch for pg_do_reserve_open.c
---
 contrib/gana                                  |  2 +-
 src/exchangedb/Makefile.am                    |  3 ++-
 src/exchangedb/pg_do_reserve_open.c           | 31 ++++++++++++++++-----------
 src/exchangedb/pg_do_reserve_open.h           |  2 +-
 src/exchangedb/pg_select_reserve_close_info.c |  2 +-
 src/include/taler_exchangedb_plugin.h         |  2 +-
 6 files changed, 24 insertions(+), 18 deletions(-)

diff --git a/contrib/gana b/contrib/gana
index d402af78..57d96e8e 160000
--- a/contrib/gana
+++ b/contrib/gana
@@ -1 +1 @@
-Subproject commit d402af78f6d360841db53baa46dddae13590ec33
+Subproject commit 57d96e8e123df90c804a821874fc6cb88671ab75
diff --git a/src/exchangedb/Makefile.am b/src/exchangedb/Makefile.am
index e446682b..1fc89d1b 100644
--- a/src/exchangedb/Makefile.am
+++ b/src/exchangedb/Makefile.am
@@ -69,11 +69,12 @@ endif
 
 libtaler_plugin_exchangedb_postgres_la_SOURCES = \
   plugin_exchangedb_postgres.c pg_helper.h \
+  pg_do_reserve_open.c pg_do_reserve_open.h \
   pg_insert_close_request.c pg_insert_close_request.h \
   pg_insert_reserve_open_deposit.c pg_insert_reserve_open_deposit.h \
   pg_iterate_kyc_reference.c pg_iterate_kyc_reference.h \
   pg_iterate_reserve_close_info.c pg_iterate_reserve_close_info.h \
-  pg_select_reserve_close_info.c pg_select_reserve_close_info.h 
+  pg_select_reserve_close_info.c pg_select_reserve_close_info.h
 libtaler_plugin_exchangedb_postgres_la_LIBADD = \
   $(LTLIBINTL)
 libtaler_plugin_exchangedb_postgres_la_LDFLAGS = \
diff --git a/src/exchangedb/pg_do_reserve_open.c 
b/src/exchangedb/pg_do_reserve_open.c
index e4f72845..bd4f7240 100644
--- a/src/exchangedb/pg_do_reserve_open.c
+++ b/src/exchangedb/pg_do_reserve_open.c
@@ -37,32 +37,37 @@ TEH_PG_do_reserve_open (
   struct GNUNET_TIME_Timestamp now,
   const struct TALER_Amount *open_fee,
   struct TALER_Amount *open_cost,
-  const struct GNUNET_TIME_Timestamp *final_expiration)
+  struct GNUNET_TIME_Timestamp *final_expiration)
 {
   struct PostgresClosure *pg = cls;
-  // FIXME: everything from here is cut&paste
   struct GNUNET_PQ_QueryParam params[] = {
-    GNUNET_PQ_query_param_auto_from_type (&cpi->coin_pub),
-    GNUNET_PQ_query_param_uint64 (&known_coin_id),
-    GNUNET_PQ_query_param_auto_from_type (coin_sig),
+    GNUNET_PQ_query_param_auto_from_type (reserve_pub),
+    TALER_PQ_query_param_amount (total_paid),
+    GNUNET_PQ_query_param_uint32 (&min_purse_limit),
     GNUNET_PQ_query_param_auto_from_type (reserve_sig),
-    TALER_PQ_query_param_amount (coin_total),
+    GNUNET_PQ_query_param_timestamp (&desired_expiration),
+    GNUNET_PQ_query_param_timestamp (&now),
+    TALER_PQ_query_param_amount (open_fee),
     GNUNET_PQ_query_param_end
   };
   struct GNUNET_PQ_ResultSpec rs[] = {
-    GNUNET_PQ_result_spec_bool ("insufficient_funds",
-                                insufficient_funds),
+    TALER_PQ_RESULT_SPEC_AMOUNT ("open_cost",
+                                 open_cost),
+    GNUNET_PQ_result_spec_timestamp ("final_expiration",
+                                     final_expiration),
     GNUNET_PQ_result_spec_end
   };
 
   PREPARE (pg,
-           "insert_reserve_open_deposit",
+           "do_reserve_open",
            "SELECT "
-           " insufficient_funds"
-           " FROM exchange_do_reserve_open_deposit"
-           " ($1,$2,$3,$4,$5,$6);");
+           " open_cost_val"
+           ",open_cost_frac"
+           ",final_expiration"
+           " FROM exchange_do_reserve_open"
+           " ($1,$2,$3,$4,$5,$6,$7,$8,$9);");
   return GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
-                                                   
"insert_reserve_open_deposit",
+                                                   "do_reserve_open",
                                                    params,
                                                    rs);
 }
diff --git a/src/exchangedb/pg_do_reserve_open.h 
b/src/exchangedb/pg_do_reserve_open.h
index 6e4c91fc..aeef59eb 100644
--- a/src/exchangedb/pg_do_reserve_open.h
+++ b/src/exchangedb/pg_do_reserve_open.h
@@ -49,7 +49,7 @@ TEH_PG_do_reserve_open (
   struct GNUNET_TIME_Timestamp now,
   const struct TALER_Amount *open_fee,
   struct TALER_Amount *open_cost,
-  const struct GNUNET_TIME_Timestamp *final_expiration);
+  struct GNUNET_TIME_Timestamp *final_expiration);
 
 
 #endif
diff --git a/src/exchangedb/pg_select_reserve_close_info.c 
b/src/exchangedb/pg_select_reserve_close_info.c
index a573f100..53ea4568 100644
--- a/src/exchangedb/pg_select_reserve_close_info.c
+++ b/src/exchangedb/pg_select_reserve_close_info.c
@@ -22,7 +22,7 @@
 #include "taler_error_codes.h"
 #include "taler_dbevents.h"
 #include "taler_pq_lib.h"
-#include "pg_insert_reserve_open_deposit.h"
+#include "pg_select_reserve_close_info.h"
 #include "pg_helper.h"
 
 
diff --git a/src/include/taler_exchangedb_plugin.h 
b/src/include/taler_exchangedb_plugin.h
index e5cc8dfa..bde3c813 100644
--- a/src/include/taler_exchangedb_plugin.h
+++ b/src/include/taler_exchangedb_plugin.h
@@ -4108,7 +4108,7 @@ struct TALER_EXCHANGEDB_Plugin
                      struct GNUNET_TIME_Timestamp now,
                      const struct TALER_Amount *open_fee,
                      struct TALER_Amount *open_cost,
-                     const struct GNUNET_TIME_Timestamp *final_expiration);
+                     struct GNUNET_TIME_Timestamp *final_expiration);
 
 
   /**

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]