aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-01-09 13:18:01 +0100
committerChristian Grothoff <christian@grothoff.org>2021-01-09 13:18:01 +0100
commit02ecf68a3d9edde9ef48650f64b7332af845beee (patch)
treee16c209870202698315970397417ab192cadc064
parent260e287685680d97448920432b4673469a99a83f (diff)
downloadexchange-02ecf68a3d9edde9ef48650f64b7332af845beee.tar.gz
exchange-02ecf68a3d9edde9ef48650f64b7332af845beee.zip
more optimizations of tables with foreign keys
-rw-r--r--src/exchangedb/exchange-0002.sql50
-rw-r--r--src/exchangedb/plugin_exchangedb_postgres.c85
-rw-r--r--src/include/taler_exchangedb_plugin.h154
3 files changed, 218 insertions, 71 deletions
diff --git a/src/exchangedb/exchange-0002.sql b/src/exchangedb/exchange-0002.sql
index 267247088..3d17395bc 100644
--- a/src/exchangedb/exchange-0002.sql
+++ b/src/exchangedb/exchange-0002.sql
@@ -231,6 +231,56 @@ COMMENT ON COLUMN recoup_refresh.rrc_serial
231 IS 'Identifies the h_blind_ev of the recouped coin (as h_coin_ev).'; 231 IS 'Identifies the h_blind_ev of the recouped coin (as h_coin_ev).';
232 232
233 233
234-- Change 'rc' in refresh_transfer_keys and refresh_revealed_coins tables to 'melt_serial_id'
235ALTER TABLE refresh_transfer_keys
236 ADD COLUMN melt_serial_id INT8 REFERENCES refresh_commitments (melt_serial_id) ON DELETE CASCADE;
237UPDATE refresh_transfer_keys
238 SET melt_serial_id=d.melt_serial_id
239 FROM refresh_transfer_keys o
240 INNER JOIN refresh_commitments d ON (d.rc = o.rc);
241ALTER TABLE refresh_transfer_keys
242 ALTER COLUMN melt_serial_id SET NOT NULL;
243ALTER TABLE refresh_transfer_keys
244 DROP COLUMN rc;
245COMMENT ON COLUMN refresh_transfer_keys.melt_serial_id
246 IS 'Identifies the refresh commitment (rc) of the operation.';
247
248ALTER TABLE refresh_revealed_coins
249 ADD COLUMN melt_serial_id INT8 REFERENCES refresh_commitments (melt_serial_id) ON DELETE CASCADE;
250UPDATE refresh_revealed_coins
251 SET melt_serial_id=d.melt_serial_id
252 FROM refresh_revealed_coins o
253 INNER JOIN refresh_commitments d ON (d.rc = o.rc);
254ALTER TABLE refresh_revealed_coins
255 ALTER COLUMN melt_serial_id SET NOT NULL;
256ALTER TABLE refresh_revealed_coins
257 DROP COLUMN rc;
258COMMENT ON COLUMN refresh_revealed_coins.melt_serial_id
259 IS 'Identifies the refresh commitment (rc) of the operation.';
260
261
262-- Change 'merchant_pub' and 'h_contract_terms' and 'known_coin_id' in 'refunds' table
263-- to 'deposit_serial_id' instead!
264ALTER TABLE refunds
265 ADD COLUMN deposit_serial_id INT8 REFERENCES deposits (deposit_serial_id) ON DELETE CASCADE;
266UPDATE refunds
267 SET deposit_serial_id=d.deposit_serial_id
268 FROM refunds o
269 INNER JOIN deposits d
270 ON ( (d.known_coin_id = o.known_coin_id) AND
271 (d.h_contract_terms = o.h_contract_terms) AND
272 (d.merchant_pub = o.merchant_pub) );
273ALTER TABLE refunds
274 ALTER COLUMN deposit_serial_id SET NOT NULL;
275ALTER TABLE refunds
276 DROP COLUMN merchant_pub,
277 DROP COLUMN h_contract_terms,
278 DROP COLUMN known_coin_id;
279COMMENT ON COLUMN refunds.deposit_serial_id
280 IS 'Identifies ONLY the merchant_pub, h_contract_terms and known_coin_id. Multiple deposits may match a refund, this only identifies one of them.';
281
282
283
234-- Create additional tables... 284-- Create additional tables...
235 285
236CREATE TABLE IF NOT EXISTS auditors 286CREATE TABLE IF NOT EXISTS auditors
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c
index 6d8e72732..d8dbd2241 100644
--- a/src/exchangedb/plugin_exchangedb_postgres.c
+++ b/src/exchangedb/plugin_exchangedb_postgres.c
@@ -781,16 +781,22 @@ postgres_get_session (void *cls)
781 /* Store information about the desired denominations for a 781 /* Store information about the desired denominations for a
782 refresh operation, used in #postgres_insert_refresh_reveal() */ 782 refresh operation, used in #postgres_insert_refresh_reveal() */
783 GNUNET_PQ_make_prepare ("insert_refresh_revealed_coin", 783 GNUNET_PQ_make_prepare ("insert_refresh_revealed_coin",
784 "WITH rcx AS"
785 " (SELECT melt_serial_id"
786 " FROM refresh_commitments"
787 " WHERE rc=$1)"
784 "INSERT INTO refresh_revealed_coins " 788 "INSERT INTO refresh_revealed_coins "
785 "(rc " 789 "(melt_serial_id "
786 ",freshcoin_index " 790 ",freshcoin_index "
787 ",link_sig " 791 ",link_sig "
788 ",denominations_serial " 792 ",denominations_serial "
789 ",coin_ev" 793 ",coin_ev"
790 ",h_coin_ev" 794 ",h_coin_ev"
791 ",ev_sig" 795 ",ev_sig"
792 ") SELECT $1, $2, $3, denominations_serial, $5, $6, $7 " 796 ") SELECT rcx.melt_serial_id, $2, $3, "
797 " denominations_serial, $5, $6, $7 "
793 " FROM denominations" 798 " FROM denominations"
799 " CROSS JOIN rcx"
794 " WHERE denom_pub_hash=$4;", 800 " WHERE denom_pub_hash=$4;",
795 7), 801 7),
796 /* Obtain information about the coins created in a refresh 802 /* Obtain information about the coins created in a refresh
@@ -805,6 +811,8 @@ postgres_get_session (void *cls)
805 " FROM refresh_revealed_coins" 811 " FROM refresh_revealed_coins"
806 " JOIN denominations denom " 812 " JOIN denominations denom "
807 " USING (denominations_serial)" 813 " USING (denominations_serial)"
814 " JOIN refresh_commitments"
815 " USING (melt_serial_id)"
808 " WHERE rc=$1" 816 " WHERE rc=$1"
809 " ORDER BY freshcoin_index ASC;", 817 " ORDER BY freshcoin_index ASC;",
810 1), 818 1),
@@ -813,11 +821,12 @@ postgres_get_session (void *cls)
813 keys we learned */ 821 keys we learned */
814 GNUNET_PQ_make_prepare ("insert_refresh_transfer_keys", 822 GNUNET_PQ_make_prepare ("insert_refresh_transfer_keys",
815 "INSERT INTO refresh_transfer_keys " 823 "INSERT INTO refresh_transfer_keys "
816 "(rc" 824 "(melt_serial_id"
817 ",transfer_pub" 825 ",transfer_pub"
818 ",transfer_privs" 826 ",transfer_privs"
819 ") VALUES " 827 ") SELECT melt_serial_id, $2, $3"
820 "($1, $2, $3);", 828 " FROM refresh_commitments"
829 " WHERE rc=$1",
821 3), 830 3),
822 /* Used in #postgres_get_refresh_reveal() to retrieve transfer 831 /* Used in #postgres_get_refresh_reveal() to retrieve transfer
823 keys from /refresh/reveal */ 832 keys from /refresh/reveal */
@@ -826,23 +835,24 @@ postgres_get_session (void *cls)
826 " transfer_pub" 835 " transfer_pub"
827 ",transfer_privs" 836 ",transfer_privs"
828 " FROM refresh_transfer_keys" 837 " FROM refresh_transfer_keys"
838 " JOIN refresh_commitments"
839 " USING (melt_serial_id)"
829 " WHERE rc=$1;", 840 " WHERE rc=$1;",
830 1), 841 1),
831
832
833 /* Used in #postgres_insert_refund() to store refund information */ 842 /* Used in #postgres_insert_refund() to store refund information */
834 GNUNET_PQ_make_prepare ("insert_refund", 843 GNUNET_PQ_make_prepare ("insert_refund",
835 "INSERT INTO refunds " 844 "INSERT INTO refunds "
836 "(known_coin_id " 845 "(deposit_serial_id "
837 ",merchant_pub "
838 ",merchant_sig " 846 ",merchant_sig "
839 ",h_contract_terms "
840 ",rtransaction_id " 847 ",rtransaction_id "
841 ",amount_with_fee_val " 848 ",amount_with_fee_val "
842 ",amount_with_fee_frac " 849 ",amount_with_fee_frac "
843 ") SELECT known_coin_id, $2, $3, $4, $5, $6, $7" 850 ") SELECT deposit_serial_id, $3, $5, $6, $7"
844 " FROM known_coins" 851 " FROM deposits"
845 " WHERE coin_pub=$1", 852 " JOIN known_coins USING (known_coin_id)"
853 " WHERE coin_pub=$1"
854 " AND h_contract_terms=$4"
855 " AND merchant_pub=$2",
846 7), 856 7),
847 /* Query the 'refunds' by coin public key */ 857 /* Query the 'refunds' by coin public key */
848 GNUNET_PQ_make_prepare ("get_refunds_by_coin", 858 GNUNET_PQ_make_prepare ("get_refunds_by_coin",
@@ -851,12 +861,13 @@ postgres_get_session (void *cls)
851 ",merchant_sig" 861 ",merchant_sig"
852 ",h_contract_terms" 862 ",h_contract_terms"
853 ",rtransaction_id" 863 ",rtransaction_id"
854 ",amount_with_fee_val" 864 ",refunds.amount_with_fee_val"
855 ",amount_with_fee_frac" 865 ",refunds.amount_with_fee_frac"
856 ",denom.fee_refund_val " 866 ",denom.fee_refund_val "
857 ",denom.fee_refund_frac " 867 ",denom.fee_refund_frac "
858 ",refund_serial_id" 868 ",refund_serial_id"
859 " FROM refunds" 869 " FROM refunds"
870 " JOIN deposits USING (deposit_serial_id)"
860 " JOIN known_coins USING (known_coin_id)" 871 " JOIN known_coins USING (known_coin_id)"
861 " JOIN denominations denom USING (denominations_serial)" 872 " JOIN denominations denom USING (denominations_serial)"
862 " WHERE coin_pub=$1;", 873 " WHERE coin_pub=$1;",
@@ -864,9 +875,10 @@ postgres_get_session (void *cls)
864 /* Query the 'refunds' by coin public key, merchant_pub and contract hash */ 875 /* Query the 'refunds' by coin public key, merchant_pub and contract hash */
865 GNUNET_PQ_make_prepare ("get_refunds_by_coin_and_contract", 876 GNUNET_PQ_make_prepare ("get_refunds_by_coin_and_contract",
866 "SELECT" 877 "SELECT"
867 " amount_with_fee_val" 878 " refunds.amount_with_fee_val"
868 ",amount_with_fee_frac" 879 ",refunds.amount_with_fee_frac"
869 " FROM refunds" 880 " FROM refunds"
881 " JOIN deposits USING (deposit_serial_id)"
870 " JOIN known_coins USING (known_coin_id)" 882 " JOIN known_coins USING (known_coin_id)"
871 " WHERE coin_pub=$1" 883 " WHERE coin_pub=$1"
872 " AND merchant_pub=$2" 884 " AND merchant_pub=$2"
@@ -881,10 +893,11 @@ postgres_get_session (void *cls)
881 ",rtransaction_id" 893 ",rtransaction_id"
882 ",denom.denom_pub" 894 ",denom.denom_pub"
883 ",kc.coin_pub" 895 ",kc.coin_pub"
884 ",amount_with_fee_val" 896 ",refunds.amount_with_fee_val"
885 ",amount_with_fee_frac" 897 ",refunds.amount_with_fee_frac"
886 ",refund_serial_id" 898 ",refund_serial_id"
887 " FROM refunds" 899 " FROM refunds"
900 " JOIN deposits USING (deposit_serial_id)"
888 " JOIN known_coins kc USING (known_coin_id)" 901 " JOIN known_coins kc USING (known_coin_id)"
889 " JOIN denominations denom ON (kc.denominations_serial = denom.denominations_serial)" 902 " JOIN denominations denom ON (kc.denominations_serial = denom.denominations_serial)"
890 " WHERE refund_serial_id>=$1" 903 " WHERE refund_serial_id>=$1"
@@ -1086,9 +1099,9 @@ postgres_get_session (void *cls)
1086 ",rrc.link_sig" 1099 ",rrc.link_sig"
1087 " FROM refresh_commitments" 1100 " FROM refresh_commitments"
1088 " JOIN refresh_revealed_coins rrc" 1101 " JOIN refresh_revealed_coins rrc"
1089 " USING (rc)" 1102 " USING (melt_serial_id)"
1090 " JOIN refresh_transfer_keys tp" 1103 " JOIN refresh_transfer_keys tp"
1091 " USING (rc)" 1104 " USING (melt_serial_id)"
1092 " JOIN denominations denoms" 1105 " JOIN denominations denoms"
1093 " ON (rrc.denominations_serial = denoms.denominations_serial)" 1106 " ON (rrc.denominations_serial = denoms.denominations_serial)"
1094 " WHERE old_known_coin_id=" 1107 " WHERE old_known_coin_id="
@@ -1239,16 +1252,17 @@ postgres_get_session (void *cls)
1239 ",wire_deadline" 1252 ",wire_deadline"
1240 ",tiny" 1253 ",tiny"
1241 ",done" 1254 ",done"
1242 " FROM deposits" 1255 " FROM deposits d"
1243 " JOIN known_coins USING (known_coin_id)" 1256 " JOIN known_coins USING (known_coin_id)"
1244 " WHERE wire_deadline >= $1" 1257 " WHERE wire_deadline >= $1"
1245 " AND wire_deadline < $2" 1258 " AND wire_deadline < $2"
1246 " AND NOT (EXISTS (SELECT 1" 1259 " AND NOT (EXISTS (SELECT 1"
1247 " FROM refunds" 1260 " FROM refunds"
1248 " WHERE (refunds.known_coin_id = deposits.known_coin_id))" 1261 " JOIN deposits dx USING (deposit_serial_id)"
1262 " WHERE (dx.known_coin_id = d.known_coin_id))"
1249 " OR EXISTS (SELECT 1" 1263 " OR EXISTS (SELECT 1"
1250 " FROM aggregation_tracking" 1264 " FROM aggregation_tracking"
1251 " WHERE (aggregation_tracking.deposit_serial_id = deposits.deposit_serial_id)))" 1265 " WHERE (aggregation_tracking.deposit_serial_id = d.deposit_serial_id)))"
1252 " ORDER BY wire_deadline ASC", 1266 " ORDER BY wire_deadline ASC",
1253 2), 1267 2),
1254 /* Used in #postgres_select_wire_out_above_serial_id() */ 1268 /* Used in #postgres_select_wire_out_above_serial_id() */
@@ -1364,10 +1378,10 @@ postgres_get_session (void *cls)
1364 " FROM recoup_refresh" 1378 " FROM recoup_refresh"
1365 " INNER JOIN refresh_revealed_coins rrc" 1379 " INNER JOIN refresh_revealed_coins rrc"
1366 " USING (rrc_serial)" 1380 " USING (rrc_serial)"
1367 " INNER JOIN refresh_commitments rc" 1381 " INNER JOIN refresh_commitments rfc"
1368 " ON (rrc.rc = rc.rc)" 1382 " ON (rrc.melt_serial_id = rfc.melt_serial_id)"
1369 " INNER JOIN known_coins old_coins" 1383 " INNER JOIN known_coins old_coins"
1370 " ON (rc.old_known_coin_id = old_coins.known_coin_id)" 1384 " ON (rfc.old_known_coin_id = old_coins.known_coin_id)"
1371 " INNER JOIN known_coins new_coins" 1385 " INNER JOIN known_coins new_coins"
1372 " ON (new_coins.known_coin_id = recoup_refresh.known_coin_id)" 1386 " ON (new_coins.known_coin_id = recoup_refresh.known_coin_id)"
1373 " INNER JOIN denominations new_denoms" 1387 " INNER JOIN denominations new_denoms"
@@ -1442,7 +1456,7 @@ postgres_get_session (void *cls)
1442 " (SELECT rrc.rrc_serial" 1456 " (SELECT rrc.rrc_serial"
1443 " FROM refresh_commitments" 1457 " FROM refresh_commitments"
1444 " JOIN refresh_revealed_coins rrc" 1458 " JOIN refresh_revealed_coins rrc"
1445 " USING (rc)" 1459 " USING (melt_serial_id)"
1446 " WHERE old_known_coin_id=" 1460 " WHERE old_known_coin_id="
1447 " (SELECT known_coin_id" 1461 " (SELECT known_coin_id"
1448 " FROM known_coins" 1462 " FROM known_coins"
@@ -1518,10 +1532,10 @@ postgres_get_session (void *cls)
1518 " FROM recoup_refresh" 1532 " FROM recoup_refresh"
1519 " JOIN refresh_revealed_coins rrc" 1533 " JOIN refresh_revealed_coins rrc"
1520 " USING (rrc_serial)" 1534 " USING (rrc_serial)"
1521 " JOIN refresh_commitments rc" 1535 " JOIN refresh_commitments rfc"
1522 " ON (rrc.rc = rc.rc)" 1536 " ON (rrc.melt_serial_id = rfc.melt_serial_id)"
1523 " JOIN known_coins old_coins" 1537 " JOIN known_coins old_coins"
1524 " ON (rc.old_known_coin_id = old_coins.known_coin_id)" 1538 " ON (rfc.old_known_coin_id = old_coins.known_coin_id)"
1525 " JOIN known_coins coins" 1539 " JOIN known_coins coins"
1526 " ON (recoup_refresh.known_coin_id = coins.known_coin_id)" 1540 " ON (recoup_refresh.known_coin_id = coins.known_coin_id)"
1527 " JOIN denominations denoms" 1541 " JOIN denominations denoms"
@@ -1543,7 +1557,7 @@ postgres_get_session (void *cls)
1543 "SELECT" 1557 "SELECT"
1544 " okc.coin_pub AS old_coin_pub" 1558 " okc.coin_pub AS old_coin_pub"
1545 " FROM refresh_revealed_coins rrc" 1559 " FROM refresh_revealed_coins rrc"
1546 " JOIN refresh_commitments rcom USING (rc)" 1560 " JOIN refresh_commitments rcom USING (melt_serial_id)"
1547 " JOIN known_coins okc ON (rcom.old_known_coin_id = okc.known_coin_id)" 1561 " JOIN known_coins okc ON (rcom.old_known_coin_id = okc.known_coin_id)"
1548 " WHERE h_coin_ev=$1" 1562 " WHERE h_coin_ev=$1"
1549 " LIMIT 1;", 1563 " LIMIT 1;",
@@ -2041,6 +2055,7 @@ postgres_get_session (void *cls)
2041 ",rrc_serial" 2055 ",rrc_serial"
2042 ",denominations_serial" 2056 ",denominations_serial"
2043 " FROM refresh_revealed_coins" 2057 " FROM refresh_revealed_coins"
2058 " JOIN refresh_commitments USING (melt_serial_id)"
2044 " ORDER BY rrc_serial ASC;", 2059 " ORDER BY rrc_serial ASC;",
2045 0), 2060 0),
2046 GNUNET_PQ_make_prepare ( 2061 GNUNET_PQ_make_prepare (
@@ -2051,6 +2066,7 @@ postgres_get_session (void *cls)
2051 ",transfer_pub" 2066 ",transfer_pub"
2052 ",transfer_privs" 2067 ",transfer_privs"
2053 " FROM refresh_transfer_keys" 2068 " FROM refresh_transfer_keys"
2069 " JOIN refresh_commitments USING (melt_serial_id)"
2054 " ORDER BY rtc_serial ASC;", 2070 " ORDER BY rtc_serial ASC;",
2055 0), 2071 0),
2056 GNUNET_PQ_make_prepare ("select_above_serial_by_table_deposits", 2072 GNUNET_PQ_make_prepare ("select_above_serial_by_table_deposits",
@@ -2080,10 +2096,11 @@ postgres_get_session (void *cls)
2080 ",merchant_sig" 2096 ",merchant_sig"
2081 ",h_contract_terms" 2097 ",h_contract_terms"
2082 ",rtransaction_id" 2098 ",rtransaction_id"
2083 ",amount_with_fee_val" 2099 ",refunds.amount_with_fee_val"
2084 ",amount_with_fee_frac" 2100 ",refunds.amount_with_fee_frac"
2085 ",known_coin_id" 2101 ",known_coin_id"
2086 " FROM refunds" 2102 " FROM refunds"
2103 " JOIN deposits USING (deposit_serial_id)"
2087 " ORDER BY refund_serial_id ASC;", 2104 " ORDER BY refund_serial_id ASC;",
2088 0), 2105 0),
2089 GNUNET_PQ_make_prepare ("select_above_serial_by_table_wire_out", 2106 GNUNET_PQ_make_prepare ("select_above_serial_by_table_wire_out",
diff --git a/src/include/taler_exchangedb_plugin.h b/src/include/taler_exchangedb_plugin.h
index e26a20960..83d283401 100644
--- a/src/include/taler_exchangedb_plugin.h
+++ b/src/include/taler_exchangedb_plugin.h
@@ -75,6 +75,32 @@ struct TALER_EXCHANGEDB_DenominationKeyInformationP
75 75
76GNUNET_NETWORK_STRUCT_END 76GNUNET_NETWORK_STRUCT_END
77 77
78/**
79 * Meta data about an exchange online signing key.
80 */
81struct TALER_EXCHANGEDB_SignkeyMetaData
82{
83 /**
84 * Start time of the validity period for this key.
85 */
86 struct GNUNET_TIME_Absolute start;
87
88 /**
89 * The exchange will sign messages with this key between @e start and this time.
90 */
91 struct GNUNET_TIME_Absolute expire_sign;
92
93 /**
94 * When do signatures with this sign key become invalid?
95 * After this point, these signatures cannot be used in (legal)
96 * disputes anymore, as the Exchange is then allowed to destroy its side
97 * of the evidence. @e expire_legal is expected to be significantly
98 * larger than @e expire_sign (by a year or more).
99 */
100 struct GNUNET_TIME_Absolute expire_legal;
101
102};
103
78 104
79/** 105/**
80 * Enumeration of all of the tables replicated by exchange-auditor 106 * Enumeration of all of the tables replicated by exchange-auditor
@@ -194,16 +220,97 @@ struct TALER_EXCHANGEDB_TableData
194 uint64_t denominations_serial; 220 uint64_t denominations_serial;
195 } reserves_out; 221 } reserves_out;
196 222
197 struct {} auditors; 223 struct
198 struct {} auditor_denom_sigs; 224 {
199 struct {} exchange_sign_keys; 225 struct TALER_AuditorPublicKeyP auditor_pub;
200 struct {} signkey_revocations; 226 char *auditor_url;
201 struct {} known_coins; 227 char *auditor_name;
202 struct {} refresh_commitments; 228 bool is_active;
203 struct {} refresh_revealed_coins; 229 struct GNUNET_TIME_Absolute last_change;
204 struct {} refresh_transfer_keys; 230 } auditors;
205 struct {} deposits; 231
206 struct {} refunds; 232 struct
233 {
234 uint64_t auditor_uuid;
235 uint64_t denominations_serial;
236 struct TALER_AuditorSignatureP auditor_sig;
237 } auditor_denom_sigs;
238
239 struct
240 {
241 struct TALER_ExchangePublicKeyP exchange_pub;
242 struct TALER_MasterSignatureP master_sig;
243 struct TALER_EXCHANGEDB_SignkeyMetaData meta;
244 } exchange_sign_keys;
245
246 struct
247 {
248 uint64_t esk_serial;
249 struct TALER_MasterSignatureP master_sig;
250 } signkey_revocations;
251
252 struct
253 {
254 struct TALER_CoinSpendPublicKeyP coin_pub;
255 struct TALER_DenominationSignature denom_sig;
256 uint64_t denominations_serial;
257 } known_coins;
258
259 struct
260 {
261 struct TALER_RefreshCommitmentP rc;
262 struct TALER_CoinSpendSignatureP old_coin_sig;
263 struct TALER_Amount amount_with_fee;
264 uint32_t noreveal_index;
265 uint64_t old_known_coin_id;
266 } refresh_commitments;
267
268 struct
269 {
270 uint64_t freshcoin_index;
271 struct TALER_CoinSpendSignatureP link_sig;
272 void *coin_ev;
273 size_t coin_ev_size;
274 // h_coin_ev omitted, to be recomputed!
275 struct TALER_DenominationSignature ev_sig;
276 uint64_t denominations_serial;
277 uint64_t melt_serial_id;
278 } refresh_revealed_coins;
279
280 struct
281 {
282 struct TALER_TransferPublicKeyP tp;
283 struct TALER_TransferPrivateKeyP tprivs[TALER_CNC_KAPPA - 1];
284 uint64_t melt_serial_id;
285 } refresh_transfer_keys;
286
287 struct
288 {
289 struct TALER_Amount amount_with_fee;
290 struct GNUNET_TIME_Absolute wallet_timestamp;
291 struct GNUNET_TIME_Absolute exchange_timestamp;
292 struct GNUNET_TIME_Absolute refund_deadline;
293 struct GNUNET_TIME_Absolute wire_deadline;
294 struct TALER_MerchantPublicKeyP merchant_pub;
295 struct GNUNET_HashCode h_contract_terms;
296 // h_wire omitted, to be recomputed!
297 struct TALER_CoinSpendSignatureP coin_sig;
298 json_t *wire;
299 bool tiny;
300 bool done;
301 uint64_t known_coin_id;
302 } deposits;
303
304 struct
305 {
306 struct TALER_MerchantPublicKeyP merchant_pub; // FIXME
307 struct TALER_MerchantSignatureP merchant_sig;
308 struct GNUNET_HashCode h_contract_terms; // FIXME
309 uint64_t rtransaction_id;
310 struct TALER_Amount amount_with_fee;
311 uint64_t known_coin_id;
312 } refunds;
313
207 struct {} wire_out; 314 struct {} wire_out;
208 struct {} aggregation_tracking; 315 struct {} aggregation_tracking;
209 struct {} wire_fee; 316 struct {} wire_fee;
@@ -464,33 +571,6 @@ typedef void
464 571
465 572
466/** 573/**
467 * Meta data about an exchange online signing key.
468 */
469struct TALER_EXCHANGEDB_SignkeyMetaData
470{
471 /**
472 * Start time of the validity period for this key.
473 */
474 struct GNUNET_TIME_Absolute start;
475
476 /**
477 * The exchange will sign messages with this key between @e start and this time.
478 */
479 struct GNUNET_TIME_Absolute expire_sign;
480
481 /**
482 * When do signatures with this sign key become invalid?
483 * After this point, these signatures cannot be used in (legal)
484 * disputes anymore, as the Exchange is then allowed to destroy its side
485 * of the evidence. @e expire_legal is expected to be significantly
486 * larger than @e expire_sign (by a year or more).
487 */
488 struct GNUNET_TIME_Absolute expire_legal;
489
490};
491
492
493/**
494 * Signature of a function called with information about the exchange's 574 * Signature of a function called with information about the exchange's
495 * online signing keys. 575 * online signing keys.
496 * 576 *