use known_coin_id instead of coin_pub, use reserve_out_serial_id/rrc_serial instead of h_blind_ev/h_coin_ev
This commit is contained in:
parent
7ef7d793de
commit
db61628a9c
@ -1 +1 @@
|
|||||||
1610127044
|
1610135044
|
||||||
|
@ -1 +1 @@
|
|||||||
TE5QQD3W4Q6PFR7W5FP6H7BXHDK48HXZKV8FFNYS7BTYDYYTMMZ0
|
RDQ6W0091VDRV0JA01V5S4YMQ5A9ZZ4D4NT5WBZ8CPCP5AZG4NDG
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1 +1 @@
|
|||||||
1610129440
|
1610135265
|
||||||
|
@ -1 +1 @@
|
|||||||
E9JSVQNYW14YRKKJ4RWB71SDFM1BE3RC2WR45JMT713QC34V8XVG
|
88CR9RK5Q253C5PG3EANGBW74S0N2FB7GYN3S960NC08JW46F7YG
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -862,10 +862,10 @@ function test_13() {
|
|||||||
|
|
||||||
echo "===========13: wrong melt signature ==========="
|
echo "===========13: wrong melt signature ==========="
|
||||||
# Modify denom_sig, so it is wrong
|
# Modify denom_sig, so it is wrong
|
||||||
COIN_PUB=`echo "SELECT old_coin_pub FROM refresh_commitments LIMIT 1;" | psql $DB -Aqt`
|
COIN_ID=`echo "SELECT old_known_coin_id FROM refresh_commitments LIMIT 1;" | psql $DB -Aqt`
|
||||||
OLD_SIG=`echo "SELECT old_coin_sig FROM refresh_commitments WHERE old_coin_pub='$COIN_PUB';" | psql $DB -Aqt`
|
OLD_SIG=`echo "SELECT old_coin_sig FROM refresh_commitments WHERE old_known_coin_id='$COIN_ID';" | psql $DB -Aqt`
|
||||||
NEW_SIG="\xba588af7c13c477dca1ac458f65cc484db8fba53b969b873f4353ecbd815e6b4c03f42c0cb63a2b609c2d726e612fd8e0c084906a41f409b6a23a08a83c89a02"
|
NEW_SIG="\xba588af7c13c477dca1ac458f65cc484db8fba53b969b873f4353ecbd815e6b4c03f42c0cb63a2b609c2d726e612fd8e0c084906a41f409b6a23a08a83c89a02"
|
||||||
echo "UPDATE refresh_commitments SET old_coin_sig='$NEW_SIG' WHERE old_coin_pub='$COIN_PUB'" | psql -Aqt $DB
|
echo "UPDATE refresh_commitments SET old_coin_sig='$NEW_SIG' WHERE old_known_coin_id='$COIN_ID'" | psql -Aqt $DB
|
||||||
|
|
||||||
run_audit
|
run_audit
|
||||||
|
|
||||||
|
@ -20,6 +20,8 @@ BEGIN;
|
|||||||
-- Check patch versioning is in place.
|
-- Check patch versioning is in place.
|
||||||
SELECT _v.register_patch('exchange-0002', NULL, NULL);
|
SELECT _v.register_patch('exchange-0002', NULL, NULL);
|
||||||
|
|
||||||
|
-- Need 'failed' bit to prevent hanging transfer tool in case
|
||||||
|
-- bank API fails.
|
||||||
ALTER TABLE prewire
|
ALTER TABLE prewire
|
||||||
ADD failed BOOLEAN NOT NULL DEFAULT false;
|
ADD failed BOOLEAN NOT NULL DEFAULT false;
|
||||||
|
|
||||||
@ -143,6 +145,93 @@ ALTER TABLE refresh_revealed_coins
|
|||||||
ALTER TABLE refresh_revealed_coins
|
ALTER TABLE refresh_revealed_coins
|
||||||
DROP COLUMN denom_pub_hash;
|
DROP COLUMN denom_pub_hash;
|
||||||
|
|
||||||
|
-- Change all foreign keys involving 'coin_pub' to use known_coin_id instead.
|
||||||
|
ALTER TABLE recoup_refresh
|
||||||
|
ADD COLUMN known_coin_id INT8 REFERENCES known_coins (known_coin_id) ON DELETE CASCADE;
|
||||||
|
UPDATE recoup_refresh
|
||||||
|
SET known_coin_id=d.known_coin_id
|
||||||
|
FROM recoup_refresh o
|
||||||
|
INNER JOIN known_coins d USING(coin_pub);
|
||||||
|
ALTER TABLE recoup_refresh
|
||||||
|
ALTER COLUMN known_coin_id SET NOT NULL;
|
||||||
|
ALTER TABLE recoup_refresh
|
||||||
|
DROP COLUMN coin_pub;
|
||||||
|
|
||||||
|
ALTER TABLE recoup
|
||||||
|
ADD COLUMN known_coin_id INT8 REFERENCES known_coins (known_coin_id) ON DELETE CASCADE;
|
||||||
|
UPDATE recoup
|
||||||
|
SET known_coin_id=d.known_coin_id
|
||||||
|
FROM recoup o
|
||||||
|
INNER JOIN known_coins d USING(coin_pub);
|
||||||
|
ALTER TABLE recoup
|
||||||
|
ALTER COLUMN known_coin_id SET NOT NULL;
|
||||||
|
ALTER TABLE recoup
|
||||||
|
DROP COLUMN coin_pub;
|
||||||
|
|
||||||
|
ALTER TABLE refresh_commitments
|
||||||
|
ADD COLUMN old_known_coin_id INT8 REFERENCES known_coins (known_coin_id) ON DELETE CASCADE;
|
||||||
|
UPDATE refresh_commitments
|
||||||
|
SET old_known_coin_id=d.known_coin_id
|
||||||
|
FROM refresh_commitments o
|
||||||
|
INNER JOIN known_coins d ON(o.old_coin_pub=d.coin_pub);
|
||||||
|
ALTER TABLE refresh_commitments
|
||||||
|
ALTER COLUMN old_known_coin_id SET NOT NULL;
|
||||||
|
ALTER TABLE refresh_commitments
|
||||||
|
DROP COLUMN old_coin_pub;
|
||||||
|
|
||||||
|
ALTER TABLE deposits
|
||||||
|
ADD COLUMN known_coin_id INT8 REFERENCES known_coins (known_coin_id) ON DELETE CASCADE;
|
||||||
|
UPDATE deposits
|
||||||
|
SET known_coin_id=d.known_coin_id
|
||||||
|
FROM deposits o
|
||||||
|
INNER JOIN known_coins d USING(coin_pub);
|
||||||
|
ALTER TABLE deposits
|
||||||
|
ALTER COLUMN known_coin_id SET NOT NULL;
|
||||||
|
ALTER TABLE deposits
|
||||||
|
DROP COLUMN coin_pub;
|
||||||
|
|
||||||
|
ALTER TABLE refunds
|
||||||
|
ADD COLUMN known_coin_id INT8 REFERENCES known_coins (known_coin_id) ON DELETE CASCADE;
|
||||||
|
UPDATE refunds
|
||||||
|
SET known_coin_id=d.known_coin_id
|
||||||
|
FROM refunds o
|
||||||
|
INNER JOIN known_coins d USING(coin_pub);
|
||||||
|
ALTER TABLE refunds
|
||||||
|
ALTER COLUMN known_coin_id SET NOT NULL;
|
||||||
|
ALTER TABLE refunds
|
||||||
|
DROP COLUMN coin_pub;
|
||||||
|
|
||||||
|
-- Change 'h_blind_ev' in recoup table to 'reserve_out_serial_id'
|
||||||
|
ALTER TABLE recoup
|
||||||
|
ADD COLUMN reserve_out_serial_id INT8 REFERENCES reserves_out (reserve_out_serial_id) ON DELETE CASCADE;
|
||||||
|
UPDATE recoup
|
||||||
|
SET reserve_out_serial_id=d.reserve_out_serial_id
|
||||||
|
FROM recoup o
|
||||||
|
INNER JOIN reserves_out d USING(h_blind_ev);
|
||||||
|
ALTER TABLE recoup
|
||||||
|
ALTER COLUMN reserve_out_serial_id SET NOT NULL;
|
||||||
|
ALTER TABLE recoup
|
||||||
|
DROP COLUMN h_blind_ev;
|
||||||
|
COMMENT ON COLUMN recoup.reserve_out_serial_id
|
||||||
|
IS 'Identifies the h_blind_ev of the recouped coin.';
|
||||||
|
|
||||||
|
|
||||||
|
-- Change 'h_blind_ev' in recoup_refresh table to 'rrc_serial'
|
||||||
|
ALTER TABLE recoup_refresh
|
||||||
|
ADD COLUMN rrc_serial INT8 REFERENCES refresh_revealed_coins (rrc_serial) ON DELETE CASCADE;
|
||||||
|
UPDATE recoup_refresh
|
||||||
|
SET rrc_serial=d.rrc_serial
|
||||||
|
FROM recoup_refresh o
|
||||||
|
INNER JOIN refresh_revealed_coins d ON (d.h_coin_ev = o.h_blind_ev);
|
||||||
|
ALTER TABLE recoup_refresh
|
||||||
|
ALTER COLUMN rrc_serial SET NOT NULL;
|
||||||
|
ALTER TABLE recoup_refresh
|
||||||
|
DROP COLUMN h_blind_ev;
|
||||||
|
COMMENT ON COLUMN recoup_refresh.rrc_serial
|
||||||
|
IS 'Identifies the h_blind_ev of the recouped coin (as h_coin_ev).';
|
||||||
|
|
||||||
|
|
||||||
|
-- Create additional tables...
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS auditors
|
CREATE TABLE IF NOT EXISTS auditors
|
||||||
(auditor_uuid BIGSERIAL UNIQUE
|
(auditor_uuid BIGSERIAL UNIQUE
|
||||||
@ -225,7 +314,7 @@ COMMENT ON COLUMN wire_accounts.last_change
|
|||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS signkey_revocations
|
CREATE TABLE IF NOT EXISTS signkey_revocations
|
||||||
(signkey_revocations_serial_id BIGSERIAL UNIQUE
|
(signkey_revocations_serial_id BIGSERIAL UNIQUE
|
||||||
,exchange_pub BYTEA PRIMARY KEY REFERENCES exchange_sign_keys (exchange_pub) ON DELETE CASCADE
|
,esk_serial INT8 PRIMARY KEY REFERENCES exchange_sign_keys (esk_serial) ON DELETE CASCADE
|
||||||
,master_sig BYTEA NOT NULL CHECK (LENGTH(master_sig)=64)
|
,master_sig BYTEA NOT NULL CHECK (LENGTH(master_sig)=64)
|
||||||
);
|
);
|
||||||
COMMENT ON TABLE signkey_revocations
|
COMMENT ON TABLE signkey_revocations
|
||||||
|
@ -350,9 +350,9 @@ postgres_get_session (void *cls)
|
|||||||
" WHERE"
|
" WHERE"
|
||||||
" expire_sign > $1"
|
" expire_sign > $1"
|
||||||
" AND NOT EXISTS "
|
" AND NOT EXISTS "
|
||||||
" (SELECT exchange_pub "
|
" (SELECT esk_serial "
|
||||||
" FROM signkey_revocations skr"
|
" FROM signkey_revocations skr"
|
||||||
" WHERE esk.exchange_pub = skr.exchange_pub);",
|
" WHERE esk.esk_serial = skr.esk_serial);",
|
||||||
1),
|
1),
|
||||||
/* Used in #postgres_iterate_auditor_denominations() */
|
/* Used in #postgres_iterate_auditor_denominations() */
|
||||||
GNUNET_PQ_make_prepare ("select_auditor_denoms",
|
GNUNET_PQ_make_prepare ("select_auditor_denoms",
|
||||||
@ -701,13 +701,14 @@ postgres_get_session (void *cls)
|
|||||||
GNUNET_PQ_make_prepare ("insert_melt",
|
GNUNET_PQ_make_prepare ("insert_melt",
|
||||||
"INSERT INTO refresh_commitments "
|
"INSERT INTO refresh_commitments "
|
||||||
"(rc "
|
"(rc "
|
||||||
",old_coin_pub "
|
",old_known_coin_id "
|
||||||
",old_coin_sig "
|
",old_coin_sig "
|
||||||
",amount_with_fee_val "
|
",amount_with_fee_val "
|
||||||
",amount_with_fee_frac "
|
",amount_with_fee_frac "
|
||||||
",noreveal_index "
|
",noreveal_index "
|
||||||
") VALUES "
|
") SELECT $1, known_coin_id, $3, $4, $5, $6"
|
||||||
"($1, $2, $3, $4, $5, $6);",
|
" FROM known_coins"
|
||||||
|
" WHERE coin_pub=$2",
|
||||||
6),
|
6),
|
||||||
/* Used in #postgres_get_melt() to fetch
|
/* Used in #postgres_get_melt() to fetch
|
||||||
high-level information about a melt operation */
|
high-level information about a melt operation */
|
||||||
@ -716,14 +717,14 @@ postgres_get_session (void *cls)
|
|||||||
" denoms.denom_pub_hash"
|
" denoms.denom_pub_hash"
|
||||||
",denoms.fee_refresh_val"
|
",denoms.fee_refresh_val"
|
||||||
",denoms.fee_refresh_frac"
|
",denoms.fee_refresh_frac"
|
||||||
",old_coin_pub"
|
",kc.coin_pub AS old_coin_pub"
|
||||||
",old_coin_sig"
|
",old_coin_sig"
|
||||||
",amount_with_fee_val"
|
",amount_with_fee_val"
|
||||||
",amount_with_fee_frac"
|
",amount_with_fee_frac"
|
||||||
",noreveal_index"
|
",noreveal_index"
|
||||||
" FROM refresh_commitments"
|
" FROM refresh_commitments"
|
||||||
" JOIN known_coins kc"
|
" JOIN known_coins kc"
|
||||||
" ON (refresh_commitments.old_coin_pub = kc.coin_pub)"
|
" ON (refresh_commitments.old_known_coin_id = kc.known_coin_id)"
|
||||||
" JOIN denominations denoms"
|
" JOIN denominations denoms"
|
||||||
" ON (kc.denominations_serial = denoms.denominations_serial)"
|
" ON (kc.denominations_serial = denoms.denominations_serial)"
|
||||||
" WHERE rc=$1;",
|
" WHERE rc=$1;",
|
||||||
@ -741,7 +742,7 @@ postgres_get_session (void *cls)
|
|||||||
GNUNET_PQ_make_prepare ("audit_get_refresh_commitments_incr",
|
GNUNET_PQ_make_prepare ("audit_get_refresh_commitments_incr",
|
||||||
"SELECT"
|
"SELECT"
|
||||||
" denom.denom_pub"
|
" denom.denom_pub"
|
||||||
",old_coin_pub"
|
",kc.coin_pub AS old_coin_pub"
|
||||||
",old_coin_sig"
|
",old_coin_sig"
|
||||||
",amount_with_fee_val"
|
",amount_with_fee_val"
|
||||||
",amount_with_fee_frac"
|
",amount_with_fee_frac"
|
||||||
@ -750,7 +751,7 @@ postgres_get_session (void *cls)
|
|||||||
",rc"
|
",rc"
|
||||||
" FROM refresh_commitments"
|
" FROM refresh_commitments"
|
||||||
" JOIN known_coins kc"
|
" JOIN known_coins kc"
|
||||||
" ON (refresh_commitments.old_coin_pub = kc.coin_pub)"
|
" ON (refresh_commitments.old_known_coin_id = kc.known_coin_id)"
|
||||||
" JOIN denominations denom"
|
" JOIN denominations denom"
|
||||||
" ON (kc.denominations_serial = denom.denominations_serial)"
|
" ON (kc.denominations_serial = denom.denominations_serial)"
|
||||||
" WHERE melt_serial_id>=$1"
|
" WHERE melt_serial_id>=$1"
|
||||||
@ -764,17 +765,19 @@ postgres_get_session (void *cls)
|
|||||||
",amount_with_fee_val"
|
",amount_with_fee_val"
|
||||||
",amount_with_fee_frac"
|
",amount_with_fee_frac"
|
||||||
",denoms.denom_pub_hash"
|
",denoms.denom_pub_hash"
|
||||||
",denoms.fee_refresh_val "
|
",denoms.fee_refresh_val"
|
||||||
",denoms.fee_refresh_frac "
|
",denoms.fee_refresh_frac"
|
||||||
",melt_serial_id"
|
",melt_serial_id"
|
||||||
" FROM refresh_commitments"
|
" FROM refresh_commitments"
|
||||||
" JOIN known_coins kc"
|
" JOIN known_coins kc"
|
||||||
" ON (refresh_commitments.old_coin_pub = kc.coin_pub)"
|
" ON (refresh_commitments.old_known_coin_id = kc.known_coin_id)"
|
||||||
" JOIN denominations denoms"
|
" JOIN denominations denoms"
|
||||||
" USING (denominations_serial)"
|
" USING (denominations_serial)"
|
||||||
" WHERE old_coin_pub=$1;",
|
" WHERE old_known_coin_id="
|
||||||
|
"(SELECT known_coin_id"
|
||||||
|
" FROM known_coins"
|
||||||
|
" WHERE coin_pub=$1);",
|
||||||
1),
|
1),
|
||||||
|
|
||||||
/* Store information about the desired denominations for a
|
/* Store information about the desired denominations for a
|
||||||
refresh operation, used in #postgres_insert_refresh_reveal() */
|
refresh operation, used in #postgres_insert_refresh_reveal() */
|
||||||
GNUNET_PQ_make_prepare ("insert_refresh_revealed_coin",
|
GNUNET_PQ_make_prepare ("insert_refresh_revealed_coin",
|
||||||
@ -830,15 +833,16 @@ postgres_get_session (void *cls)
|
|||||||
/* Used in #postgres_insert_refund() to store refund information */
|
/* Used in #postgres_insert_refund() to store refund information */
|
||||||
GNUNET_PQ_make_prepare ("insert_refund",
|
GNUNET_PQ_make_prepare ("insert_refund",
|
||||||
"INSERT INTO refunds "
|
"INSERT INTO refunds "
|
||||||
"(coin_pub "
|
"(known_coin_id "
|
||||||
",merchant_pub "
|
",merchant_pub "
|
||||||
",merchant_sig "
|
",merchant_sig "
|
||||||
",h_contract_terms "
|
",h_contract_terms "
|
||||||
",rtransaction_id "
|
",rtransaction_id "
|
||||||
",amount_with_fee_val "
|
",amount_with_fee_val "
|
||||||
",amount_with_fee_frac "
|
",amount_with_fee_frac "
|
||||||
") VALUES "
|
") SELECT known_coin_id, $2, $3, $4, $5, $6, $7"
|
||||||
"($1, $2, $3, $4, $5, $6, $7);",
|
" FROM known_coins"
|
||||||
|
" WHERE coin_pub=$1",
|
||||||
7),
|
7),
|
||||||
/* Query the 'refunds' by coin public key */
|
/* Query the 'refunds' by coin public key */
|
||||||
GNUNET_PQ_make_prepare ("get_refunds_by_coin",
|
GNUNET_PQ_make_prepare ("get_refunds_by_coin",
|
||||||
@ -853,7 +857,7 @@ postgres_get_session (void *cls)
|
|||||||
",denom.fee_refund_frac "
|
",denom.fee_refund_frac "
|
||||||
",refund_serial_id"
|
",refund_serial_id"
|
||||||
" FROM refunds"
|
" FROM refunds"
|
||||||
" JOIN known_coins USING (coin_pub)"
|
" JOIN known_coins USING (known_coin_id)"
|
||||||
" JOIN denominations denom USING (denominations_serial)"
|
" JOIN denominations denom USING (denominations_serial)"
|
||||||
" WHERE coin_pub=$1;",
|
" WHERE coin_pub=$1;",
|
||||||
1),
|
1),
|
||||||
@ -863,8 +867,8 @@ postgres_get_session (void *cls)
|
|||||||
" amount_with_fee_val"
|
" amount_with_fee_val"
|
||||||
",amount_with_fee_frac"
|
",amount_with_fee_frac"
|
||||||
" FROM refunds"
|
" FROM refunds"
|
||||||
" WHERE"
|
" JOIN known_coins USING (known_coin_id)"
|
||||||
" coin_pub=$1"
|
" WHERE coin_pub=$1"
|
||||||
" AND merchant_pub=$2"
|
" AND merchant_pub=$2"
|
||||||
" AND h_contract_terms=$3;",
|
" AND h_contract_terms=$3;",
|
||||||
3),
|
3),
|
||||||
@ -876,12 +880,12 @@ postgres_get_session (void *cls)
|
|||||||
",h_contract_terms"
|
",h_contract_terms"
|
||||||
",rtransaction_id"
|
",rtransaction_id"
|
||||||
",denom.denom_pub"
|
",denom.denom_pub"
|
||||||
",coin_pub"
|
",kc.coin_pub"
|
||||||
",amount_with_fee_val"
|
",amount_with_fee_val"
|
||||||
",amount_with_fee_frac"
|
",amount_with_fee_frac"
|
||||||
",refund_serial_id"
|
",refund_serial_id"
|
||||||
" FROM refunds"
|
" FROM refunds"
|
||||||
" JOIN known_coins kc USING (coin_pub)"
|
" JOIN known_coins kc USING (known_coin_id)"
|
||||||
" JOIN denominations denom ON (kc.denominations_serial = denom.denominations_serial)"
|
" JOIN denominations denom ON (kc.denominations_serial = denom.denominations_serial)"
|
||||||
" WHERE refund_serial_id>=$1"
|
" WHERE refund_serial_id>=$1"
|
||||||
" ORDER BY refund_serial_id ASC;",
|
" ORDER BY refund_serial_id ASC;",
|
||||||
@ -896,7 +900,7 @@ postgres_get_session (void *cls)
|
|||||||
Used in #postgres_insert_deposit(). */
|
Used in #postgres_insert_deposit(). */
|
||||||
GNUNET_PQ_make_prepare ("insert_deposit",
|
GNUNET_PQ_make_prepare ("insert_deposit",
|
||||||
"INSERT INTO deposits "
|
"INSERT INTO deposits "
|
||||||
"(coin_pub"
|
"(known_coin_id"
|
||||||
",amount_with_fee_val"
|
",amount_with_fee_val"
|
||||||
",amount_with_fee_frac"
|
",amount_with_fee_frac"
|
||||||
",wallet_timestamp"
|
",wallet_timestamp"
|
||||||
@ -908,9 +912,10 @@ postgres_get_session (void *cls)
|
|||||||
",coin_sig"
|
",coin_sig"
|
||||||
",wire"
|
",wire"
|
||||||
",exchange_timestamp"
|
",exchange_timestamp"
|
||||||
") VALUES "
|
") SELECT known_coin_id, $2, $3, $4, $5, $6, "
|
||||||
"($1, $2, $3, $4, $5, $6, $7, $8, $9, $10,"
|
" $7, $8, $9, $10, $11, $12"
|
||||||
" $11, $12);",
|
" FROM known_coins"
|
||||||
|
" WHERE coin_pub=$1;",
|
||||||
12),
|
12),
|
||||||
/* Fetch an existing deposit request, used to ensure idempotency
|
/* Fetch an existing deposit request, used to ensure idempotency
|
||||||
during /deposit processing. Used in #postgres_have_deposit(). */
|
during /deposit processing. Used in #postgres_have_deposit(). */
|
||||||
@ -927,7 +932,7 @@ postgres_get_session (void *cls)
|
|||||||
",h_contract_terms"
|
",h_contract_terms"
|
||||||
",h_wire"
|
",h_wire"
|
||||||
" FROM deposits"
|
" FROM deposits"
|
||||||
" JOIN known_coins USING (coin_pub)"
|
" JOIN known_coins USING (known_coin_id)"
|
||||||
" JOIN denominations USING (denominations_serial)"
|
" JOIN denominations USING (denominations_serial)"
|
||||||
" WHERE ((coin_pub=$1)"
|
" WHERE ((coin_pub=$1)"
|
||||||
" AND (merchant_pub=$3)"
|
" AND (merchant_pub=$3)"
|
||||||
@ -942,7 +947,7 @@ postgres_get_session (void *cls)
|
|||||||
",exchange_timestamp"
|
",exchange_timestamp"
|
||||||
",merchant_pub"
|
",merchant_pub"
|
||||||
",denom.denom_pub"
|
",denom.denom_pub"
|
||||||
",coin_pub"
|
",kc.coin_pub"
|
||||||
",coin_sig"
|
",coin_sig"
|
||||||
",refund_deadline"
|
",refund_deadline"
|
||||||
",wire_deadline"
|
",wire_deadline"
|
||||||
@ -951,7 +956,7 @@ postgres_get_session (void *cls)
|
|||||||
",done"
|
",done"
|
||||||
",deposit_serial_id"
|
",deposit_serial_id"
|
||||||
" FROM deposits"
|
" FROM deposits"
|
||||||
" JOIN known_coins USING (coin_pub)"
|
" JOIN known_coins kc USING (known_coin_id)"
|
||||||
" JOIN denominations denom USING (denominations_serial)"
|
" JOIN denominations denom USING (denominations_serial)"
|
||||||
" WHERE ("
|
" WHERE ("
|
||||||
" (deposit_serial_id>=$1)"
|
" (deposit_serial_id>=$1)"
|
||||||
@ -968,10 +973,9 @@ postgres_get_session (void *cls)
|
|||||||
",denom.fee_deposit_frac"
|
",denom.fee_deposit_frac"
|
||||||
",wire_deadline"
|
",wire_deadline"
|
||||||
" FROM deposits"
|
" FROM deposits"
|
||||||
" JOIN known_coins USING (coin_pub)"
|
" JOIN known_coins USING (known_coin_id)"
|
||||||
" JOIN denominations denom USING (denominations_serial)"
|
" JOIN denominations denom USING (denominations_serial)"
|
||||||
" WHERE ("
|
" WHERE ((coin_pub=$1)"
|
||||||
" (coin_pub=$1)"
|
|
||||||
" AND (merchant_pub=$2)"
|
" AND (merchant_pub=$2)"
|
||||||
" AND (h_contract_terms=$3)"
|
" AND (h_contract_terms=$3)"
|
||||||
" AND (h_wire=$4)"
|
" AND (h_wire=$4)"
|
||||||
@ -989,11 +993,11 @@ postgres_get_session (void *cls)
|
|||||||
",h_contract_terms"
|
",h_contract_terms"
|
||||||
",wire"
|
",wire"
|
||||||
",merchant_pub"
|
",merchant_pub"
|
||||||
",coin_pub"
|
",kc.coin_pub"
|
||||||
",exchange_timestamp"
|
",exchange_timestamp"
|
||||||
",wallet_timestamp"
|
",wallet_timestamp"
|
||||||
" FROM deposits"
|
" FROM deposits"
|
||||||
" JOIN known_coins USING (coin_pub)"
|
" JOIN known_coins kc USING (known_coin_id)"
|
||||||
" JOIN denominations denom USING (denominations_serial)"
|
" JOIN denominations denom USING (denominations_serial)"
|
||||||
" WHERE tiny=FALSE"
|
" WHERE tiny=FALSE"
|
||||||
" AND done=FALSE"
|
" AND done=FALSE"
|
||||||
@ -1011,12 +1015,10 @@ postgres_get_session (void *cls)
|
|||||||
",denom.fee_deposit_val"
|
",denom.fee_deposit_val"
|
||||||
",denom.fee_deposit_frac"
|
",denom.fee_deposit_frac"
|
||||||
",h_contract_terms"
|
",h_contract_terms"
|
||||||
",coin_pub"
|
",kc.coin_pub"
|
||||||
" FROM deposits"
|
" FROM deposits"
|
||||||
" JOIN known_coins"
|
" JOIN known_coins kc USING (known_coin_id)"
|
||||||
" USING (coin_pub)"
|
" JOIN denominations denom USING (denominations_serial)"
|
||||||
" JOIN denominations denom"
|
|
||||||
" USING (denominations_serial)"
|
|
||||||
" WHERE"
|
" WHERE"
|
||||||
" merchant_pub=$1 AND"
|
" merchant_pub=$1 AND"
|
||||||
" h_wire=$2 AND"
|
" h_wire=$2 AND"
|
||||||
@ -1042,6 +1044,7 @@ postgres_get_session (void *cls)
|
|||||||
GNUNET_PQ_make_prepare ("test_deposit_done",
|
GNUNET_PQ_make_prepare ("test_deposit_done",
|
||||||
"SELECT done"
|
"SELECT done"
|
||||||
" FROM deposits"
|
" FROM deposits"
|
||||||
|
" JOIN known_coins USING (known_coin_id)"
|
||||||
" WHERE coin_pub=$1"
|
" WHERE coin_pub=$1"
|
||||||
" AND merchant_pub=$2"
|
" AND merchant_pub=$2"
|
||||||
" AND h_contract_terms=$3"
|
" AND h_contract_terms=$3"
|
||||||
@ -1068,7 +1071,7 @@ postgres_get_session (void *cls)
|
|||||||
",done"
|
",done"
|
||||||
" FROM deposits"
|
" FROM deposits"
|
||||||
" JOIN known_coins kc"
|
" JOIN known_coins kc"
|
||||||
" USING (coin_pub)"
|
" USING (known_coin_id)"
|
||||||
" JOIN denominations denoms"
|
" JOIN denominations denoms"
|
||||||
" USING (denominations_serial)"
|
" USING (denominations_serial)"
|
||||||
" WHERE coin_pub=$1;",
|
" WHERE coin_pub=$1;",
|
||||||
@ -1088,7 +1091,10 @@ postgres_get_session (void *cls)
|
|||||||
" USING (rc)"
|
" USING (rc)"
|
||||||
" JOIN denominations denoms"
|
" JOIN denominations denoms"
|
||||||
" ON (rrc.denominations_serial = denoms.denominations_serial)"
|
" ON (rrc.denominations_serial = denoms.denominations_serial)"
|
||||||
" WHERE old_coin_pub=$1"
|
" WHERE old_known_coin_id="
|
||||||
|
" (SELECT known_coin_id "
|
||||||
|
" FROM known_coins"
|
||||||
|
" WHERE coin_pub=$1)"
|
||||||
" ORDER BY tp.transfer_pub",
|
" ORDER BY tp.transfer_pub",
|
||||||
1),
|
1),
|
||||||
/* Used in #postgres_lookup_wire_transfer */
|
/* Used in #postgres_lookup_wire_transfer */
|
||||||
@ -1098,7 +1104,7 @@ postgres_get_session (void *cls)
|
|||||||
",deposits.h_contract_terms"
|
",deposits.h_contract_terms"
|
||||||
",deposits.wire"
|
",deposits.wire"
|
||||||
",deposits.h_wire"
|
",deposits.h_wire"
|
||||||
",deposits.coin_pub"
|
",kc.coin_pub"
|
||||||
",deposits.merchant_pub"
|
",deposits.merchant_pub"
|
||||||
",wire_out.execution_date"
|
",wire_out.execution_date"
|
||||||
",deposits.amount_with_fee_val"
|
",deposits.amount_with_fee_val"
|
||||||
@ -1109,8 +1115,8 @@ postgres_get_session (void *cls)
|
|||||||
" FROM aggregation_tracking"
|
" FROM aggregation_tracking"
|
||||||
" JOIN deposits"
|
" JOIN deposits"
|
||||||
" USING (deposit_serial_id)"
|
" USING (deposit_serial_id)"
|
||||||
" JOIN known_coins"
|
" JOIN known_coins kc"
|
||||||
" USING (coin_pub)"
|
" USING (known_coin_id)"
|
||||||
" JOIN denominations denom"
|
" JOIN denominations denom"
|
||||||
" USING (denominations_serial)"
|
" USING (denominations_serial)"
|
||||||
" JOIN wire_out"
|
" JOIN wire_out"
|
||||||
@ -1130,7 +1136,7 @@ postgres_get_session (void *cls)
|
|||||||
" JOIN aggregation_tracking"
|
" JOIN aggregation_tracking"
|
||||||
" USING (deposit_serial_id)"
|
" USING (deposit_serial_id)"
|
||||||
" JOIN known_coins"
|
" JOIN known_coins"
|
||||||
" USING (coin_pub)"
|
" USING (known_coin_id)"
|
||||||
" JOIN denominations denom"
|
" JOIN denominations denom"
|
||||||
" USING (denominations_serial)"
|
" USING (denominations_serial)"
|
||||||
" JOIN wire_out"
|
" JOIN wire_out"
|
||||||
@ -1234,11 +1240,12 @@ postgres_get_session (void *cls)
|
|||||||
",tiny"
|
",tiny"
|
||||||
",done"
|
",done"
|
||||||
" FROM deposits"
|
" FROM deposits"
|
||||||
|
" JOIN known_coins USING (known_coin_id)"
|
||||||
" WHERE wire_deadline >= $1"
|
" WHERE wire_deadline >= $1"
|
||||||
" AND wire_deadline < $2"
|
" AND wire_deadline < $2"
|
||||||
" AND NOT (EXISTS (SELECT 1"
|
" AND NOT (EXISTS (SELECT 1"
|
||||||
" FROM refunds"
|
" FROM refunds"
|
||||||
" WHERE (refunds.coin_pub = deposits.coin_pub))"
|
" WHERE (refunds.known_coin_id = deposits.known_coin_id))"
|
||||||
" OR EXISTS (SELECT 1"
|
" OR EXISTS (SELECT 1"
|
||||||
" FROM aggregation_tracking"
|
" FROM aggregation_tracking"
|
||||||
" WHERE (aggregation_tracking.deposit_serial_id = deposits.deposit_serial_id)))"
|
" WHERE (aggregation_tracking.deposit_serial_id = deposits.deposit_serial_id)))"
|
||||||
@ -1273,30 +1280,42 @@ postgres_get_session (void *cls)
|
|||||||
/* Used in #postgres_insert_recoup_request() to store recoup
|
/* Used in #postgres_insert_recoup_request() to store recoup
|
||||||
information */
|
information */
|
||||||
GNUNET_PQ_make_prepare ("recoup_insert",
|
GNUNET_PQ_make_prepare ("recoup_insert",
|
||||||
|
"WITH rx AS"
|
||||||
|
" (SELECT reserve_out_serial_id"
|
||||||
|
" FROM reserves_out"
|
||||||
|
" WHERE h_blind_ev=$7)"
|
||||||
"INSERT INTO recoup "
|
"INSERT INTO recoup "
|
||||||
"(coin_pub"
|
"(known_coin_id"
|
||||||
",coin_sig"
|
",coin_sig"
|
||||||
",coin_blind"
|
",coin_blind"
|
||||||
",amount_val"
|
",amount_val"
|
||||||
",amount_frac"
|
",amount_frac"
|
||||||
",timestamp"
|
",timestamp"
|
||||||
",h_blind_ev"
|
",reserve_out_serial_id"
|
||||||
") VALUES "
|
") SELECT known_coin_id, $2, $3, $4, $5, $6, rx.reserve_out_serial_id"
|
||||||
"($1, $2, $3, $4, $5, $6, $7);",
|
" FROM known_coins"
|
||||||
|
" CROSS JOIN rx"
|
||||||
|
" WHERE coin_pub=$1;",
|
||||||
7),
|
7),
|
||||||
/* Used in #postgres_insert_recoup_refresh_request() to store recoup-refresh
|
/* Used in #postgres_insert_recoup_refresh_request() to store recoup-refresh
|
||||||
information */
|
information */
|
||||||
GNUNET_PQ_make_prepare ("recoup_refresh_insert",
|
GNUNET_PQ_make_prepare ("recoup_refresh_insert",
|
||||||
|
"WITH rrx AS"
|
||||||
|
" (SELECT rrc_serial"
|
||||||
|
" FROM refresh_revealed_coins"
|
||||||
|
" WHERE h_coin_ev=$7)"
|
||||||
"INSERT INTO recoup_refresh "
|
"INSERT INTO recoup_refresh "
|
||||||
"(coin_pub"
|
"(known_coin_id"
|
||||||
",coin_sig"
|
",coin_sig"
|
||||||
",coin_blind"
|
",coin_blind"
|
||||||
",amount_val"
|
",amount_val"
|
||||||
",amount_frac"
|
",amount_frac"
|
||||||
",timestamp"
|
",timestamp"
|
||||||
",h_blind_ev"
|
",rrc_serial"
|
||||||
") VALUES "
|
") SELECT known_coin_id, $2, $3, $4, $5, $6, rrx.rrc_serial"
|
||||||
"($1, $2, $3, $4, $5, $6, $7);",
|
" FROM known_coins"
|
||||||
|
" CROSS JOIN rrx"
|
||||||
|
" WHERE coin_pub=$1;",
|
||||||
7),
|
7),
|
||||||
/* Used in #postgres_select_recoup_above_serial_id() to obtain recoup transactions */
|
/* Used in #postgres_select_recoup_above_serial_id() to obtain recoup transactions */
|
||||||
GNUNET_PQ_make_prepare ("recoup_get_incr",
|
GNUNET_PQ_make_prepare ("recoup_get_incr",
|
||||||
@ -1304,10 +1323,10 @@ postgres_get_session (void *cls)
|
|||||||
" recoup_uuid"
|
" recoup_uuid"
|
||||||
",timestamp"
|
",timestamp"
|
||||||
",reserves.reserve_pub"
|
",reserves.reserve_pub"
|
||||||
",coin_pub"
|
",coins.coin_pub"
|
||||||
",coin_sig"
|
",coin_sig"
|
||||||
",coin_blind"
|
",coin_blind"
|
||||||
",h_blind_ev"
|
",ro.h_blind_ev"
|
||||||
",denoms.denom_pub_hash"
|
",denoms.denom_pub_hash"
|
||||||
",coins.denom_sig"
|
",coins.denom_sig"
|
||||||
",denoms.denom_pub"
|
",denoms.denom_pub"
|
||||||
@ -1315,9 +1334,9 @@ postgres_get_session (void *cls)
|
|||||||
",amount_frac"
|
",amount_frac"
|
||||||
" FROM recoup"
|
" FROM recoup"
|
||||||
" JOIN known_coins coins"
|
" JOIN known_coins coins"
|
||||||
" USING (coin_pub)"
|
" USING (known_coin_id)"
|
||||||
" JOIN reserves_out ro"
|
" JOIN reserves_out ro"
|
||||||
" USING (h_blind_ev)"
|
" USING (reserve_out_serial_id)"
|
||||||
" JOIN reserves"
|
" JOIN reserves"
|
||||||
" USING (reserve_uuid)"
|
" USING (reserve_uuid)"
|
||||||
" JOIN denominations denoms"
|
" JOIN denominations denoms"
|
||||||
@ -1331,26 +1350,26 @@ postgres_get_session (void *cls)
|
|||||||
"SELECT"
|
"SELECT"
|
||||||
" recoup_refresh_uuid"
|
" recoup_refresh_uuid"
|
||||||
",timestamp"
|
",timestamp"
|
||||||
",rc.old_coin_pub"
|
",old_coins.coin_pub AS old_coin_pub"
|
||||||
",old_denoms.denom_pub_hash AS old_denom_pub_hash"
|
",old_denoms.denom_pub_hash AS old_denom_pub_hash"
|
||||||
",recoup_refresh.coin_pub"
|
",new_coins.coin_pub As coin_pub"
|
||||||
",coin_sig"
|
",coin_sig"
|
||||||
",coin_blind"
|
",coin_blind"
|
||||||
",new_denoms.denom_pub"
|
",new_denoms.denom_pub AS denom_pub"
|
||||||
",h_blind_ev"
|
",rrc.h_coin_ev AS h_blind_ev"
|
||||||
",new_denoms.denom_pub_hash"
|
",new_denoms.denom_pub_hash"
|
||||||
",new_coins.denom_sig"
|
",new_coins.denom_sig AS denom_sig"
|
||||||
",amount_val"
|
",amount_val"
|
||||||
",amount_frac"
|
",amount_frac"
|
||||||
" FROM recoup_refresh"
|
" FROM recoup_refresh"
|
||||||
" INNER JOIN refresh_revealed_coins rrc"
|
" INNER JOIN refresh_revealed_coins rrc"
|
||||||
" ON (rrc.h_coin_ev = h_blind_ev)"
|
" USING (rrc_serial)"
|
||||||
" INNER JOIN refresh_commitments rc"
|
" INNER JOIN refresh_commitments rc"
|
||||||
" ON (rrc.rc = rc.rc)"
|
" ON (rrc.rc = rc.rc)"
|
||||||
" INNER JOIN known_coins old_coins"
|
" INNER JOIN known_coins old_coins"
|
||||||
" ON (rc.old_coin_pub = old_coins.coin_pub)"
|
" ON (rc.old_known_coin_id = old_coins.known_coin_id)"
|
||||||
" INNER JOIN known_coins new_coins"
|
" INNER JOIN known_coins new_coins"
|
||||||
" ON (new_coins.coin_pub = recoup_refresh.coin_pub)"
|
" ON (new_coins.known_coin_id = recoup_refresh.known_coin_id)"
|
||||||
" INNER JOIN denominations new_denoms"
|
" INNER JOIN denominations new_denoms"
|
||||||
" ON (new_coins.denominations_serial = new_denoms.denominations_serial)"
|
" ON (new_coins.denominations_serial = new_denoms.denominations_serial)"
|
||||||
" INNER JOIN denominations old_denoms"
|
" INNER JOIN denominations old_denoms"
|
||||||
@ -1381,7 +1400,7 @@ postgres_get_session (void *cls)
|
|||||||
for a reserve */
|
for a reserve */
|
||||||
GNUNET_PQ_make_prepare ("recoup_by_reserve",
|
GNUNET_PQ_make_prepare ("recoup_by_reserve",
|
||||||
"SELECT"
|
"SELECT"
|
||||||
" coin_pub"
|
" coins.coin_pub"
|
||||||
",coin_sig"
|
",coin_sig"
|
||||||
",coin_blind"
|
",coin_blind"
|
||||||
",amount_val"
|
",amount_val"
|
||||||
@ -1391,11 +1410,11 @@ postgres_get_session (void *cls)
|
|||||||
",coins.denom_sig"
|
",coins.denom_sig"
|
||||||
" FROM recoup"
|
" FROM recoup"
|
||||||
" JOIN known_coins coins"
|
" JOIN known_coins coins"
|
||||||
" USING (coin_pub)"
|
" USING (known_coin_id)"
|
||||||
" JOIN denominations denoms"
|
" JOIN denominations denoms"
|
||||||
" USING (denominations_serial)"
|
" USING (denominations_serial)"
|
||||||
" JOIN reserves_out ro"
|
" JOIN reserves_out ro"
|
||||||
" USING (h_blind_ev)"
|
" USING (reserve_out_serial_id)"
|
||||||
" WHERE ro.reserve_uuid="
|
" WHERE ro.reserve_uuid="
|
||||||
" (SELECT reserve_uuid"
|
" (SELECT reserve_uuid"
|
||||||
" FROM reserves"
|
" FROM reserves"
|
||||||
@ -1405,7 +1424,7 @@ postgres_get_session (void *cls)
|
|||||||
affecting old coins of refreshed coins */
|
affecting old coins of refreshed coins */
|
||||||
GNUNET_PQ_make_prepare ("recoup_by_old_coin",
|
GNUNET_PQ_make_prepare ("recoup_by_old_coin",
|
||||||
"SELECT"
|
"SELECT"
|
||||||
" coin_pub"
|
" coins.coin_pub"
|
||||||
",coin_sig"
|
",coin_sig"
|
||||||
",coin_blind"
|
",coin_blind"
|
||||||
",amount_val"
|
",amount_val"
|
||||||
@ -1416,15 +1435,18 @@ postgres_get_session (void *cls)
|
|||||||
",recoup_refresh_uuid"
|
",recoup_refresh_uuid"
|
||||||
" FROM recoup_refresh"
|
" FROM recoup_refresh"
|
||||||
" JOIN known_coins coins"
|
" JOIN known_coins coins"
|
||||||
" USING (coin_pub)"
|
" USING (known_coin_id)"
|
||||||
" JOIN denominations denoms"
|
" JOIN denominations denoms"
|
||||||
" USING (denominations_serial)"
|
" USING (denominations_serial)"
|
||||||
" WHERE h_blind_ev IN"
|
" WHERE rrc_serial IN"
|
||||||
" (SELECT rrc.h_coin_ev"
|
" (SELECT rrc.rrc_serial"
|
||||||
" FROM refresh_commitments"
|
" FROM refresh_commitments"
|
||||||
" JOIN refresh_revealed_coins rrc"
|
" JOIN refresh_revealed_coins rrc"
|
||||||
" USING (rc)"
|
" USING (rc)"
|
||||||
" WHERE old_coin_pub=$1);",
|
" WHERE old_known_coin_id="
|
||||||
|
" (SELECT known_coin_id"
|
||||||
|
" FROM known_coins"
|
||||||
|
" WHERE coin_pub=$1));",
|
||||||
1),
|
1),
|
||||||
/* Used in #postgres_get_reserve_history() */
|
/* Used in #postgres_get_reserve_history() */
|
||||||
GNUNET_PQ_make_prepare ("close_by_reserve",
|
GNUNET_PQ_make_prepare ("close_by_reserve",
|
||||||
@ -1471,20 +1493,20 @@ postgres_get_session (void *cls)
|
|||||||
",recoup_uuid"
|
",recoup_uuid"
|
||||||
" FROM recoup"
|
" FROM recoup"
|
||||||
" JOIN reserves_out ro"
|
" JOIN reserves_out ro"
|
||||||
" USING (h_blind_ev)"
|
" USING (reserve_out_serial_id)"
|
||||||
" JOIN reserves"
|
" JOIN reserves"
|
||||||
" USING (reserve_uuid)"
|
" USING (reserve_uuid)"
|
||||||
" JOIN known_coins coins"
|
" JOIN known_coins coins"
|
||||||
" USING (coin_pub)"
|
" USING (known_coin_id)"
|
||||||
" JOIN denominations denoms"
|
" JOIN denominations denoms"
|
||||||
" ON (denoms.denominations_serial = coins.denominations_serial)"
|
" ON (denoms.denominations_serial = coins.denominations_serial)"
|
||||||
" WHERE recoup.coin_pub=$1;",
|
" WHERE coins.coin_pub=$1;",
|
||||||
1),
|
1),
|
||||||
/* Used in #postgres_get_coin_transactions() to obtain recoup transactions
|
/* Used in #postgres_get_coin_transactions() to obtain recoup transactions
|
||||||
for a refreshed coin */
|
for a refreshed coin */
|
||||||
GNUNET_PQ_make_prepare ("recoup_by_refreshed_coin",
|
GNUNET_PQ_make_prepare ("recoup_by_refreshed_coin",
|
||||||
"SELECT"
|
"SELECT"
|
||||||
" rc.old_coin_pub"
|
" old_coins.coin_pub AS old_coin_pub"
|
||||||
",coin_sig"
|
",coin_sig"
|
||||||
",coin_blind"
|
",coin_blind"
|
||||||
",amount_val"
|
",amount_val"
|
||||||
@ -1495,14 +1517,16 @@ postgres_get_session (void *cls)
|
|||||||
",recoup_refresh_uuid"
|
",recoup_refresh_uuid"
|
||||||
" FROM recoup_refresh"
|
" FROM recoup_refresh"
|
||||||
" JOIN refresh_revealed_coins rrc"
|
" JOIN refresh_revealed_coins rrc"
|
||||||
" ON (rrc.h_coin_ev = h_blind_ev)"
|
" USING (rrc_serial)"
|
||||||
" JOIN refresh_commitments rc"
|
" JOIN refresh_commitments rc"
|
||||||
" ON (rrc.rc = rc.rc)"
|
" ON (rrc.rc = rc.rc)"
|
||||||
|
" JOIN known_coins old_coins"
|
||||||
|
" ON (rc.old_known_coin_id = old_coins.known_coin_id)"
|
||||||
" JOIN known_coins coins"
|
" JOIN known_coins coins"
|
||||||
" USING (coin_pub)"
|
" ON (recoup_refresh.known_coin_id = coins.known_coin_id)"
|
||||||
" JOIN denominations denoms"
|
" JOIN denominations denoms"
|
||||||
" ON (denoms.denominations_serial = coins.denominations_serial)"
|
" ON (denoms.denominations_serial = coins.denominations_serial)"
|
||||||
" WHERE coin_pub=$1;",
|
" WHERE coins.coin_pub=$1;",
|
||||||
1),
|
1),
|
||||||
/* Used in #postgres_get_reserve_by_h_blind() */
|
/* Used in #postgres_get_reserve_by_h_blind() */
|
||||||
GNUNET_PQ_make_prepare ("reserve_by_h_blind",
|
GNUNET_PQ_make_prepare ("reserve_by_h_blind",
|
||||||
@ -1517,10 +1541,10 @@ postgres_get_session (void *cls)
|
|||||||
/* Used in #postgres_get_old_coin_by_h_blind() */
|
/* Used in #postgres_get_old_coin_by_h_blind() */
|
||||||
GNUNET_PQ_make_prepare ("old_coin_by_h_blind",
|
GNUNET_PQ_make_prepare ("old_coin_by_h_blind",
|
||||||
"SELECT"
|
"SELECT"
|
||||||
" rcom.old_coin_pub"
|
" okc.coin_pub AS old_coin_pub"
|
||||||
" FROM refresh_revealed_coins"
|
" FROM refresh_revealed_coins rrc"
|
||||||
" JOIN refresh_commitments rcom"
|
" JOIN refresh_commitments rcom USING (rc)"
|
||||||
" USING (rc)"
|
" JOIN known_coins okc ON (rcom.old_known_coin_id = okc.known_coin_id)"
|
||||||
" WHERE h_coin_ev=$1"
|
" WHERE h_coin_ev=$1"
|
||||||
" LIMIT 1;",
|
" LIMIT 1;",
|
||||||
1),
|
1),
|
||||||
@ -1609,17 +1633,21 @@ postgres_get_session (void *cls)
|
|||||||
/* used in #postgres_insert_signkey_revocation() */
|
/* used in #postgres_insert_signkey_revocation() */
|
||||||
GNUNET_PQ_make_prepare ("insert_signkey_revocation",
|
GNUNET_PQ_make_prepare ("insert_signkey_revocation",
|
||||||
"INSERT INTO signkey_revocations "
|
"INSERT INTO signkey_revocations "
|
||||||
"(exchange_pub"
|
"(esk_serial"
|
||||||
",master_sig"
|
",master_sig"
|
||||||
") VALUES "
|
") SELECT esk_serial, $2 "
|
||||||
"($1, $2);",
|
" FROM exchange_sign_keys"
|
||||||
|
" WHERE exchange_pub=$1;",
|
||||||
2),
|
2),
|
||||||
/* used in #postgres_insert_signkey_revocation() */
|
/* used in #postgres_insert_signkey_revocation() */
|
||||||
GNUNET_PQ_make_prepare ("lookup_signkey_revocation",
|
GNUNET_PQ_make_prepare ("lookup_signkey_revocation",
|
||||||
"SELECT "
|
"SELECT "
|
||||||
" master_sig"
|
" master_sig"
|
||||||
" FROM signkey_revocations"
|
" FROM signkey_revocations"
|
||||||
" WHERE exchange_pub=$1;",
|
" WHERE esk_serial="
|
||||||
|
" (SELECT esk_serial"
|
||||||
|
" FROM exchange_sign_keys"
|
||||||
|
" WHERE exchange_pub=$1);",
|
||||||
1),
|
1),
|
||||||
/* used in #postgres_insert_signkey() */
|
/* used in #postgres_insert_signkey() */
|
||||||
GNUNET_PQ_make_prepare ("insert_signkey",
|
GNUNET_PQ_make_prepare ("insert_signkey",
|
||||||
@ -1885,8 +1913,7 @@ postgres_get_session (void *cls)
|
|||||||
",master_sig"
|
",master_sig"
|
||||||
",denominations_serial"
|
",denominations_serial"
|
||||||
" FROM denomination_revocations"
|
" FROM denomination_revocations"
|
||||||
" ORDER BY denom_revocations_serial_id DESC"
|
" ORDER BY denom_revocations_serial_id ASC;",
|
||||||
" LIMIT 1;",
|
|
||||||
0),
|
0),
|
||||||
GNUNET_PQ_make_prepare ("select_above_serial_by_table_reserves",
|
GNUNET_PQ_make_prepare ("select_above_serial_by_table_reserves",
|
||||||
"SELECT"
|
"SELECT"
|
||||||
@ -1898,8 +1925,7 @@ postgres_get_session (void *cls)
|
|||||||
",expiration_date"
|
",expiration_date"
|
||||||
",gc_date"
|
",gc_date"
|
||||||
" FROM reserves"
|
" FROM reserves"
|
||||||
" ORDER BY reserve_uuid DESC"
|
" ORDER BY reserve_uuid ASC;",
|
||||||
" LIMIT 1;",
|
|
||||||
0),
|
0),
|
||||||
GNUNET_PQ_make_prepare ("select_above_serial_by_table_reserves_in",
|
GNUNET_PQ_make_prepare ("select_above_serial_by_table_reserves_in",
|
||||||
"SELECT"
|
"SELECT"
|
||||||
@ -1911,8 +1937,7 @@ postgres_get_session (void *cls)
|
|||||||
",exchange_account_section"
|
",exchange_account_section"
|
||||||
",execution_date"
|
",execution_date"
|
||||||
" FROM reserves_in"
|
" FROM reserves_in"
|
||||||
" ORDER BY reserve_in_serial_id DESC"
|
" ORDER BY reserve_in_serial_id ASC;",
|
||||||
" LIMIT 1;",
|
|
||||||
0),
|
0),
|
||||||
GNUNET_PQ_make_prepare ("select_above_serial_by_table_reserves_close",
|
GNUNET_PQ_make_prepare ("select_above_serial_by_table_reserves_close",
|
||||||
"SELECT"
|
"SELECT"
|
||||||
@ -1926,8 +1951,7 @@ postgres_get_session (void *cls)
|
|||||||
",closing_fee_frac"
|
",closing_fee_frac"
|
||||||
",reserve_uuid"
|
",reserve_uuid"
|
||||||
" FROM reserves_close"
|
" FROM reserves_close"
|
||||||
" ORDER BY close_uuid DESC"
|
" ORDER BY close_uuid ASC;",
|
||||||
" LIMIT 1;",
|
|
||||||
0),
|
0),
|
||||||
GNUNET_PQ_make_prepare ("select_above_serial_by_table_reserves_out",
|
GNUNET_PQ_make_prepare ("select_above_serial_by_table_reserves_out",
|
||||||
"SELECT"
|
"SELECT"
|
||||||
@ -1941,8 +1965,7 @@ postgres_get_session (void *cls)
|
|||||||
",reserve_uuid"
|
",reserve_uuid"
|
||||||
",denominations_serial"
|
",denominations_serial"
|
||||||
" FROM reserves_out"
|
" FROM reserves_out"
|
||||||
" ORDER BY reserve_out_serial_id DESC"
|
" ORDER BY reserve_out_serial_id ASC;",
|
||||||
" LIMIT 1;",
|
|
||||||
0),
|
0),
|
||||||
GNUNET_PQ_make_prepare ("select_above_serial_by_table_auditors",
|
GNUNET_PQ_make_prepare ("select_above_serial_by_table_auditors",
|
||||||
"SELECT"
|
"SELECT"
|
||||||
@ -1953,112 +1976,125 @@ postgres_get_session (void *cls)
|
|||||||
",is_active"
|
",is_active"
|
||||||
",last_change"
|
",last_change"
|
||||||
" FROM auditors"
|
" FROM auditors"
|
||||||
" ORDER BY auditor_uuid DESC"
|
" ORDER BY auditor_uuid ASC;",
|
||||||
" LIMIT 1;",
|
|
||||||
0),
|
0),
|
||||||
GNUNET_PQ_make_prepare ("select_above_serial_by_table_auditor_denom_sigs",
|
GNUNET_PQ_make_prepare ("select_above_serial_by_table_auditor_denom_sigs",
|
||||||
"SELECT"
|
"SELECT"
|
||||||
" auditor_denom_serial AS serial"
|
" auditor_denom_serial AS serial"
|
||||||
",auditor_uuid"
|
",auditor_uuid"
|
||||||
|
",denominations_serial"
|
||||||
" FROM auditor_denom_sigs"
|
" FROM auditor_denom_sigs"
|
||||||
" ORDER BY auditor_denom_serial DESC"
|
" ORDER BY auditor_denom_serial ASC;",
|
||||||
" LIMIT 1;",
|
|
||||||
0),
|
0),
|
||||||
GNUNET_PQ_make_prepare ("select_above_serial_by_table_exchange_sign_keys",
|
GNUNET_PQ_make_prepare ("select_above_serial_by_table_exchange_sign_keys",
|
||||||
"SELECT"
|
"SELECT"
|
||||||
" esk_serial AS serial"
|
" esk_serial AS serial"
|
||||||
|
",exchange_pub"
|
||||||
|
",master_sig"
|
||||||
|
",valid_from"
|
||||||
|
",expire_sign"
|
||||||
|
",expire_legal"
|
||||||
" FROM exchange_sign_keys"
|
" FROM exchange_sign_keys"
|
||||||
" ORDER BY esk_serial DESC"
|
" ORDER BY esk_serial ASC;",
|
||||||
" LIMIT 1;",
|
|
||||||
0),
|
0),
|
||||||
GNUNET_PQ_make_prepare (
|
GNUNET_PQ_make_prepare (
|
||||||
"select_above_serial_by_table_signkey_revocations",
|
"select_above_serial_by_table_signkey_revocations",
|
||||||
"SELECT"
|
"SELECT"
|
||||||
" signkey_revocations_serial_id AS serial"
|
" signkey_revocations_serial_id AS serial"
|
||||||
|
",esk_serial"
|
||||||
|
",master_sig"
|
||||||
" FROM signkey_revocations"
|
" FROM signkey_revocations"
|
||||||
" ORDER BY signkey_revocations_serial_id DESC"
|
" ORDER BY signkey_revocations_serial_id ASC;",
|
||||||
" LIMIT 1;",
|
|
||||||
0),
|
0),
|
||||||
GNUNET_PQ_make_prepare ("select_above_serial_by_table_known_coins",
|
GNUNET_PQ_make_prepare ("select_above_serial_by_table_known_coins",
|
||||||
"SELECT"
|
"SELECT"
|
||||||
" known_coin_id AS serial"
|
" known_coin_id AS serial"
|
||||||
|
",coin_pub"
|
||||||
|
",denom_sig"
|
||||||
|
",denominations_serial"
|
||||||
" FROM known_coins"
|
" FROM known_coins"
|
||||||
" ORDER BY known_coin_id DESC"
|
" ORDER BY known_coin_id ASC;",
|
||||||
" LIMIT 1;",
|
|
||||||
0),
|
0),
|
||||||
GNUNET_PQ_make_prepare (
|
GNUNET_PQ_make_prepare (
|
||||||
"select_above_serial_by_table_refresh_commitments",
|
"select_above_serial_by_table_refresh_commitments",
|
||||||
"SELECT"
|
"SELECT"
|
||||||
" melt_serial_id AS serial"
|
" melt_serial_id AS serial"
|
||||||
|
",rc"
|
||||||
|
",old_known_coin_id"
|
||||||
|
",old_coin_sig"
|
||||||
|
",amount_with_fee_val"
|
||||||
|
",amount_with_fee_frac"
|
||||||
|
",noreveal_index"
|
||||||
" FROM refresh_commitments"
|
" FROM refresh_commitments"
|
||||||
" ORDER BY melt_serial_id DESC"
|
" ORDER BY melt_serial_id ASC;",
|
||||||
" LIMIT 1;",
|
|
||||||
0),
|
0),
|
||||||
GNUNET_PQ_make_prepare (
|
GNUNET_PQ_make_prepare (
|
||||||
"select_above_serial_by_table_refresh_revealed_coins",
|
"select_above_serial_by_table_refresh_revealed_coins",
|
||||||
"SELECT"
|
"SELECT"
|
||||||
" rrc_serial AS serial"
|
" rrc_serial AS serial"
|
||||||
|
",rc"
|
||||||
|
",freshcoin_index"
|
||||||
|
",link_sig"
|
||||||
|
",coin_ev"
|
||||||
|
",h_coin_ev"
|
||||||
|
",ev_sig"
|
||||||
|
",rrc_serial"
|
||||||
|
",denominations_serial"
|
||||||
" FROM refresh_revealed_coins"
|
" FROM refresh_revealed_coins"
|
||||||
" ORDER BY rrc_serial DESC"
|
" ORDER BY rrc_serial ASC;",
|
||||||
" LIMIT 1;",
|
|
||||||
0),
|
0),
|
||||||
GNUNET_PQ_make_prepare (
|
GNUNET_PQ_make_prepare (
|
||||||
"select_above_serial_by_table_refresh_transfer_keys",
|
"select_above_serial_by_table_refresh_transfer_keys",
|
||||||
"SELECT"
|
"SELECT"
|
||||||
" rtc_serial AS serial"
|
" rtc_serial AS serial"
|
||||||
|
",rc"
|
||||||
|
",transfer_pub"
|
||||||
|
",transfer_privs"
|
||||||
" FROM refresh_transfer_keys"
|
" FROM refresh_transfer_keys"
|
||||||
" ORDER BY rtc_serial DESC"
|
" ORDER BY rtc_serial ASC;",
|
||||||
" LIMIT 1;",
|
|
||||||
0),
|
0),
|
||||||
GNUNET_PQ_make_prepare ("select_above_serial_by_table_deposits",
|
GNUNET_PQ_make_prepare ("select_above_serial_by_table_deposits",
|
||||||
"SELECT"
|
"SELECT"
|
||||||
" deposit_serial_id AS serial"
|
" deposit_serial_id AS serial"
|
||||||
" FROM deposits"
|
" FROM deposits"
|
||||||
" ORDER BY deposit_serial_id DESC"
|
" ORDER BY deposit_serial_id ASC;",
|
||||||
" LIMIT 1;",
|
|
||||||
0),
|
0),
|
||||||
GNUNET_PQ_make_prepare ("select_above_serial_by_table_refunds",
|
GNUNET_PQ_make_prepare ("select_above_serial_by_table_refunds",
|
||||||
"SELECT"
|
"SELECT"
|
||||||
" refund_serial_id AS serial"
|
" refund_serial_id AS serial"
|
||||||
" FROM refunds"
|
" FROM refunds"
|
||||||
" ORDER BY refund_serial_id DESC"
|
" ORDER BY refund_serial_id ASC;",
|
||||||
" LIMIT 1;",
|
|
||||||
0),
|
0),
|
||||||
GNUNET_PQ_make_prepare ("select_above_serial_by_table_wire_out",
|
GNUNET_PQ_make_prepare ("select_above_serial_by_table_wire_out",
|
||||||
"SELECT"
|
"SELECT"
|
||||||
" wireout_uuid AS serial"
|
" wireout_uuid AS serial"
|
||||||
" FROM wire_out"
|
" FROM wire_out"
|
||||||
" ORDER BY wireout_uuid DESC"
|
" ORDER BY wireout_uuid ASC;",
|
||||||
" LIMIT 1;",
|
|
||||||
0),
|
0),
|
||||||
GNUNET_PQ_make_prepare (
|
GNUNET_PQ_make_prepare (
|
||||||
"select_above_serial_by_table_aggregation_tracking",
|
"select_above_serial_by_table_aggregation_tracking",
|
||||||
"SELECT"
|
"SELECT"
|
||||||
" aggregation_serial_id AS serial"
|
" aggregation_serial_id AS serial"
|
||||||
" FROM aggregation_tracking"
|
" FROM aggregation_tracking"
|
||||||
" ORDER BY aggregation_serial_id DESC"
|
" ORDER BY aggregation_serial_id ASC;",
|
||||||
" LIMIT 1;",
|
|
||||||
0),
|
0),
|
||||||
GNUNET_PQ_make_prepare ("select_above_serial_by_table_wire_fee",
|
GNUNET_PQ_make_prepare ("select_above_serial_by_table_wire_fee",
|
||||||
"SELECT"
|
"SELECT"
|
||||||
" wire_fee_serial AS serial"
|
" wire_fee_serial AS serial"
|
||||||
" FROM wire_fee"
|
" FROM wire_fee"
|
||||||
" ORDER BY wire_fee_serial DESC"
|
" ORDER BY wire_fee_serial ASC;",
|
||||||
" LIMIT 1;",
|
|
||||||
0),
|
0),
|
||||||
GNUNET_PQ_make_prepare ("select_above_serial_by_table_recoup",
|
GNUNET_PQ_make_prepare ("select_above_serial_by_table_recoup",
|
||||||
"SELECT"
|
"SELECT"
|
||||||
" recoup_uuid AS serial"
|
" recoup_uuid AS serial"
|
||||||
" FROM recoup"
|
" FROM recoup"
|
||||||
" ORDER BY recoup_uuid DESC"
|
" ORDER BY recoup_uuid ASC;",
|
||||||
" LIMIT 1;",
|
|
||||||
0),
|
0),
|
||||||
GNUNET_PQ_make_prepare ("select_above_serial_by_table_recoup_refresh",
|
GNUNET_PQ_make_prepare ("select_above_serial_by_table_recoup_refresh",
|
||||||
"SELECT"
|
"SELECT"
|
||||||
" recoup_refresh_uuid AS serial"
|
" recoup_refresh_uuid AS serial"
|
||||||
" FROM recoup_refresh"
|
" FROM recoup_refresh"
|
||||||
" ORDER BY recoup_refresh_uuid DESC"
|
" ORDER BY recoup_refresh_uuid ASC;",
|
||||||
" LIMIT 1;",
|
|
||||||
0),
|
0),
|
||||||
|
|
||||||
// FIXME...
|
// FIXME...
|
||||||
|
Loading…
Reference in New Issue
Block a user