gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [taler-exchange] branch master updated (fb952bab -> 4f37950


From: gnunet
Subject: [GNUnet-SVN] [taler-exchange] branch master updated (fb952bab -> 4f37950a)
Date: Sat, 20 Oct 2018 19:40:11 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a change to branch master
in repository exchange.

    from fb952bab reduce redundant data fetch (#5444)
     new 9d18caa0 remove dead variable
     new 4f37950a extend auditordb API with function to store deposit 
confirmations

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/auditordb/plugin_auditordb_postgres.c        | 74 +++++++++++++++++++-
 src/exchange/taler-exchange-httpd_refresh_melt.c |  1 -
 src/include/taler_auditordb_plugin.h             | 89 ++++++++++++++++++++++++
 3 files changed, 162 insertions(+), 2 deletions(-)

diff --git a/src/auditordb/plugin_auditordb_postgres.c 
b/src/auditordb/plugin_auditordb_postgres.c
index 13fbbc2f..bf88e5e9 100644
--- a/src/auditordb/plugin_auditordb_postgres.c
+++ b/src/auditordb/plugin_auditordb_postgres.c
@@ -1,6 +1,6 @@
 /*
   This file is part of TALER
-  Copyright (C) 2014-2017 GNUnet e.V.
+  Copyright (C) 2014-2018 GNUnet e.V.
 
   TALER is free software; you can redistribute it and/or modify it under the
   terms of the GNU General Public License as published by the Free Software
@@ -361,6 +361,24 @@ postgres_create_tables (void *cls)
                            ")"),
     GNUNET_PQ_make_try_execute ("CREATE INDEX 
auditor_historic_reserve_summary_by_master_pub_start_date "
                                "ON 
auditor_historic_reserve_summary(master_pub,start_date)"),
+
+    /* Table with deposit confirmation sent to us by merchants;
+       we must check that the exchange reported these properly. */
+    GNUNET_PQ_make_execute ("CREATE TABLE IF NOT EXISTS deposit_confirmations "
+                           "(master_pub BYTEA NOT NULL CHECK 
(LENGTH(master_pub)=32)"
+                           ",h_contract_terms BYTEA PRIMARY KEY CHECK 
(LENGTH(h_contract_terms_hash)=64)"
+                            ",h_wire BYTEA PRIMARY KEY CHECK 
(LENGTH(h_wire)=64)"
+                           ",timestamp INT8 NOT NULL"
+                           ",refund_deadline INT8 NOT NULL"
+                           ",amount_with_fee_val INT8 NOT NULL"
+                           ",amount_with_fee_frac INT4 NOT NULL"
+                           ",amount_with_fee_curr 
VARCHAR("TALER_CURRENCY_LEN_STR") NOT NULL"
+                            ",coin_pub BYTEA PRIMARY KEY CHECK 
(LENGTH(coin_pub)=32)"
+                            ",merchant BYTEA PRIMARY KEY CHECK 
(LENGTH(coin_pub)=32)"
+                            ",exchange_sig BYTEA PRIMARY KEY CHECK 
(LENGTH(coin_pub)=32)"
+                            ",exchange_pub BYTEA PRIMARY KEY CHECK 
(LENGTH(coin_pub)=32)"
+                            ",master_sig BYTEA PRIMARY KEY CHECK 
(LENGTH(coin_pub)=32)"
+                           ")"),
     /* Table with historic business ledger; basically, when the exchange
        operator decides to use operating costs for anything but wire
        transfers to merchants, it goes in here.  This happens when the
@@ -475,6 +493,22 @@ postgres_prepare (PGconn *db_conn)
                            " WHERE master_pub=$1;",
                            1),
     /* Used in #postgres_insert_auditor_progress() */
+    GNUNET_PQ_make_prepare ("auditor_deposit_confirmation_insert",
+                           "INSERT INTO deposit_confirmations "
+                           "(master_pub"
+                           ",h_contract_terms"
+                           ",h_wire"
+                           ",timestamp"
+                           ",refund_deadline"
+                           ",amount_without_fee"
+                           ",coin_pub"
+                           ",merchant"
+                           ",exchange_sig"
+                           ",exchange_pub"
+                           ",master_sig" /* master_sig could be normalized... 
*/
+                           ") VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11);",
+                           11),
+    /* Used in #postgres_insert_auditor_progress() */
     GNUNET_PQ_make_prepare ("auditor_progress_insert",
                            "INSERT INTO auditor_progress "
                            "(master_pub"
@@ -1048,6 +1082,42 @@ postgres_gc (void *cls)
 
 
 /**
+ * Insert information about a deposit confirmation into the database.
+ *
+ * @param cls the @e cls of this struct with the plugin-specific state
+ * @param session connection to the database
+ * @param dc deposit confirmation information to store
+ * @return query result status
+ */
+static enum GNUNET_DB_QueryStatus
+postgres_insert_deposit_confirmation (void *cls,
+                                      struct TALER_AUDITORDB_Session *session,
+                                      const struct 
TALER_AUDITORDB_DepositConfirmation *dc)
+{
+  struct GNUNET_PQ_QueryParam params[] = {
+    GNUNET_PQ_query_param_auto_from_type (&dc->master_public_key),
+    GNUNET_PQ_query_param_auto_from_type (&dc->h_contract_terms),
+    GNUNET_PQ_query_param_auto_from_type (&dc->h_wire),
+    TALER_PQ_query_param_absolute_time (&dc->timestamp),
+    TALER_PQ_query_param_absolute_time (&dc->refund_deadline),
+    TALER_PQ_query_param_amount (&dc->amount_without_fee),
+    GNUNET_PQ_query_param_auto_from_type (&dc->coin_pub),
+    GNUNET_PQ_query_param_auto_from_type (&dc->merchant),
+    GNUNET_PQ_query_param_auto_from_type (&dc->exchange_sig),
+    GNUNET_PQ_query_param_auto_from_type (&dc->exchange_pub),
+    GNUNET_PQ_query_param_auto_from_type (&dc->master_sig),
+    GNUNET_PQ_query_param_end
+  };
+
+  return GNUNET_PQ_eval_prepared_non_select (session->conn,
+                                            
"auditor_deposit_confirmation_insert",
+                                            params);
+
+
+}
+
+
+/**
  * Insert information about a denomination key and in particular
  * the properties (value, fees, expiration times) the coins signed
  * with this key have.
@@ -2625,6 +2695,8 @@ libtaler_plugin_auditordb_postgres_init (void *cls)
   plugin->rollback = &postgres_rollback;
   plugin->gc = &postgres_gc;
 
+  plugin->insert_deposit_confirmation = &postgres_insert_deposit_confirmation;
+
   plugin->select_denomination_info = &postgres_select_denomination_info;
   plugin->insert_denomination_info = &postgres_insert_denomination_info;
 
diff --git a/src/exchange/taler-exchange-httpd_refresh_melt.c 
b/src/exchange/taler-exchange-httpd_refresh_melt.c
index 476188de..81a8aca9 100644
--- a/src/exchange/taler-exchange-httpd_refresh_melt.c
+++ b/src/exchange/taler-exchange-httpd_refresh_melt.c
@@ -250,7 +250,6 @@ refresh_melt_transaction (void *cls,
                          int *mhd_ret)
 {
   struct RefreshMeltContext *rmc = cls;
-  struct TALER_EXCHANGEDB_RefreshMelt rm;
   enum GNUNET_DB_QueryStatus qs;
   uint32_t noreveal_index;
 
diff --git a/src/include/taler_auditordb_plugin.h 
b/src/include/taler_auditordb_plugin.h
index e84fa048..622ae1af 100644
--- a/src/include/taler_auditordb_plugin.h
+++ b/src/include/taler_auditordb_plugin.h
@@ -187,6 +187,81 @@ struct TALER_AUDITORDB_ProgressPoint
 
 
 /**
+ * Information about a deposit confirmation we received from
+ * a merchant.
+ */
+struct TALER_AUDITORDB_DepositConfirmation
+{
+
+  /**
+   * Hash over the contract for which this deposit is made.
+   */
+  struct GNUNET_HashCode h_contract_terms;
+
+  /**
+   * Hash over the wiring information of the merchant.
+   */
+  struct GNUNET_HashCode h_wire;
+
+  /**
+   * Time when this confirmation was generated.
+   */
+  struct GNUNET_TIME_Absolute timestamp;
+
+  /**
+   * How much time does the @e merchant have to issue a refund
+   * request?  Zero if refunds are not allowed.  After this time, the
+   * coin cannot be refunded.  Note that the wire transfer will not be
+   * performed by the exchange until the refund deadline.  This value
+   * is taken from the original deposit request.
+   */
+  struct GNUNET_TIME_Absolute refund_deadline;
+
+  /**
+   * Amount to be deposited, excluding fee.  Calculated from the
+   * amount with fee and the fee from the deposit request.
+   */
+  struct TALER_Amount amount_without_fee;
+
+  /**
+   * The coin's public key.  This is the value that must have been
+   * signed (blindly) by the Exchange.  The deposit request is to be
+   * signed by the corresponding private key (using EdDSA).
+   */
+  struct TALER_CoinSpendPublicKeyP coin_pub;
+
+  /**
+   * The Merchant's public key.  Allows the merchant to later refund
+   * the transaction or to inquire about the wire transfer identifier.
+   */
+  struct TALER_MerchantPublicKeyP merchant;
+
+  /**
+   * Signature from the exchange of type
+   * #TALER_SIGNATURE_EXCHANGE_CONFIRM_DEPOSIT.
+   */
+  struct TALER_ExchangeSignatureP exchange_sig;
+
+  /**
+   * Public signing key from the exchange matching @e exchange_sig.
+   */
+  struct TALER_ExchangeSignatureP exchange_pub;
+
+  /**
+   * Exchange master signature over @e exchange_sig.
+   */
+  struct TALER_MasterSignatureP master_sig;
+
+  /**
+   * Master public key of the exchange corresponding to @e master_sig.
+   * Identifies the exchange this is about.
+   */
+  struct TALER_MasterPublicKeyP master_public_key;
+
+};
+
+
+/**
  * Handle for one session with the database.
  */
 struct TALER_AUDITORDB_Session;
@@ -292,6 +367,20 @@ struct TALER_AUDITORDB_Plugin
 
 
   /**
+   * Insert information about a deposit confirmation into the database.
+   *
+   * @param cls the @e cls of this struct with the plugin-specific state
+   * @param session connection to the database
+   * @param dc deposit confirmation information to store
+   * @return query result status
+   */
+  enum GNUNET_DB_QueryStatus
+  (*insert_deposit_confirmation) (void *cls,
+                                  struct TALER_AUDITORDB_Session *session,
+                                  const struct 
TALER_AUDITORDB_DepositConfirmation *dc);
+
+
+  /**
    * Insert information about a denomination key and in particular
    * the properties (value, fees, expiration times) the coins signed
    * with this key have.

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

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