exchange

Base system with REST service to issue digital coins, run by the payment service provider
Log | Files | Refs | Submodules | README | LICENSE

commit 57acad487de0ecb3f964c83a60e4f2d7d1ec460b
parent 0b370a68148507016c6e707b01918350887887f7
Author: Christian Grothoff <christian@grothoff.org>
Date:   Sat,  6 Nov 2021 19:04:54 +0100

move extension options to external table

Diffstat:
Msrc/exchangedb/exchange-0001.sql | 7++++++-
Msrc/exchangedb/irbt_callbacks.c | 3++-
Msrc/exchangedb/lrbt_callbacks.c | 6+++---
Msrc/exchangedb/plugin_exchangedb_postgres.c | 4++--
Msrc/include/taler_exchangedb_plugin.h | 2+-
5 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/src/exchangedb/exchange-0001.sql b/src/exchangedb/exchange-0001.sql @@ -361,6 +361,11 @@ CREATE INDEX IF NOT EXISTS refresh_transfer_keys_coin_tpub COMMENT ON INDEX refresh_transfer_keys_coin_tpub IS 'for get_link (unsure if this helps or hurts for performance as there should be very few transfer public keys per rc, but at least in theory this helps the ORDER BY clause)'; +CREATE TABLE IF NOT EXISTS extension_details + (extension_details_serial_id BIGSERIAL PRIMARY KEY + ,extension_options VARCHAR); +COMMENT ON TABLE extension_details + IS 'Extensions that were provided with deposits (not yet used).'; CREATE TABLE IF NOT EXISTS deposits (deposit_serial_id BIGSERIAL PRIMARY KEY @@ -380,7 +385,7 @@ CREATE TABLE IF NOT EXISTS deposits ,tiny BOOLEAN NOT NULL DEFAULT FALSE ,done BOOLEAN NOT NULL DEFAULT FALSE ,extension_blocked BOOLEAN NOT NULL DEFAULT FALSE - ,extension_options VARCHAR + ,extension_details_serial_id INT8 REFERENCES extension_details (extension_details_serial_id) ,UNIQUE (known_coin_id, merchant_pub, h_contract_terms) ); COMMENT ON TABLE deposits diff --git a/src/exchangedb/irbt_callbacks.c b/src/exchangedb/irbt_callbacks.c @@ -517,7 +517,8 @@ irbt_cb_table_deposits (struct PostgresClosure *pg, GNUNET_PQ_query_param_auto_from_type (&tiny), GNUNET_PQ_query_param_auto_from_type (&done), GNUNET_PQ_query_param_auto_from_type (&extension_blocked), - TALER_PQ_query_param_json (td->details.deposits.extension_options), + GNUNET_PQ_query_param_uint64 ( + &td->details.deposits.extension_details_serial_id), GNUNET_PQ_query_param_end }; diff --git a/src/exchangedb/lrbt_callbacks.c b/src/exchangedb/lrbt_callbacks.c @@ -952,9 +952,9 @@ lrbt_cb_table_deposits (void *cls, GNUNET_PQ_result_spec_auto_from_type ( "extension_blocked", &td.details.deposits.extension_blocked), - TALER_PQ_result_spec_json ( - "extension_options", - &td.details.deposits.extension_options), + GNUNET_PQ_result_spec_uint64 ( + "extension_details_serial_id", + &td.details.deposits.extension_details_serial_id), GNUNET_PQ_result_spec_end }; diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c @@ -2299,7 +2299,7 @@ prepare_statements (struct PostgresClosure *pg) ",tiny" ",done" ",extension_blocked" - ",extension_options" + ",extension_details_serial_id" " FROM deposits" " WHERE deposit_serial_id > $1" " ORDER BY deposit_serial_id ASC;", @@ -2588,7 +2588,7 @@ prepare_statements (struct PostgresClosure *pg) ",tiny" ",done" ",extension_blocked" - ",extension_options" + ",extension_details_serial_id" ") VALUES " "($1, $2, $3, $4, $5, $6, $7, $8, $9, $10," " $11, $12, $13, $14, $15, $16, $17, $18);", diff --git a/src/include/taler_exchangedb_plugin.h b/src/include/taler_exchangedb_plugin.h @@ -328,7 +328,7 @@ struct TALER_EXCHANGEDB_TableData bool tiny; bool done; bool extension_blocked; - json_t *extension_options; + uint64_t extension_details_serial_id; } deposits; struct