aboutsummaryrefslogtreecommitdiff
path: root/src/exchangedb
diff options
context:
space:
mode:
Diffstat (limited to 'src/exchangedb')
-rw-r--r--src/exchangedb/0005-legitimization_processes.sql2
-rw-r--r--src/exchangedb/0007-batch_deposits.sql21
-rw-r--r--src/exchangedb/exchange-0007.sql.in1
-rw-r--r--src/exchangedb/exchange_do_deposit.sql3
-rw-r--r--src/exchangedb/pg_do_deposit.c6
5 files changed, 22 insertions, 11 deletions
diff --git a/src/exchangedb/0005-legitimization_processes.sql b/src/exchangedb/0005-legitimization_processes.sql
index c1bffca7d..d8222bf6c 100644
--- a/src/exchangedb/0005-legitimization_processes.sql
+++ b/src/exchangedb/0005-legitimization_processes.sql
@@ -22,7 +22,7 @@ LANGUAGE plpgsql
AS $$
BEGIN
PERFORM create_partitioned_table(
- 'ALTER TABLE legitimization_processes'
+ 'ALTER TABLE %I'
' ADD COLUMN legitimization_measure_serial_id BIGINT'
',ADD COLUMN measure_index INT4 DEFAULT(0)'
',ADD COLUMN error_code INT4 DEFAULT (0)'
diff --git a/src/exchangedb/0007-batch_deposits.sql b/src/exchangedb/0007-batch_deposits.sql
index 65055f6ad..44c832484 100644
--- a/src/exchangedb/0007-batch_deposits.sql
+++ b/src/exchangedb/0007-batch_deposits.sql
@@ -14,25 +14,28 @@
-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
--
-CREATE FUNCTION alter_table_batch_deposits7()
+CREATE FUNCTION alter_table_batch_deposits7(
+ IN partition_suffix TEXT DEFAULT NULL
+)
RETURNS VOID
LANGUAGE plpgsql
AS $$
-DECLARE
- table_name TEXT DEFAULT 'batch_deposits';
BEGIN
- EXECUTE FORMAT (
- 'ALTER TABLE ' || table_name ||
+ PERFORM create_partitioned_table(
+ 'ALTER TABLE %I'
' ADD COLUMN merchant_sig BYTEA CHECK(LENGTH(merchant_sig)=64)'
' DEFAULT NULL'
- ';'
+ ';',
+ 'batch_deposits'
+ ,''
+ ,partition_suffix
);
PERFORM comment_partitioned_column(
- 'signature by the merchant over the contract terms'
- ,'batch_deposits'
+ 'signature by the merchant over the contract terms, of purpuse TALER_SIGNATURE_MERCHANT_CONTRACT'
,'merchant_sig'
- ,NULL
+ ,'batch_deposits'
+ ,partition_suffix
);
END $$;
diff --git a/src/exchangedb/exchange-0007.sql.in b/src/exchangedb/exchange-0007.sql.in
index 6d634e22c..9a03e2fa1 100644
--- a/src/exchangedb/exchange-0007.sql.in
+++ b/src/exchangedb/exchange-0007.sql.in
@@ -21,6 +21,7 @@ SET search_path TO exchange;
#include "0007-wire_targets.sql"
#include "0007-legitimization_outcomes.sql"
+#include "0007-batch_deposits.sql"
COMMIT;
diff --git a/src/exchangedb/exchange_do_deposit.sql b/src/exchangedb/exchange_do_deposit.sql
index ef1d94919..8ada2c497 100644
--- a/src/exchangedb/exchange_do_deposit.sql
+++ b/src/exchangedb/exchange_do_deposit.sql
@@ -19,6 +19,7 @@ CREATE FUNCTION exchange_do_deposit(
-- For batch_deposits
IN in_shard INT8,
IN in_merchant_pub BYTEA,
+ IN in_merchant_sig BYTEA,
IN in_wallet_timestamp INT8,
IN in_exchange_timestamp INT8,
IN in_refund_deadline INT8,
@@ -88,6 +89,7 @@ END IF;
INSERT INTO batch_deposits
(shard
,merchant_pub
+ ,merchant_sig
,wallet_timestamp
,exchange_timestamp
,refund_deadline
@@ -102,6 +104,7 @@ INSERT INTO batch_deposits
VALUES
(in_shard
,in_merchant_pub
+ ,in_merchant_sig
,in_wallet_timestamp
,in_exchange_timestamp
,in_refund_deadline
diff --git a/src/exchangedb/pg_do_deposit.c b/src/exchangedb/pg_do_deposit.c
index ed689696a..da8ddf793 100644
--- a/src/exchangedb/pg_do_deposit.c
+++ b/src/exchangedb/pg_do_deposit.c
@@ -46,6 +46,9 @@ TEH_PG_do_deposit (
/* data for batch_deposits */
GNUNET_PQ_query_param_uint64 (&deposit_shard),
GNUNET_PQ_query_param_auto_from_type (&bd->merchant_pub),
+ GNUNET_is_zero (&bd->merchant_sig)
+ ? GNUNET_PQ_query_param_null ()
+ : GNUNET_PQ_query_param_auto_from_type (&bd->merchant_sig),
GNUNET_PQ_query_param_timestamp (&bd->wallet_timestamp),
GNUNET_PQ_query_param_timestamp (exchange_timestamp),
GNUNET_PQ_query_param_timestamp (&bd->refund_deadline),
@@ -113,7 +116,8 @@ TEH_PG_do_deposit (
",out_insufficient_balance_coin_index AS insufficient_balance_coin_index"
",out_conflict AS conflicted"
" FROM exchange_do_deposit"
- " ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17);");
+ " ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18);")
+ ;
qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
"call_deposit",
params,