Compare commits
14 Commits
6f492b2a97
...
5ee567d1ba
Author | SHA1 | Date | |
---|---|---|---|
5ee567d1ba | |||
84bde679a7 | |||
e68d9f9b75 | |||
153a078ca5 | |||
1a63275d98 | |||
|
af3c92f9d5 | ||
|
e1439e6401 | ||
|
487f23502f | ||
|
1a3dbf8c98 | ||
|
505170ce1f | ||
|
b219366cdf | ||
08b420dd52 | |||
|
88a69ac7f2 | ||
5d17c9c909 |
@ -1 +1 @@
|
||||
Subproject commit bf43b20a0362ac19bcf1bab9c33215e55d8d9f36
|
||||
Subproject commit bd4e73b2ed06269fdee42eaad21acb5be8be9302
|
@ -193,7 +193,7 @@ echo " DONE"
|
||||
|
||||
echo -n "Setting up merchant"
|
||||
|
||||
curl -H "Content-Type: application/json" -X POST -d '{"auth":{"method":"external"},"payto_uris":["payto://x-taler-bank/localhost/43"],"id":"default","name":"default","address":{},"jurisdiction":{},"default_max_wire_fee":"TESTKUDOS:1", "default_max_deposit_fee":"TESTKUDOS:1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_us" : 3600000000},"default_pay_delay":{"d_us": 3600000000}}' http://localhost:9966/management/instances
|
||||
curl -H "Content-Type: application/json" -X POST -d '{"auth":{"method":"external"},"accounts":[{"payto_uri":"payto://x-taler-bank/localhost/43"}],"id":"default","name":"default","address":{},"jurisdiction":{},"default_max_wire_fee":"TESTKUDOS:1", "default_max_deposit_fee":"TESTKUDOS:1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_us" : 3600000000},"default_pay_delay":{"d_us": 3600000000}}' http://localhost:9966/management/instances
|
||||
|
||||
|
||||
echo " DONE"
|
||||
@ -214,7 +214,7 @@ bash
|
||||
# {
|
||||
# amountToSpend: "TESTKUDOS:4",
|
||||
# amountToWithdraw: "TESTKUDOS:10",
|
||||
# bankBaseUrl: $BANK_URL,
|
||||
# bankAccessApiBaseUrl: $BANK_URL,
|
||||
# exchangeBaseUrl: $EXCHANGE_URL,
|
||||
# merchantBaseUrl: $MERCHANT_URL,
|
||||
# }' \
|
||||
|
@ -398,7 +398,7 @@ echo " DONE"
|
||||
|
||||
echo -n "Setting up merchant"
|
||||
|
||||
curl -H "Content-Type: application/json" -X POST -d '{"auth":{"method":"external"},"payto_uris":["payto://iban/SANDBOXX/DE474361?receiver-name=Merchant43"],"id":"default","name":"default","address":{},"jurisdiction":{},"default_max_wire_fee":"TESTKUDOS:1", "default_max_deposit_fee":"TESTKUDOS:1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_us" : 3600000000},"default_pay_delay":{"d_us": 3600000000}}' http://localhost:9966/management/instances
|
||||
curl -H "Content-Type: application/json" -X POST -d '{"auth":{"method":"external"},"accounts":[{"payto_uri":"payto://iban/SANDBOXX/DE474361?receiver-name=Merchant43"}],"id":"default","name":"default","address":{},"jurisdiction":{},"default_max_wire_fee":"TESTKUDOS:1", "default_max_deposit_fee":"TESTKUDOS:1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_us" : 3600000000},"default_pay_delay":{"d_us": 3600000000}}' http://localhost:9966/management/instances
|
||||
|
||||
|
||||
echo " DONE"
|
||||
@ -411,7 +411,7 @@ taler-wallet-cli --no-throttle --wallet-db=$WALLET_DB api --expect-success 'runI
|
||||
{
|
||||
amountToSpend: "TESTKUDOS:4",
|
||||
amountToWithdraw: "TESTKUDOS:10",
|
||||
bankBaseUrl: $BANK_URL,
|
||||
bankAccessApiBaseUrl: $BANK_URL,
|
||||
exchangeBaseUrl: $EXCHANGE_URL,
|
||||
merchantBaseUrl: $MERCHANT_URL,
|
||||
}' \
|
||||
|
@ -400,7 +400,7 @@ echo " DONE"
|
||||
# Setup merchant
|
||||
echo -n "Setting up merchant"
|
||||
|
||||
curl -H "Content-Type: application/json" -X POST -d '{"auth": {"method": "external"}, "payto_uris":["payto://iban/SANDBOXX/DE474361?receiver-name=Merchant43"],"id":"default","name":"default","address":{},"jurisdiction":{},"default_max_wire_fee":"TESTKUDOS:1", "default_max_deposit_fee":"TESTKUDOS:1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_us" : 3600000000},"default_pay_delay":{"d_us": 3600000000}}' http://localhost:9966/management/instances
|
||||
curl -H "Content-Type: application/json" -X POST -d '{"auth": {"method": "external"}, "accounts":[{"payto_uri":"payto://iban/SANDBOXX/DE474361?receiver-name=Merchant43"}],"id":"default","name":"default","address":{},"jurisdiction":{},"default_max_wire_fee":"TESTKUDOS:1", "default_max_deposit_fee":"TESTKUDOS:1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_us" : 3600000000},"default_pay_delay":{"d_us": 3600000000}}' http://localhost:9966/management/instances
|
||||
|
||||
|
||||
# run wallet CLI
|
||||
@ -410,7 +410,7 @@ taler-wallet-cli --no-throttle --wallet-db=$WALLET_DB api --expect-success 'with
|
||||
"$(jq -n '
|
||||
{
|
||||
amount: "TESTKUDOS:8",
|
||||
bankBaseUrl: $BANK_URL,
|
||||
bankAccessApiBaseUrl: $BANK_URL,
|
||||
exchangeBaseUrl: $EXCHANGE_URL,
|
||||
}' \
|
||||
--arg BANK_URL "$BANK_URL/demobanks/default/access-api/" \
|
||||
|
@ -22,6 +22,8 @@
|
||||
#include <gnunet/gnunet_util_lib.h>
|
||||
#include <jansson.h>
|
||||
#include <microhttpd.h>
|
||||
#include "taler-exchange-httpd_metrics.h"
|
||||
#include "taler_exchangedb_plugin.h"
|
||||
#include "taler_mhd_lib.h"
|
||||
#include "taler-exchange-httpd_mhd.h"
|
||||
#include "taler-exchange-httpd_age-withdraw_reveal.h"
|
||||
@ -387,12 +389,10 @@ denomination_is_valid (
|
||||
struct TEH_DenominationKey *dks,
|
||||
MHD_RESULT *result)
|
||||
{
|
||||
dks = TEH_keys_denomination_by_hash2 (
|
||||
ksh,
|
||||
dks = TEH_keys_denomination_by_hash2 (ksh,
|
||||
denom_h,
|
||||
connection,
|
||||
result);
|
||||
|
||||
if (NULL == dks)
|
||||
{
|
||||
/* The denomination doesn't exist */
|
||||
@ -635,7 +635,7 @@ verify_commitment_and_max_age (
|
||||
}
|
||||
else
|
||||
{
|
||||
/* FIXME:oec: Refactor this block out into its own function */
|
||||
/* FIXME[oec] Refactor this block out into its own function */
|
||||
|
||||
size_t j = (TALER_CNC_KAPPA - 1) * c + k; /* Index into disclosed_coin_secrets[] */
|
||||
const struct TALER_PlanchetMasterSecretP *secret;
|
||||
@ -784,11 +784,48 @@ verify_commitment_and_max_age (
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Send a response for "/age-withdraw/$RCH/reveal"
|
||||
*
|
||||
* @param connection The http connection to the client to send the response to
|
||||
* @param num_coins Number of new coins with age restriction for which we reveal data
|
||||
* @param awrcs array of @a num_coins signatures revealed
|
||||
* @return a MHD result code
|
||||
*/
|
||||
static MHD_RESULT
|
||||
reply_age_withdraw_reveal_success (
|
||||
struct MHD_Connection *connection,
|
||||
unsigned int num_coins,
|
||||
const struct TALER_EXCHANGEDB_AgeWithdrawRevealedCoin *awrcs)
|
||||
{
|
||||
json_t *list = json_array ();
|
||||
GNUNET_assert (NULL != list);
|
||||
|
||||
for (unsigned int index = 0;
|
||||
index < num_coins;
|
||||
index++)
|
||||
{
|
||||
json_t *obj = GNUNET_JSON_PACK (
|
||||
TALER_JSON_pack_blinded_denom_sig ("ev_sig",
|
||||
&awrcs[index].coin_sig));
|
||||
GNUNET_assert (0 ==
|
||||
json_array_append_new (list,
|
||||
obj));
|
||||
}
|
||||
|
||||
return TALER_MHD_REPLY_JSON_PACK (
|
||||
connection,
|
||||
MHD_HTTP_OK,
|
||||
GNUNET_JSON_pack_array_steal ("ev_sigs",
|
||||
list));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Signs and persists the undisclosed coins
|
||||
*
|
||||
* @param connection HTTP-connection to the client
|
||||
* @param h_commitment_orig Original commitment
|
||||
* @param h_commitment Original commitment
|
||||
* @param num_coins Number of coins
|
||||
* @param coin_evs The Hashes of the undisclosed, blinded coins, @a num_coins many
|
||||
* @param denom_keys The array of denomination keys, @a num_coins. Needed to detect Clause-Schnorr-based denominations
|
||||
@ -796,7 +833,7 @@ verify_commitment_and_max_age (
|
||||
* @return GNUNET_OK on success, GNUNET_SYSERR otherwise
|
||||
*/
|
||||
static enum GNUNET_GenericReturnValue
|
||||
finalize_age_withdraw_and_sign (
|
||||
sign_and_finalize_age_withdraw (
|
||||
struct MHD_Connection *connection,
|
||||
const struct TALER_AgeWithdrawCommitmentHashP *h_commitment,
|
||||
const uint32_t num_coins,
|
||||
@ -806,7 +843,9 @@ finalize_age_withdraw_and_sign (
|
||||
{
|
||||
enum GNUNET_GenericReturnValue ret = GNUNET_SYSERR;
|
||||
struct TEH_CoinSignData csds[num_coins];
|
||||
struct TALER_BlindedDenominationSignature bss[num_coins];
|
||||
struct TALER_BlindedDenominationSignature bds[num_coins];
|
||||
struct TALER_EXCHANGEDB_AgeWithdrawRevealedCoin awrcs[num_coins];
|
||||
enum GNUNET_DB_QueryStatus qs;
|
||||
|
||||
for (uint32_t i = 0; i<num_coins; i++)
|
||||
{
|
||||
@ -814,13 +853,13 @@ finalize_age_withdraw_and_sign (
|
||||
csds[i].bp = &coin_evs[i];
|
||||
}
|
||||
|
||||
/* First, sign the the blinded coins */
|
||||
/* Sign the the blinded coins first */
|
||||
{
|
||||
enum TALER_ErrorCode ec;
|
||||
ec = TEH_keys_denomination_batch_sign (csds,
|
||||
num_coins,
|
||||
false,
|
||||
bss);
|
||||
bds);
|
||||
if (TALER_EC_NONE != ec)
|
||||
{
|
||||
GNUNET_break (0);
|
||||
@ -831,12 +870,107 @@ finalize_age_withdraw_and_sign (
|
||||
}
|
||||
}
|
||||
|
||||
/* TODO[oec]:
|
||||
* - in a transaction: save the coins.
|
||||
* - add signature response
|
||||
*/
|
||||
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
|
||||
"Signatures ready, starting DB interaction\n");
|
||||
|
||||
#pragma message "FIXME[oec]: implement finalize_age_withdraw_and_sign"
|
||||
/* Prepare the data for insertion */
|
||||
for (uint32_t i = 0; i<num_coins; i++)
|
||||
{
|
||||
TALER_coin_ev_hash (&coin_evs[i],
|
||||
csds[i].h_denom_pub,
|
||||
&awrcs[i].h_coin_ev);
|
||||
awrcs[i].h_denom_pub = *csds[i].h_denom_pub;
|
||||
awrcs[i].coin_sig = bds[i];
|
||||
}
|
||||
|
||||
/* Persist operation result in DB, transactionally */
|
||||
for (unsigned int r = 0; r < MAX_TRANSACTION_COMMIT_RETRIES; r++)
|
||||
{
|
||||
bool changed = false;
|
||||
|
||||
/* Transaction start */
|
||||
if (GNUNET_OK !=
|
||||
TEH_plugin->start (TEH_plugin->cls,
|
||||
"insert_age_withdraw_reveal batch"))
|
||||
{
|
||||
GNUNET_break (0);
|
||||
ret = TALER_MHD_reply_with_error (connection,
|
||||
MHD_HTTP_INTERNAL_SERVER_ERROR,
|
||||
TALER_EC_GENERIC_DB_START_FAILED,
|
||||
NULL);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
qs = TEH_plugin->insert_age_withdraw_reveal (TEH_plugin->cls,
|
||||
h_commitment,
|
||||
num_coins,
|
||||
awrcs);
|
||||
|
||||
if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
|
||||
{
|
||||
TEH_plugin->rollback (TEH_plugin->cls);
|
||||
continue;
|
||||
}
|
||||
else if (GNUNET_DB_STATUS_HARD_ERROR == qs)
|
||||
{
|
||||
GNUNET_break (0);
|
||||
TEH_plugin->rollback (TEH_plugin->cls);
|
||||
ret = TALER_MHD_reply_with_error (connection,
|
||||
MHD_HTTP_INTERNAL_SERVER_ERROR,
|
||||
TALER_EC_GENERIC_DB_STORE_FAILED,
|
||||
"insert_age_withdraw_reveal");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
changed = (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs);
|
||||
|
||||
/* Commit the transaction */
|
||||
qs = TEH_plugin->commit (TEH_plugin->cls);
|
||||
if (qs >= 0)
|
||||
{
|
||||
if (changed)
|
||||
TEH_METRICS_num_success[TEH_MT_SUCCESS_AGE_WITHDRAW_REVEAL]++;
|
||||
|
||||
break; /* success */
|
||||
|
||||
}
|
||||
else if (GNUNET_DB_STATUS_HARD_ERROR == qs)
|
||||
{
|
||||
GNUNET_break (0);
|
||||
TEH_plugin->rollback (TEH_plugin->cls);
|
||||
ret = TALER_MHD_reply_with_error (connection,
|
||||
MHD_HTTP_INTERNAL_SERVER_ERROR,
|
||||
TALER_EC_GENERIC_DB_COMMIT_FAILED,
|
||||
NULL);
|
||||
goto cleanup;
|
||||
}
|
||||
else
|
||||
{
|
||||
TEH_plugin->rollback (TEH_plugin->cls);
|
||||
}
|
||||
} /* end of retry */
|
||||
|
||||
if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
|
||||
{
|
||||
GNUNET_break (0);
|
||||
TEH_plugin->rollback (TEH_plugin->cls);
|
||||
ret = TALER_MHD_reply_with_error (connection,
|
||||
MHD_HTTP_INTERNAL_SERVER_ERROR,
|
||||
TALER_EC_GENERIC_DB_SOFT_FAILURE,
|
||||
NULL);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* Generate final (positive) response */
|
||||
ret = reply_age_withdraw_reveal_success (connection,
|
||||
num_coins,
|
||||
awrcs);
|
||||
cleanup:
|
||||
GNUNET_break (GNUNET_OK != ret);
|
||||
|
||||
/* Free resources */
|
||||
for (unsigned int i = 0; i<num_coins; i++)
|
||||
TALER_blinded_denom_sig_free (&awrcs[i].coin_sig);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -922,7 +1056,7 @@ TEH_handler_age_withdraw_reveal (
|
||||
break;
|
||||
|
||||
/* Finally, sign and persist the coins */
|
||||
if (GNUNET_OK != finalize_age_withdraw_and_sign (
|
||||
if (GNUNET_OK != sign_and_finalize_age_withdraw (
|
||||
rc->connection,
|
||||
&actx.commitment.h_commitment,
|
||||
actx.num_coins,
|
||||
|
@ -2377,9 +2377,10 @@ finish_keys_response (struct TEH_KeyStateHandle *ksh)
|
||||
}
|
||||
|
||||
GNUNET_CONTAINER_multihashmap_iterator_destroy (iter);
|
||||
GNUNET_CONTAINER_multihashmap_destroy (denominations_by_group);
|
||||
|
||||
}
|
||||
|
||||
GNUNET_CONTAINER_multihashmap_destroy (denominations_by_group);
|
||||
}
|
||||
|
||||
GNUNET_CONTAINER_heap_destroy (heap);
|
||||
|
@ -61,7 +61,8 @@ enum TEH_MetricTypeSuccess
|
||||
TEH_MT_SUCCESS_BATCH_WITHDRAW = 3,
|
||||
TEH_MT_SUCCESS_MELT = 4,
|
||||
TEH_MT_SUCCESS_REFRESH_REVEAL = 5,
|
||||
TEH_MT_SUCCESS_COUNT = 6 /* MUST BE LAST! */
|
||||
TEH_MT_SUCCESS_AGE_WITHDRAW_REVEAL = 6,
|
||||
TEH_MT_SUCCESS_COUNT = 7 /* MUST BE LAST! */
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -773,12 +773,17 @@ clean_age:
|
||||
NULL);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i<rctx->num_fresh_coins; i++)
|
||||
{
|
||||
rrcs[i].coin_sig = bss[i];
|
||||
rrcs[i].blinded_planchet = rcds[i].blinded_planchet;
|
||||
}
|
||||
}
|
||||
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
|
||||
"Signatures ready, starting DB interaction\n");
|
||||
|
||||
|
||||
for (unsigned int r = 0; r<MAX_TRANSACTION_COMMIT_RETRIES; r++)
|
||||
{
|
||||
bool changed;
|
||||
@ -795,12 +800,7 @@ clean_age:
|
||||
NULL);
|
||||
goto cleanup;
|
||||
}
|
||||
for (unsigned int i = 0; i<rctx->num_fresh_coins; i++)
|
||||
{
|
||||
struct TALER_EXCHANGEDB_RefreshRevealedCoin *rrc = &rrcs[i];
|
||||
|
||||
rrc->blinded_planchet = rcds[i].blinded_planchet;
|
||||
}
|
||||
qs = TEH_plugin->insert_refresh_reveal (
|
||||
TEH_plugin->cls,
|
||||
melt_serial_id,
|
||||
|
@ -14,24 +14,24 @@
|
||||
-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
|
||||
--
|
||||
|
||||
CREATE FUNCTION create_table_withdraw_age_commitments(
|
||||
CREATE FUNCTION create_table_age_withdraw_commitments(
|
||||
IN partition_suffix VARCHAR DEFAULT NULL
|
||||
)
|
||||
RETURNS VOID
|
||||
LANGUAGE plpgsql
|
||||
AS $$
|
||||
DECLARE
|
||||
table_name VARCHAR DEFAULT 'withdraw_age_commitments';
|
||||
table_name VARCHAR DEFAULT 'age_withdraw_commitments';
|
||||
BEGIN
|
||||
PERFORM create_partitioned_table(
|
||||
'CREATE TABLE %I'
|
||||
'(withdraw_age_commitment_id BIGINT GENERATED BY DEFAULT AS IDENTITY'
|
||||
',h_commitment BYTEA PRIMARY KEY CHECK (LENGTH(h_commitment)=64)'
|
||||
'(age_withdraw_commitment_id BIGINT GENERATED BY DEFAULT AS IDENTITY'
|
||||
',h_commitment BYTEA CHECK (LENGTH(h_commitment)=64)'
|
||||
',amount_with_fee_val INT8 NOT NULL'
|
||||
',amount_with_fee_frac INT4 NOT NULL'
|
||||
',max_age INT2 NOT NULL'
|
||||
',reserve_pub BYTEA NOT NULL CHECK (LENGTH(reserve_pub)=32)'
|
||||
',reserve_sig BYTEA CHECK (LENGTH(reserve_sig)=64)'
|
||||
',reserve_pub BYTEA CHECK (LENGTH(reserve_pub)=32)'
|
||||
',reserve_sig BYTEA NOT NULL CHECK (LENGTH(reserve_sig)=64)'
|
||||
',noreveal_index INT4 NOT NULL'
|
||||
') %s ;'
|
||||
,table_name
|
||||
@ -77,42 +77,46 @@ END
|
||||
$$;
|
||||
|
||||
|
||||
CREATE FUNCTION constrain_table_withdraw_age_commitments(
|
||||
CREATE FUNCTION constrain_table_age_withdraw_commitments(
|
||||
IN partition_suffix VARCHAR
|
||||
)
|
||||
RETURNS void
|
||||
LANGUAGE plpgsql
|
||||
AS $$
|
||||
DECLARE
|
||||
table_name VARCHAR DEFAULT 'withdraw_age_commitments';
|
||||
table_name VARCHAR DEFAULT 'age_withdraw_commitments';
|
||||
BEGIN
|
||||
table_name = concat_ws('_', table_name, partition_suffix);
|
||||
|
||||
EXECUTE FORMAT (
|
||||
'ALTER TABLE ' || table_name ||
|
||||
' ADD PRIMARY KEY (h_commitment, reserve_pub);'
|
||||
' ADD PRIMARY KEY (h_commitment);'
|
||||
);
|
||||
EXECUTE FORMAT (
|
||||
'ALTER TABLE ' || table_name ||
|
||||
' ADD CONSTRAINT ' || table_name || '_withdraw_age_commitment_id_key'
|
||||
' UNIQUE (withdraw_age_commitment_id);'
|
||||
' ADD CONSTRAINT ' || table_name || '_h_commitment_reserve_pub_key'
|
||||
' UNIQUE (h_commitment, reserve_pub);'
|
||||
);
|
||||
EXECUTE FORMAT (
|
||||
'ALTER TABLE ' || table_name ||
|
||||
' ADD CONSTRAINT ' || table_name || '_age_withdraw_commitment_id_key'
|
||||
' UNIQUE (age_withdraw_commitment_id);'
|
||||
);
|
||||
END
|
||||
$$;
|
||||
|
||||
|
||||
CREATE FUNCTION foreign_table_withdraw_age_commitments()
|
||||
CREATE FUNCTION foreign_table_age_withdraw_commitments()
|
||||
RETURNS void
|
||||
LANGUAGE plpgsql
|
||||
AS $$
|
||||
DECLARE
|
||||
table_name VARCHAR DEFAULT 'withdraw_age_commitments';
|
||||
table_name VARCHAR DEFAULT 'age_withdraw_commitments';
|
||||
BEGIN
|
||||
EXECUTE FORMAT (
|
||||
'ALTER TABLE ' || table_name ||
|
||||
' ADD CONSTRAINT ' || table_name || '_foreign_reserve_pub'
|
||||
' FOREIGN KEY (reserve_pub)'
|
||||
' REFERENCES reserves (reserve_pub) ON DELETE CASCADE;'
|
||||
' REFERENCES reserves(reserve_pub) ON DELETE CASCADE;'
|
||||
);
|
||||
END
|
||||
$$;
|
||||
@ -124,19 +128,7 @@ INSERT INTO exchange_tables
|
||||
,action
|
||||
,partitioned
|
||||
,by_range)
|
||||
VALUES
|
||||
('withdraw_age_commitments'
|
||||
,'exchange-0003'
|
||||
,'create'
|
||||
,TRUE
|
||||
,FALSE),
|
||||
('withdraw_age_commitments'
|
||||
,'exchange-0003'
|
||||
,'constrain'
|
||||
,TRUE
|
||||
,FALSE),
|
||||
('withdraw_age_commitments'
|
||||
,'exchange-0003'
|
||||
,'foreign'
|
||||
,TRUE
|
||||
,FALSE);
|
||||
VALUES
|
||||
('age_withdraw_commitments', 'exchange-0003', 'create', TRUE ,FALSE),
|
||||
('age_withdraw_commitments', 'exchange-0003', 'constrain',TRUE ,FALSE),
|
||||
('age_withdraw_commitments', 'exchange-0003', 'foreign', TRUE ,FALSE);
|
@ -14,25 +14,24 @@
|
||||
-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
|
||||
--
|
||||
|
||||
CREATE FUNCTION create_table_withdraw_age_revealed_coins(
|
||||
CREATE FUNCTION create_table_age_withdraw_revealed_coins(
|
||||
IN partition_suffix VARCHAR DEFAULT NULL
|
||||
)
|
||||
RETURNS VOID
|
||||
LANGUAGE plpgsql
|
||||
AS $$
|
||||
DECLARE
|
||||
table_name VARCHAR DEFAULT 'withdraw_age_revealed_coins';
|
||||
table_name VARCHAR DEFAULT 'age_withdraw_revealed_coins';
|
||||
BEGIN
|
||||
PERFORM create_partitioned_table(
|
||||
'CREATE TABLE %I'
|
||||
'(withdraw_age_revealed_coins_id BIGINT GENERATED BY DEFAULT AS IDENTITY' -- UNIQUE
|
||||
'(age_withdraw_revealed_coins_id BIGINT GENERATED BY DEFAULT AS IDENTITY' -- UNIQUE
|
||||
',h_commitment BYTEA NOT NULL CHECK (LENGTH(h_commitment)=64)'
|
||||
',freshcoin_index INT4 NOT NULL'
|
||||
',denominations_serial INT8 NOT NULL'
|
||||
',coin_ev BYTEA NOT NULL'
|
||||
',h_coin_ev BYTEA CHECK (LENGTH(h_coin_ev)=64)'
|
||||
',ev_sig BYTEA NOT NULL'
|
||||
',ewv BYTEA NOT NULL'
|
||||
') %s ;'
|
||||
,table_name
|
||||
,'PARTITION BY HASH (h_commitment)'
|
||||
@ -79,30 +78,24 @@ BEGIN
|
||||
,table_name
|
||||
,partition_suffix
|
||||
);
|
||||
PERFORM comment_partitioned_column(
|
||||
'Exchange contributed values in the creation of the fresh coin (see /csr)'
|
||||
,'ewv'
|
||||
,table_name
|
||||
,partition_suffix
|
||||
);
|
||||
END
|
||||
$$;
|
||||
|
||||
CREATE FUNCTION constrain_table_withdraw_age_revealed_coins(
|
||||
CREATE FUNCTION constrain_table_age_withdraw_revealed_coins(
|
||||
IN partition_suffix VARCHAR
|
||||
)
|
||||
RETURNS void
|
||||
LANGUAGE plpgsql
|
||||
AS $$
|
||||
DECLARE
|
||||
table_name VARCHAR DEFAULT 'withdraw_age_revealed_coins';
|
||||
table_name VARCHAR DEFAULT 'age_withdraw_revealed_coins';
|
||||
BEGIN
|
||||
table_name = concat_ws('_', table_name, partition_suffix);
|
||||
|
||||
EXECUTE FORMAT (
|
||||
'ALTER TABLE ' || table_name ||
|
||||
' ADD CONSTRAINT ' || table_name || '_withdraw_age_revealed_coins_id_key'
|
||||
' UNIQUE (withdraw_age_revealed_coins_id);'
|
||||
' ADD CONSTRAINT ' || table_name || '_age_withdraw_revealed_coins_id_key'
|
||||
' UNIQUE (age_withdraw_revealed_coins_id);'
|
||||
);
|
||||
EXECUTE FORMAT (
|
||||
'ALTER TABLE ' || table_name ||
|
||||
@ -112,18 +105,18 @@ BEGIN
|
||||
END
|
||||
$$;
|
||||
|
||||
CREATE FUNCTION foreign_table_withdraw_age_revealed_coins()
|
||||
CREATE FUNCTION foreign_table_age_withdraw_revealed_coins()
|
||||
RETURNS void
|
||||
LANGUAGE plpgsql
|
||||
AS $$
|
||||
DECLARE
|
||||
table_name VARCHAR DEFAULT 'withdraw_age_revealed_coins';
|
||||
table_name VARCHAR DEFAULT 'age_withdraw_revealed_coins';
|
||||
BEGIN
|
||||
EXECUTE FORMAT (
|
||||
'ALTER TABLE ' || table_name ||
|
||||
' ADD CONSTRAINT ' || table_name || '_foreign_h_commitment'
|
||||
' FOREIGN KEY (h_commitment)'
|
||||
' REFERENCES withdraw_age_commitments (h_commitment) ON DELETE CASCADE;'
|
||||
' REFERENCES age_withdraw_commitments (h_commitment) ON DELETE CASCADE;'
|
||||
);
|
||||
EXECUTE FORMAT (
|
||||
'ALTER TABLE ' || table_name ||
|
||||
@ -142,17 +135,17 @@ INSERT INTO exchange_tables
|
||||
,partitioned
|
||||
,by_range)
|
||||
VALUES
|
||||
('withdraw_age_revealed_coins'
|
||||
('age_withdraw_revealed_coins'
|
||||
,'exchange-0003'
|
||||
,'create'
|
||||
,TRUE
|
||||
,FALSE),
|
||||
('withdraw_age_revealed_coins'
|
||||
('age_withdraw_revealed_coins'
|
||||
,'exchange-0003'
|
||||
,'constrain'
|
||||
,TRUE
|
||||
,FALSE),
|
||||
('withdraw_age_revealed_coins'
|
||||
('age_withdraw_revealed_coins'
|
||||
,'exchange-0003'
|
||||
,'foreign'
|
||||
,TRUE
|
@ -25,6 +25,8 @@ SET search_path TO exchange;
|
||||
#include "0003-aml_status.sql"
|
||||
#include "0003-aml_staff.sql"
|
||||
#include "0003-aml_history.sql"
|
||||
#include "0003-age_withdraw_commitments.sql"
|
||||
#include "0003-age_withdraw_reveals.sql"
|
||||
|
||||
|
||||
COMMIT;
|
||||
|
@ -69,7 +69,7 @@ TEH_PG_get_age_withdraw_info (
|
||||
",amount_with_fee_val"
|
||||
",amount_with_fee_frac"
|
||||
",noreveal_index"
|
||||
" FROM withdraw_age_commitments"
|
||||
" FROM age_withdraw_commitments"
|
||||
" WHERE reserve_pub=$1 and h_commitment=$2;");
|
||||
return GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
|
||||
"get_age_withdraw_info",
|
||||
|
@ -42,8 +42,8 @@ TEH_PG_insert_age_withdraw_reveal (
|
||||
/* TODO */
|
||||
#if 0
|
||||
PREPARE (pg,
|
||||
"insert_withdraw_age_revealed_coin",
|
||||
"INSERT INTO withdraw_age_reveals "
|
||||
"insert_age_withdraw_revealed_coin",
|
||||
"INSERT INTO age_withdraw_reveals "
|
||||
"(h_commitment "
|
||||
",freshcoin_index "
|
||||
",denominations_serial "
|
||||
|
@ -24,15 +24,13 @@
|
||||
#include "taler_util.h"
|
||||
#include "taler_json_lib.h"
|
||||
#include "taler_exchangedb_plugin.h"
|
||||
|
||||
/**
|
||||
* Store in the database which coin(s) the wallet wanted to create
|
||||
* in a given age-withdraw operation and all of the other information
|
||||
* we learned or created in the /age-withdraw/reveal step.
|
||||
* @brief Store in the database which coin(s) the wallet wanted to create in a
|
||||
* given age-withdraw operation and all of the other information we learned or
|
||||
* created in the /age-withdraw/reveal step.
|
||||
*
|
||||
* @param cls the @e cls of this struct with the plugin-specific state
|
||||
* @param h_commitment The commitment of the original age-withdraw request
|
||||
* @param num_coins The number of revealed coins
|
||||
* @param revealed_coins The coins
|
||||
* TODO:oec
|
||||
* @return query status for the transaction
|
||||
*/
|
||||
|
@ -2062,39 +2062,39 @@ irbt_cb_table_purse_deletion (struct PostgresClosure *pg,
|
||||
|
||||
|
||||
/**
|
||||
* Function called with withdraw_age_commitments records to insert into table.
|
||||
* Function called with age_withdraw_commitments records to insert into table.
|
||||
*
|
||||
* @param pg plugin context
|
||||
* @param td record to insert
|
||||
*/
|
||||
static enum GNUNET_DB_QueryStatus
|
||||
irbt_cb_table_withdraw_age_commitments (struct PostgresClosure *pg,
|
||||
irbt_cb_table_age_withdraw_commitments (struct PostgresClosure *pg,
|
||||
const struct
|
||||
TALER_EXCHANGEDB_TableData *td)
|
||||
{
|
||||
struct GNUNET_PQ_QueryParam params[] = {
|
||||
GNUNET_PQ_query_param_uint64 (&td->serial),
|
||||
GNUNET_PQ_query_param_auto_from_type (
|
||||
&td->details.withdraw_age_commitments.h_commitment),
|
||||
&td->details.age_withdraw_commitments.h_commitment),
|
||||
TALER_PQ_query_param_amount (
|
||||
&td->details.withdraw_age_commitments.amount_with_fee),
|
||||
&td->details.age_withdraw_commitments.amount_with_fee),
|
||||
GNUNET_PQ_query_param_uint16 (
|
||||
&td->details.withdraw_age_commitments.max_age),
|
||||
&td->details.age_withdraw_commitments.max_age),
|
||||
GNUNET_PQ_query_param_auto_from_type (
|
||||
&td->details.withdraw_age_commitments.reserve_pub),
|
||||
&td->details.age_withdraw_commitments.reserve_pub),
|
||||
GNUNET_PQ_query_param_auto_from_type (
|
||||
&td->details.withdraw_age_commitments.reserve_sig),
|
||||
&td->details.age_withdraw_commitments.reserve_sig),
|
||||
GNUNET_PQ_query_param_uint32 (
|
||||
&td->details.withdraw_age_commitments.noreveal_index),
|
||||
&td->details.age_withdraw_commitments.noreveal_index),
|
||||
GNUNET_PQ_query_param_absolute_time (
|
||||
&td->details.withdraw_age_commitments.timestamp),
|
||||
&td->details.age_withdraw_commitments.timestamp),
|
||||
GNUNET_PQ_query_param_end
|
||||
};
|
||||
|
||||
PREPARE (pg,
|
||||
"insert_into_table_withdraw_age_commitments",
|
||||
"INSERT INTO withdraw_age_commitments"
|
||||
"(withdraw_age_commitment_id"
|
||||
"insert_into_table_age_withdraw_commitments",
|
||||
"INSERT INTO age_withdraw_commitments"
|
||||
"(age_withdraw_commitment_id"
|
||||
",h_commitment"
|
||||
",amount_with_fee_val"
|
||||
",amount_with_fee_frac"
|
||||
@ -2106,19 +2106,19 @@ irbt_cb_table_withdraw_age_commitments (struct PostgresClosure *pg,
|
||||
") VALUES "
|
||||
"($1, $2, $3, $4, $5, $6, $7, $8, $9);");
|
||||
return GNUNET_PQ_eval_prepared_non_select (pg->conn,
|
||||
"insert_into_table_withdraw_age_commitments",
|
||||
"insert_into_table_age_withdraw_commitments",
|
||||
params);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function called with withdraw_age_revealed_coins records to insert into table.
|
||||
* Function called with age_withdraw_revealed_coins records to insert into table.
|
||||
*
|
||||
* @param pg plugin context
|
||||
* @param td record to insert
|
||||
*/
|
||||
static enum GNUNET_DB_QueryStatus
|
||||
irbt_cb_table_withdraw_age_revealed_coins (struct PostgresClosure *pg,
|
||||
irbt_cb_table_age_withdraw_revealed_coins (struct PostgresClosure *pg,
|
||||
const struct
|
||||
TALER_EXCHANGEDB_TableData *td)
|
||||
{
|
||||
@ -2126,26 +2126,24 @@ irbt_cb_table_withdraw_age_revealed_coins (struct PostgresClosure *pg,
|
||||
struct GNUNET_PQ_QueryParam params[] = {
|
||||
GNUNET_PQ_query_param_uint64 (&td->serial),
|
||||
GNUNET_PQ_query_param_auto_from_type (
|
||||
&td->details.withdraw_age_revealed_coins.h_commitment),
|
||||
&td->details.age_withdraw_revealed_coins.h_commitment),
|
||||
GNUNET_PQ_query_param_uint32 (
|
||||
&td->details.withdraw_age_revealed_coins.freshcoin_index),
|
||||
&td->details.age_withdraw_revealed_coins.freshcoin_index),
|
||||
GNUNET_PQ_query_param_uint64 (
|
||||
&td->details.withdraw_age_revealed_coins.denominations_serial),
|
||||
&td->details.age_withdraw_revealed_coins.denominations_serial),
|
||||
GNUNET_PQ_query_param_fixed_size (
|
||||
td->details.withdraw_age_revealed_coins.coin_ev,
|
||||
td->details.withdraw_age_revealed_coins.coin_ev_size),
|
||||
td->details.age_withdraw_revealed_coins.coin_ev,
|
||||
td->details.age_withdraw_revealed_coins.coin_ev_size),
|
||||
GNUNET_PQ_query_param_auto_from_type (&h_coin_ev),
|
||||
TALER_PQ_query_param_blinded_denom_sig (
|
||||
&td->details.withdraw_age_revealed_coins.ev_sig),
|
||||
TALER_PQ_query_param_exchange_withdraw_values (
|
||||
&td->details.withdraw_age_revealed_coins.ewv),
|
||||
&td->details.age_withdraw_revealed_coins.ev_sig),
|
||||
GNUNET_PQ_query_param_end
|
||||
};
|
||||
|
||||
PREPARE (pg,
|
||||
"insert_into_table_withdraw_age_revealed_coins",
|
||||
"INSERT INTO withdraw_age_revealed_coins"
|
||||
"(withdraw_age_revealed_coins_id"
|
||||
"insert_into_table_age_withdraw_revealed_coins",
|
||||
"INSERT INTO age_withdraw_revealed_coins"
|
||||
"(age_withdraw_revealed_coins_id"
|
||||
",h_commitment"
|
||||
",freshcoin_index"
|
||||
",denominations_serial"
|
||||
@ -2156,12 +2154,12 @@ irbt_cb_table_withdraw_age_revealed_coins (struct PostgresClosure *pg,
|
||||
") VALUES "
|
||||
"($1, $2, $3, $4, $5, $6, $7, $8);");
|
||||
|
||||
GNUNET_CRYPTO_hash (td->details.withdraw_age_revealed_coins.coin_ev,
|
||||
td->details.withdraw_age_revealed_coins.coin_ev_size,
|
||||
GNUNET_CRYPTO_hash (td->details.age_withdraw_revealed_coins.coin_ev,
|
||||
td->details.age_withdraw_revealed_coins.coin_ev_size,
|
||||
&h_coin_ev);
|
||||
|
||||
return GNUNET_PQ_eval_prepared_non_select (pg->conn,
|
||||
"insert_into_table_withdraw_age_revealed_coins",
|
||||
"insert_into_table_age_withdraw_revealed_coins",
|
||||
params);
|
||||
}
|
||||
|
||||
@ -2314,10 +2312,10 @@ TEH_PG_insert_records_by_table (void *cls,
|
||||
rh = &irbt_cb_table_purse_deletion;
|
||||
break;
|
||||
case TALER_EXCHANGEDB_RT_WITHDRAW_AGE_COMMITMENTS:
|
||||
rh = &irbt_cb_table_withdraw_age_commitments;
|
||||
rh = &irbt_cb_table_age_withdraw_commitments;
|
||||
break;
|
||||
case TALER_EXCHANGEDB_RT_WITHDRAW_AGE_REVEALED_COINS:
|
||||
rh = &irbt_cb_table_withdraw_age_revealed_coins;
|
||||
rh = &irbt_cb_table_age_withdraw_revealed_coins;
|
||||
break;
|
||||
}
|
||||
if (NULL == rh)
|
||||
|
@ -2767,14 +2767,14 @@ lrbt_cb_table_purse_deletion (void *cls,
|
||||
|
||||
|
||||
/**
|
||||
* Function called with withdraw_age_commitments table entries.
|
||||
* Function called with age_withdraw_commitments table entries.
|
||||
*
|
||||
* @param cls closure
|
||||
* @param result the postgres result
|
||||
* @param num_results the number of results in @a result
|
||||
*/
|
||||
static void
|
||||
lrbt_cb_table_withdraw_age_commitments (void *cls,
|
||||
lrbt_cb_table_age_withdraw_commitments (void *cls,
|
||||
PGresult *result,
|
||||
unsigned int num_results)
|
||||
{
|
||||
@ -2788,26 +2788,26 @@ lrbt_cb_table_withdraw_age_commitments (void *cls,
|
||||
{
|
||||
struct GNUNET_PQ_ResultSpec rs[] = {
|
||||
GNUNET_PQ_result_spec_uint64 (
|
||||
"withdraw_age_commitment_id",
|
||||
"age_withdraw_commitment_id",
|
||||
&td.serial),
|
||||
GNUNET_PQ_result_spec_auto_from_type (
|
||||
"h_commitment",
|
||||
&td.details.withdraw_age_commitments.h_commitment),
|
||||
&td.details.age_withdraw_commitments.h_commitment),
|
||||
GNUNET_PQ_result_spec_uint16 (
|
||||
"max_age",
|
||||
&td.details.withdraw_age_commitments.max_age),
|
||||
&td.details.age_withdraw_commitments.max_age),
|
||||
TALER_PQ_RESULT_SPEC_AMOUNT (
|
||||
"amount_with_fee",
|
||||
&td.details.withdraw_age_commitments.amount_with_fee),
|
||||
&td.details.age_withdraw_commitments.amount_with_fee),
|
||||
GNUNET_PQ_result_spec_auto_from_type (
|
||||
"reserve_pub",
|
||||
&td.details.withdraw_age_commitments.reserve_pub),
|
||||
&td.details.age_withdraw_commitments.reserve_pub),
|
||||
GNUNET_PQ_result_spec_auto_from_type (
|
||||
"reserve_sig",
|
||||
&td.details.withdraw_age_commitments.reserve_sig),
|
||||
&td.details.age_withdraw_commitments.reserve_sig),
|
||||
GNUNET_PQ_result_spec_uint32 (
|
||||
"noreveal_index",
|
||||
&td.details.withdraw_age_commitments.noreveal_index),
|
||||
&td.details.age_withdraw_commitments.noreveal_index),
|
||||
GNUNET_PQ_result_spec_end
|
||||
};
|
||||
|
||||
@ -2828,14 +2828,14 @@ lrbt_cb_table_withdraw_age_commitments (void *cls,
|
||||
|
||||
|
||||
/**
|
||||
* Function called with withdraw_age_revealed_coins table entries.
|
||||
* Function called with age_withdraw_revealed_coins table entries.
|
||||
*
|
||||
* @param cls closure
|
||||
* @param result the postgres result
|
||||
* @param num_results the number of results in @a result
|
||||
*/
|
||||
static void
|
||||
lrbt_cb_table_withdraw_age_revealed_coins (void *cls,
|
||||
lrbt_cb_table_age_withdraw_revealed_coins (void *cls,
|
||||
PGresult *result,
|
||||
unsigned int num_results)
|
||||
{
|
||||
@ -2848,22 +2848,22 @@ lrbt_cb_table_withdraw_age_revealed_coins (void *cls,
|
||||
{
|
||||
struct GNUNET_PQ_ResultSpec rs[] = {
|
||||
GNUNET_PQ_result_spec_uint64 (
|
||||
"withdraw_age_revealed_coins_id",
|
||||
"age_withdraw_revealed_coins_id",
|
||||
&td.serial),
|
||||
GNUNET_PQ_result_spec_auto_from_type (
|
||||
"h_commitment",
|
||||
&td.details.withdraw_age_revealed_coins.h_commitment),
|
||||
&td.details.age_withdraw_revealed_coins.h_commitment),
|
||||
GNUNET_PQ_result_spec_uint32 (
|
||||
"freshcoin_index",
|
||||
&td.details.withdraw_age_revealed_coins.freshcoin_index),
|
||||
&td.details.age_withdraw_revealed_coins.freshcoin_index),
|
||||
GNUNET_PQ_result_spec_uint64 (
|
||||
"denominations_serial",
|
||||
&td.details.withdraw_age_revealed_coins.denominations_serial),
|
||||
&td.details.age_withdraw_revealed_coins.denominations_serial),
|
||||
/* Note: h_coin_ev is recalculated */
|
||||
GNUNET_PQ_result_spec_variable_size (
|
||||
"coin_ev",
|
||||
(void **) &td.details.withdraw_age_revealed_coins.coin_ev,
|
||||
&td.details.withdraw_age_revealed_coins.coin_ev_size),
|
||||
(void **) &td.details.age_withdraw_revealed_coins.coin_ev,
|
||||
&td.details.age_withdraw_revealed_coins.coin_ev_size),
|
||||
TALER_PQ_result_spec_blinded_denom_sig (
|
||||
"ev_sig",
|
||||
&td.details.refresh_revealed_coins.ev_sig),
|
||||
@ -3598,9 +3598,9 @@ TEH_PG_lookup_records_by_table (void *cls,
|
||||
rh = &lrbt_cb_table_purse_deletion;
|
||||
break;
|
||||
case TALER_EXCHANGEDB_RT_WITHDRAW_AGE_COMMITMENTS:
|
||||
XPREPARE ("select_above_serial_by_table_withdraw_age_commitments",
|
||||
XPREPARE ("select_above_serial_by_table_age_withdraw_commitments",
|
||||
"SELECT"
|
||||
" withdraw_age_commitment_id"
|
||||
" age_withdraw_commitment_id"
|
||||
",h_commitment"
|
||||
",amount_with_fee_val"
|
||||
",amount_with_fee_frac"
|
||||
@ -3608,15 +3608,15 @@ TEH_PG_lookup_records_by_table (void *cls,
|
||||
",reserve_pub"
|
||||
",reserve_sig"
|
||||
",noreveal_index"
|
||||
" FROM withdraw_age_commitments"
|
||||
" WHERE withdraw_age_commitment_id > $1"
|
||||
" ORDER BY withdraw_age_commitment_id ASC;");
|
||||
rh = &lrbt_cb_table_withdraw_age_commitments;
|
||||
" FROM age_withdraw_commitments"
|
||||
" WHERE age_withdraw_commitment_id > $1"
|
||||
" ORDER BY age_withdraw_commitment_id ASC;");
|
||||
rh = &lrbt_cb_table_age_withdraw_commitments;
|
||||
break;
|
||||
case TALER_EXCHANGEDB_RT_WITHDRAW_AGE_REVEALED_COINS:
|
||||
XPREPARE ("select_above_serial_by_table_withdraw_age_revealed_coins",
|
||||
XPREPARE ("select_above_serial_by_table_age_withdraw_revealed_coins",
|
||||
"SELECT"
|
||||
" withdraw_age_revealed_coins_serial_id"
|
||||
" age_withdraw_revealed_coins_serial_id"
|
||||
",h_commitment"
|
||||
",freshcoin_index"
|
||||
",denominations_serial"
|
||||
@ -3624,10 +3624,10 @@ TEH_PG_lookup_records_by_table (void *cls,
|
||||
",h_coin_ev"
|
||||
",ev_sig"
|
||||
",ewv"
|
||||
" FROM withdraw_age_revealed_coins"
|
||||
" WHERE withdraw_age_revealed_coins_serial_id > $1"
|
||||
" ORDER BY withdraw_age_revealed_coins_serial_id ASC;");
|
||||
rh = &lrbt_cb_table_withdraw_age_revealed_coins;
|
||||
" FROM age_withdraw_revealed_coins"
|
||||
" WHERE age_withdraw_revealed_coins_serial_id > $1"
|
||||
" ORDER BY age_withdraw_revealed_coins_serial_id ASC;");
|
||||
rh = &lrbt_cb_table_age_withdraw_revealed_coins;
|
||||
break;
|
||||
}
|
||||
if (NULL == rh)
|
||||
|
@ -427,22 +427,22 @@ TEH_PG_lookup_serial_by_table (void *cls,
|
||||
statement = "select_serial_by_table_purse_deletion";
|
||||
break;
|
||||
case TALER_EXCHANGEDB_RT_WITHDRAW_AGE_COMMITMENTS:
|
||||
XPREPARE ("select_serial_by_table_withdraw_age_commitments",
|
||||
XPREPARE ("select_serial_by_table_age_withdraw_commitments",
|
||||
"SELECT"
|
||||
" withdraw_age_commitment_id AS serial"
|
||||
" FROM withdraw_age_commitments"
|
||||
" ORDER BY withdraw_age_commitment_id DESC"
|
||||
" age_withdraw_commitment_id AS serial"
|
||||
" FROM age_withdraw_commitments"
|
||||
" ORDER BY age_withdraw_commitment_id DESC"
|
||||
" LIMIT 1;");
|
||||
statement = "select_serial_by_table_withdraw_age_commitments";
|
||||
statement = "select_serial_by_table_age_withdraw_commitments";
|
||||
break;
|
||||
case TALER_EXCHANGEDB_RT_WITHDRAW_AGE_REVEALED_COINS:
|
||||
XPREPARE ("select_serial_by_table_withdraw_age_revealed_coins",
|
||||
XPREPARE ("select_serial_by_table_age_withdraw_revealed_coins",
|
||||
"SELECT"
|
||||
" withdraw_age_revealed_coins_id AS serial"
|
||||
" FROM withdraw_age_revealed_coins"
|
||||
" ORDER BY withdraw_age_revealed_coins_id DESC"
|
||||
" age_withdraw_revealed_coins_id AS serial"
|
||||
" FROM age_withdraw_revealed_coins"
|
||||
" ORDER BY age_withdraw_revealed_coins_id DESC"
|
||||
" LIMIT 1;");
|
||||
statement = "select_serial_by_table_withdraw_age_revealed_coins";
|
||||
statement = "select_serial_by_table_age_withdraw_revealed_coins";
|
||||
break;
|
||||
}
|
||||
if (NULL == statement)
|
||||
|
@ -760,7 +760,7 @@ struct TALER_EXCHANGEDB_TableData
|
||||
struct TALER_ReserveSignatureP reserve_sig;
|
||||
uint32_t noreveal_index;
|
||||
struct GNUNET_TIME_Absolute timestamp;
|
||||
} withdraw_age_commitments;
|
||||
} age_withdraw_commitments;
|
||||
|
||||
struct
|
||||
{
|
||||
@ -769,10 +769,9 @@ struct TALER_EXCHANGEDB_TableData
|
||||
uint64_t denominations_serial;
|
||||
void *coin_ev;
|
||||
size_t coin_ev_size;
|
||||
struct TALER_ExchangeWithdrawValues ewv;
|
||||
// h_coin_ev omitted, to be recomputed!
|
||||
struct TALER_BlindedDenominationSignature ev_sig;
|
||||
} withdraw_age_revealed_coins;
|
||||
} age_withdraw_revealed_coins;
|
||||
|
||||
} details;
|
||||
|
||||
@ -1200,8 +1199,9 @@ struct TALER_EXCHANGEDB_AgeWithdrawCommitment
|
||||
struct TALER_ReservePublicKeyP reserve_pub;
|
||||
|
||||
/**
|
||||
* Signature confirming the age withdrawal, matching @e reserve_pub, @e
|
||||
* maximum_age_group and @e h_commitment and @e total_amount_with_fee.
|
||||
* Signature confirming the age withdrawal commitment, matching @e
|
||||
* reserve_pub, @e maximum_age_group and @e h_commitment and @e
|
||||
* total_amount_with_fee.
|
||||
*/
|
||||
struct TALER_ReserveSignatureP reserve_sig;
|
||||
|
||||
@ -2737,6 +2737,28 @@ struct TALER_EXCHANGEDB_CsRevealFreshCoinData
|
||||
uint32_t coin_off;
|
||||
};
|
||||
|
||||
/**
|
||||
* Information about a coin that was revealed to the exchange
|
||||
* during reveal.
|
||||
*/
|
||||
struct TALER_EXCHANGEDB_AgeWithdrawRevealedCoin
|
||||
{
|
||||
/**
|
||||
* Hash of the public denomination key of the coin.
|
||||
*/
|
||||
struct TALER_DenominationHashP h_denom_pub;
|
||||
|
||||
/**
|
||||
* Signature generated by the exchange over the coin (in blinded format).
|
||||
*/
|
||||
struct TALER_BlindedDenominationSignature coin_sig;
|
||||
|
||||
/**
|
||||
* Blinded hash of the new coin
|
||||
*/
|
||||
struct TALER_BlindedCoinHashP h_coin_ev;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Generic KYC status for some operation.
|
||||
@ -3810,19 +3832,18 @@ struct TALER_EXCHANGEDB_Plugin
|
||||
* age restriction enabled in a given age-withdraw operation and the relevant
|
||||
* information we learned or created in the reveal steop
|
||||
*
|
||||
* @param cls the `struct PostgresClosure` with the plugin-specific state
|
||||
* @param h_commitment The hash of the original age-withdraw commitment, which is a key into the withdraw_age_commitments table
|
||||
* @param num_coins number of coins to generate, size of the @a coin_evs array
|
||||
* TODO: oec
|
||||
* @param cls The `struct PostgresClosure` with the plugin-specific state
|
||||
* @param h_commitment The hash of the original age-withdraw commitment, which is a key into the age_withdraw_commitments table
|
||||
* @param num_awrcs Number of coins to generate, size of the @a coin_evs array
|
||||
* @param awrcs Array of @a num_awrcs information about coins to be created
|
||||
* @return query execution status
|
||||
*/
|
||||
enum GNUNET_DB_QueryStatus
|
||||
(*insert_age_withdraw_reveal)(
|
||||
void *cls,
|
||||
uint64_t h_commitment,
|
||||
uint32_t num_coins
|
||||
/* TODO: oec */
|
||||
);
|
||||
const struct TALER_AgeWithdrawCommitmentHashP *h_commitment,
|
||||
uint32_t num_awrcs,
|
||||
const struct TALER_EXCHANGEDB_AgeWithdrawRevealedCoin *awrcs);
|
||||
|
||||
/**
|
||||
* Lookup in the database for the fresh coins with age-restriction that
|
||||
|
@ -1242,6 +1242,36 @@ TALER_TESTING_cmd_exec_wirewatch (const char *label,
|
||||
const char *config_filename);
|
||||
|
||||
|
||||
/**
|
||||
* Request URL via "wget".
|
||||
*
|
||||
* @param label command label.
|
||||
* @param url URL to fetch
|
||||
* @return the command.
|
||||
*/
|
||||
struct TALER_TESTING_Command
|
||||
TALER_TESTING_cmd_exec_wget (const char *label,
|
||||
const char *url);
|
||||
|
||||
|
||||
/**
|
||||
* Request fetch-transactions via "wget".
|
||||
*
|
||||
* @param label command label.
|
||||
* @param username username to use
|
||||
* @param password password to use
|
||||
* @param bank_base_url base URL of the nexus
|
||||
* @param account_id account to fetch transactions for
|
||||
* @return the command.
|
||||
*/
|
||||
struct TALER_TESTING_Command
|
||||
TALER_TESTING_cmd_nexus_fetch_transactions (const char *label,
|
||||
const char *username,
|
||||
const char *password,
|
||||
const char *bank_base_url,
|
||||
const char *account_id);
|
||||
|
||||
|
||||
/**
|
||||
* Make a "expire" CMD.
|
||||
*
|
||||
|
301
src/templating/Makefile.orig
Normal file
301
src/templating/Makefile.orig
Normal file
@ -0,0 +1,301 @@
|
||||
# version
|
||||
MAJOR := 1
|
||||
MINOR := 2
|
||||
REVIS := 4
|
||||
|
||||
# installation settings
|
||||
DESTDIR ?=
|
||||
PREFIX ?= /usr/local
|
||||
BINDIR ?= $(PREFIX)/bin
|
||||
LIBDIR ?= $(PREFIX)/lib
|
||||
INCLUDEDIR ?= $(PREFIX)/include
|
||||
MANDIR ?= $(PREFIX)/share/man
|
||||
PKGDIR ?= $(LIBDIR)/pkgconfig
|
||||
|
||||
# Tools (sed must be GNU sed)
|
||||
SED ?= sed
|
||||
INSTALL ?= install
|
||||
|
||||
# initial settings
|
||||
VERSION := $(MAJOR).$(MINOR).$(REVIS)
|
||||
SOVER := .$(MAJOR)
|
||||
SOVEREV := .$(MAJOR).$(MINOR)
|
||||
|
||||
HEADERS := mustach.h mustach-wrap.h
|
||||
SPLITLIB := libmustach-core.so$(SOVEREV)
|
||||
SPLITPC := libmustach-core.pc
|
||||
COREOBJS := mustach.o mustach-wrap.o
|
||||
SINGLEOBJS := $(COREOBJS)
|
||||
SINGLEFLAGS :=
|
||||
SINGLELIBS :=
|
||||
TESTSPECS :=
|
||||
ALL := manuals
|
||||
|
||||
# availability of CJSON
|
||||
ifneq ($(cjson),no)
|
||||
cjson_cflags := $(shell pkg-config --silence-errors --cflags libcjson)
|
||||
cjson_libs := $(shell pkg-config --silence-errors --libs libcjson)
|
||||
ifdef cjson_libs
|
||||
cjson := yes
|
||||
tool ?= cjson
|
||||
HEADERS += mustach-cjson.h
|
||||
SPLITLIB += libmustach-cjson.so$(SOVEREV)
|
||||
SPLITPC += libmustach-cjson.pc
|
||||
SINGLEOBJS += mustach-cjson.o
|
||||
SINGLEFLAGS += ${cjson_cflags}
|
||||
SINGLELIBS += ${cjson_libs}
|
||||
TESTSPECS += test-specs/test-specs-cjson
|
||||
else
|
||||
ifeq ($(cjson),yes)
|
||||
$(error Can't find required library cjson)
|
||||
endif
|
||||
cjson := no
|
||||
endif
|
||||
endif
|
||||
|
||||
# availability of JSON-C
|
||||
ifneq ($(jsonc),no)
|
||||
jsonc_cflags := $(shell pkg-config --silence-errors --cflags json-c)
|
||||
jsonc_libs := $(shell pkg-config --silence-errors --libs json-c)
|
||||
ifdef jsonc_libs
|
||||
jsonc := yes
|
||||
tool ?= jsonc
|
||||
HEADERS += mustach-json-c.h
|
||||
SPLITLIB += libmustach-json-c.so$(SOVEREV)
|
||||
SPLITPC += libmustach-json-c.pc
|
||||
SINGLEOBJS += mustach-json-c.o
|
||||
SINGLEFLAGS += ${jsonc_cflags}
|
||||
SINGLELIBS += ${jsonc_libs}
|
||||
TESTSPECS += test-specs/test-specs-json-c
|
||||
else
|
||||
ifeq ($(jsonc),yes)
|
||||
$(error Can't find required library json-c)
|
||||
endif
|
||||
jsonc := no
|
||||
endif
|
||||
endif
|
||||
|
||||
# availability of JANSSON
|
||||
ifneq ($(jansson),no)
|
||||
jansson_cflags := $(shell pkg-config --silence-errors --cflags jansson)
|
||||
jansson_libs := $(shell pkg-config --silence-errors --libs jansson)
|
||||
ifdef jansson_libs
|
||||
jansson := yes
|
||||
tool ?= jansson
|
||||
HEADERS += mustach-jansson.h
|
||||
SPLITLIB += libmustach-jansson.so$(SOVEREV)
|
||||
SPLITPC += libmustach-jansson.pc
|
||||
SINGLEOBJS += mustach-jansson.o
|
||||
SINGLEFLAGS += ${jansson_cflags}
|
||||
SINGLELIBS += ${jansson_libs}
|
||||
TESTSPECS += test-specs/test-specs-jansson
|
||||
else
|
||||
ifeq ($(jansson),yes)
|
||||
$(error Can't find required library jansson)
|
||||
endif
|
||||
jansson := no
|
||||
endif
|
||||
endif
|
||||
|
||||
# tool
|
||||
TOOLOBJS = mustach-tool.o $(COREOBJS)
|
||||
tool ?= none
|
||||
ifneq ($(tool),none)
|
||||
ifeq ($(tool),cjson)
|
||||
TOOLOBJS += mustach-cjson.o
|
||||
TOOLFLAGS := ${cjson_cflags} -DTOOL=MUSTACH_TOOL_CJSON
|
||||
TOOLLIBS := ${cjson_libs}
|
||||
TOOLDEP := mustach-cjson.h
|
||||
else ifeq ($(tool),jsonc)
|
||||
TOOLOBJS += mustach-json-c.o
|
||||
TOOLFLAGS := ${jsonc_cflags} -DTOOL=MUSTACH_TOOL_JSON_C
|
||||
TOOLLIBS := ${jsonc_libs}
|
||||
TOOLDEP := mustach-json-c.h
|
||||
else ifeq ($(tool),jansson)
|
||||
TOOLOBJS += mustach-jansson.o
|
||||
TOOLFLAGS := ${jansson_cflags} -DTOOL=MUSTACH_TOOL_JANSSON
|
||||
TOOLLIBS := ${jansson_libs}
|
||||
TOOLDEP := mustach-jansson.h
|
||||
else
|
||||
$(error Unknown library $(tool) for tool)
|
||||
endif
|
||||
ifneq ($($(tool)),yes)
|
||||
$(error No library found for tool $(tool))
|
||||
endif
|
||||
ALL += mustach
|
||||
endif
|
||||
|
||||
# compute targets
|
||||
libs ?= all
|
||||
ifeq (${libs},split)
|
||||
ALL += ${SPLITLIB} ${SPLITPC}
|
||||
else ifeq (${libs},single)
|
||||
ALL += libmustach.so$(SOVEREV) libmustach.pc
|
||||
else ifeq (${libs},all)
|
||||
ALL += libmustach.so$(SOVEREV) libmustach.pc ${SPLITLIB} ${SPLITPC}
|
||||
else ifneq (${libs},none)
|
||||
$(error Unknown libs $(libs))
|
||||
endif
|
||||
|
||||
# display target
|
||||
$(info tool = ${tool})
|
||||
$(info libs = ${libs})
|
||||
$(info jsonc = ${jsonc})
|
||||
$(info jansson = ${jansson})
|
||||
$(info cjson = ${cjson})
|
||||
|
||||
# settings
|
||||
|
||||
EFLAGS = -fPIC -Wall -Wextra -DVERSION=${VERSION}
|
||||
|
||||
ifeq ($(shell uname),Darwin)
|
||||
LDFLAGS_single += -install_name $(LIBDIR)/libmustach.so$(SOVEREV)
|
||||
LDFLAGS_core += -install_name $(LIBDIR)/libmustach-core.so$(SOVEREV)
|
||||
LDFLAGS_cjson += -install_name $(LIBDIR)/libmustach-cjson.so$(SOVEREV)
|
||||
LDFLAGS_jsonc += -install_name $(LIBDIR)/libmustach-json-c.so$(SOVEREV)
|
||||
LDFLAGS_jansson += -install_name $(LIBDIR)/libmustach-jansson.so$(SOVEREV)
|
||||
else
|
||||
LDFLAGS_single += -Wl,-soname,libmustach.so$(SOVER)
|
||||
LDFLAGS_core += -Wl,-soname,libmustach-core.so$(SOVER)
|
||||
LDFLAGS_cjson += -Wl,-soname,libmustach-cjson.so$(SOVER)
|
||||
LDFLAGS_jsonc += -Wl,-soname,libmustach-json-c.so$(SOVER)
|
||||
LDFLAGS_jansson += -Wl,-soname,libmustach-jansson.so$(SOVER)
|
||||
endif
|
||||
|
||||
# targets
|
||||
|
||||
.PHONY: all
|
||||
all: ${ALL}
|
||||
|
||||
mustach: $(TOOLOBJS)
|
||||
$(CC) $(LDFLAGS) $(TOOLFLAGS) -o mustach $(TOOLOBJS) $(TOOLLIBS)
|
||||
|
||||
libmustach.so$(SOVEREV): $(SINGLEOBJS)
|
||||
$(CC) -shared $(LDFLAGS) $(LDFLAGS_single) -o $@ $^ $(SINGLELIBS)
|
||||
|
||||
libmustach-core.so$(SOVEREV): $(COREOBJS)
|
||||
$(CC) -shared $(LDFLAGS) $(LDFLAGS_core) -o $@ $(COREOBJS) $(lib_OBJ)
|
||||
|
||||
libmustach-cjson.so$(SOVEREV): $(COREOBJS) mustach-cjson.o
|
||||
$(CC) -shared $(LDFLAGS) $(LDFLAGS_cjson) -o $@ $^ $(cjson_libs)
|
||||
|
||||
libmustach-json-c.so$(SOVEREV): $(COREOBJS) mustach-json-c.o
|
||||
$(CC) -shared $(LDFLAGS) $(LDFLAGS_jsonc) -o $@ $^ $(jsonc_libs)
|
||||
|
||||
libmustach-jansson.so$(SOVEREV): $(COREOBJS) mustach-jansson.o
|
||||
$(CC) -shared $(LDFLAGS) $(LDFLAGS_jansson) -o $@ $^ $(jansson_libs)
|
||||
|
||||
# pkgconfigs
|
||||
|
||||
%.pc: pkgcfgs
|
||||
$(SED) -E '/^==.*==$$/{h;d};x;/==$@==/{x;s/VERSION/$(VERSION)/;p;d};x;d' $< > $@
|
||||
|
||||
# objects
|
||||
|
||||
mustach.o: mustach.c mustach.h
|
||||
$(CC) -c $(EFLAGS) $(CFLAGS) -o $@ $<
|
||||
|
||||
mustach-wrap.o: mustach-wrap.c mustach.h mustach-wrap.h
|
||||
$(CC) -c $(EFLAGS) $(CFLAGS) -o $@ $<
|
||||
|
||||
mustach-tool.o: mustach-tool.c mustach.h mustach-json-c.h $(TOOLDEP)
|
||||
$(CC) -c $(EFLAGS) $(CFLAGS) $(TOOLFLAGS) -o $@ $<
|
||||
|
||||
mustach-cjson.o: mustach-cjson.c mustach.h mustach-wrap.h mustach-cjson.h
|
||||
$(CC) -c $(EFLAGS) $(CFLAGS) $(cjson_cflags) -o $@ $<
|
||||
|
||||
mustach-json-c.o: mustach-json-c.c mustach.h mustach-wrap.h mustach-json-c.h
|
||||
$(CC) -c $(EFLAGS) $(CFLAGS) $(jsonc_cflags) -o $@ $<
|
||||
|
||||
mustach-jansson.o: mustach-jansson.c mustach.h mustach-wrap.h mustach-jansson.h
|
||||
$(CC) -c $(EFLAGS) $(CFLAGS) $(jansson_cflags) -o $@ $<
|
||||
|
||||
# installing
|
||||
.PHONY: install
|
||||
install: all
|
||||
$(INSTALL) -d $(DESTDIR)$(BINDIR)
|
||||
$(INSTALL) -m0755 mustach $(DESTDIR)$(BINDIR)/
|
||||
$(INSTALL) -d $(DESTDIR)$(INCLUDEDIR)/mustach
|
||||
$(INSTALL) -m0644 $(HEADERS) $(DESTDIR)$(INCLUDEDIR)/mustach
|
||||
$(INSTALL) -d $(DESTDIR)$(LIBDIR)
|
||||
for x in libmustach*.so$(SOVEREV); do \
|
||||
$(INSTALL) -m0755 $$x $(DESTDIR)$(LIBDIR)/ ;\
|
||||
ln -sf $$x $(DESTDIR)$(LIBDIR)/$${x%.so.*}.so$(SOVER) ;\
|
||||
ln -sf $$x $(DESTDIR)$(LIBDIR)/$${x%.so.*}.so ;\
|
||||
done
|
||||
$(INSTALL) -d $(DESTDIR)/$(PKGDIR)
|
||||
$(INSTALL) -m0644 libmustach*.pc $(DESTDIR)/$(PKGDIR)
|
||||
$(INSTALL) -d $(DESTDIR)/$(MANDIR)/man1
|
||||
$(INSTALL) -m0644 mustach.1.gz $(DESTDIR)/$(MANDIR)/man1
|
||||
|
||||
# deinstalling
|
||||
.PHONY: uninstall
|
||||
uninstall:
|
||||
rm -f $(DESTDIR)$(BINDIR)/mustach
|
||||
rm -f $(DESTDIR)$(LIBDIR)/libmustach*.so*
|
||||
rm -rf $(DESTDIR)$(INCLUDEDIR)/mustach
|
||||
|
||||
# testing
|
||||
.PHONY: test test-basic test-specs
|
||||
test: basic-tests spec-tests
|
||||
|
||||
basic-tests: mustach
|
||||
@$(MAKE) -C test1 test
|
||||
@$(MAKE) -C test2 test
|
||||
@$(MAKE) -C test3 test
|
||||
@$(MAKE) -C test4 test
|
||||
@$(MAKE) -C test5 test
|
||||
@$(MAKE) -C test6 test
|
||||
|
||||
spec-tests: $(TESTSPECS)
|
||||
|
||||
test-specs/test-specs-%: test-specs/%-test-specs test-specs/specs
|
||||
./$< test-specs/spec/specs/[a-z]*.json > $@.last || true
|
||||
diff $@.ref $@.last
|
||||
|
||||
test-specs/cjson-test-specs.o: test-specs/test-specs.c mustach.h mustach-wrap.h mustach-cjson.h
|
||||
$(CC) -I. -c $(EFLAGS) $(CFLAGS) $(cjson_cflags) -DTEST=TEST_CJSON -o $@ $<
|
||||
|
||||
test-specs/cjson-test-specs: test-specs/cjson-test-specs.o mustach-cjson.o $(COREOBJS)
|
||||
$(CC) $(LDFLAGS) -o $@ $^ $(cjson_libs)
|
||||
|
||||
test-specs/json-c-test-specs.o: test-specs/test-specs.c mustach.h mustach-wrap.h mustach-json-c.h
|
||||
$(CC) -I. -c $(EFLAGS) $(CFLAGS) $(jsonc_cflags) -DTEST=TEST_JSON_C -o $@ $<
|
||||
|
||||
test-specs/json-c-test-specs: test-specs/json-c-test-specs.o mustach-json-c.o $(COREOBJS)
|
||||
$(CC) $(LDFLAGS) -o $@ $^ $(jsonc_libs)
|
||||
|
||||
test-specs/jansson-test-specs.o: test-specs/test-specs.c mustach.h mustach-wrap.h mustach-jansson.h
|
||||
$(CC) -I. -c $(EFLAGS) $(CFLAGS) $(jansson_cflags) -DTEST=TEST_JANSSON -o $@ $<
|
||||
|
||||
test-specs/jansson-test-specs: test-specs/jansson-test-specs.o mustach-jansson.o $(COREOBJS)
|
||||
$(CC) $(LDFLAGS) -o $@ $^ $(jansson_libs)
|
||||
|
||||
.PHONY: test-specs/specs
|
||||
test-specs/specs:
|
||||
if test -d test-specs/spec; then \
|
||||
git -C test-specs/spec pull; \
|
||||
else \
|
||||
git -C test-specs clone https://github.com/mustache/spec.git; \
|
||||
fi
|
||||
|
||||
#cleaning
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -f mustach libmustach*.so* *.o *.pc
|
||||
rm -f test-specs/*-test-specs test-specs/test-specs-*.last
|
||||
rm -rf *.gcno *.gcda coverage.info gcov-latest
|
||||
@$(MAKE) -C test1 clean
|
||||
@$(MAKE) -C test2 clean
|
||||
@$(MAKE) -C test3 clean
|
||||
@$(MAKE) -C test4 clean
|
||||
@$(MAKE) -C test5 clean
|
||||
@$(MAKE) -C test6 clean
|
||||
|
||||
# manpage
|
||||
.PHONY: manuals
|
||||
manuals: mustach.1.gz
|
||||
|
||||
mustach.1.gz: mustach.1.scd
|
||||
if which scdoc >/dev/null 2>&1; then scdoc < mustach.1.scd | gzip > mustach.1.gz; fi
|
||||
|
@ -68,11 +68,13 @@ libtalertesting_la_SOURCES = \
|
||||
testing_api_cmd_exec_expire.c \
|
||||
testing_api_cmd_exec_router.c \
|
||||
testing_api_cmd_exec_transfer.c \
|
||||
testing_api_cmd_exec_wget.c \
|
||||
testing_api_cmd_exec_wirewatch.c \
|
||||
testing_api_cmd_insert_deposit.c \
|
||||
testing_api_cmd_kyc_check_get.c \
|
||||
testing_api_cmd_kyc_proof.c \
|
||||
testing_api_cmd_kyc_wallet_get.c \
|
||||
testing_api_cmd_nexus_fetch_transactions.c \
|
||||
testing_api_cmd_oauth.c \
|
||||
testing_api_cmd_offline_sign_global_fees.c \
|
||||
testing_api_cmd_offline_sign_wire_fees.c \
|
||||
|
@ -129,6 +129,15 @@ run (void *cls,
|
||||
|
||||
TALER_TESTING_cmd_sleep ("Waiting 5s for 'debit-1' to settle",
|
||||
5),
|
||||
with_libeufin
|
||||
? TALER_TESTING_cmd_nexus_fetch_transactions (
|
||||
"fetch-transactions-at-nexus",
|
||||
"exchange", /* from taler-nexus-prepare */
|
||||
"x", /* from taler-nexus-prepare */
|
||||
"http://localhost:5001",
|
||||
"my-bank-account") /* from taler-nexus-prepare */
|
||||
: TALER_TESTING_cmd_sleep ("nop",
|
||||
0),
|
||||
TALER_TESTING_cmd_bank_debits ("history-2b",
|
||||
&bc.exchange_auth,
|
||||
NULL,
|
||||
|
@ -8,9 +8,6 @@
|
||||
# only seeks the exchange/BASE_URL URL to connect to the exchange.
|
||||
BASE_URL = "http://localhost:8888/"
|
||||
|
||||
[bank]
|
||||
HTTP_PORT = 8082
|
||||
|
||||
[twister]
|
||||
# HTTP listen port for twister
|
||||
HTTP_PORT = 8888
|
||||
@ -30,4 +27,3 @@ ACCEPT_FROM6 = ::1;
|
||||
UNIXPATH = /tmp/taler-service-twister.sock
|
||||
UNIX_MATCH_UID = NO
|
||||
UNIX_MATCH_GID = YES
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of TALER
|
||||
Copyright (C) 2014-2020 Taler Systems SA
|
||||
Copyright (C) 2014-2023 Taler Systems SA
|
||||
|
||||
TALER is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as
|
||||
@ -112,7 +112,8 @@ run (void *cls,
|
||||
* response from a refresh-reveal operation.
|
||||
*/
|
||||
struct TALER_TESTING_Command refresh_409_conflict[] = {
|
||||
CMD_TRANSFER_TO_EXCHANGE ("refresh-create-reserve",
|
||||
CMD_TRANSFER_TO_EXCHANGE (
|
||||
"refresh-create-reserve",
|
||||
"EUR:5.01"),
|
||||
/**
|
||||
* Make previous command effective.
|
||||
@ -121,32 +122,36 @@ run (void *cls,
|
||||
/**
|
||||
* Withdraw EUR:5.
|
||||
*/
|
||||
TALER_TESTING_cmd_withdraw_amount ("refresh-withdraw-coin",
|
||||
TALER_TESTING_cmd_withdraw_amount (
|
||||
"refresh-withdraw-coin",
|
||||
"refresh-create-reserve",
|
||||
"EUR:5",
|
||||
0, /* age restriction off */
|
||||
MHD_HTTP_OK),
|
||||
TALER_TESTING_cmd_deposit ("refresh-deposit-partial",
|
||||
TALER_TESTING_cmd_deposit (
|
||||
"refresh-deposit-partial",
|
||||
"refresh-withdraw-coin",
|
||||
0,
|
||||
bc.user42_payto,
|
||||
"{\"items\":[{\"name\":\"ice cream\",\
|
||||
\"value\":\"EUR:1\"}]}",
|
||||
"{\"items\":[{\"name\":\"ice cream\",\"value\":\"EUR:1\"}]}",
|
||||
GNUNET_TIME_UNIT_ZERO,
|
||||
"EUR:1",
|
||||
MHD_HTTP_OK),
|
||||
/**
|
||||
* Melt the rest of the coin's value
|
||||
* (EUR:4.00 = 3x EUR:1.03 + 7x EUR:0.13) */
|
||||
TALER_TESTING_cmd_melt ("refresh-melt",
|
||||
TALER_TESTING_cmd_melt (
|
||||
"refresh-melt",
|
||||
"refresh-withdraw-coin",
|
||||
MHD_HTTP_OK,
|
||||
NULL),
|
||||
/* Trigger 409 Conflict. */
|
||||
TALER_TESTING_cmd_flip_upload ("flip-upload",
|
||||
TALER_TESTING_cmd_flip_upload (
|
||||
"flip-upload",
|
||||
config_file,
|
||||
"transfer_privs.0"),
|
||||
TALER_TESTING_cmd_refresh_reveal ("refresh-(flipped-)reveal",
|
||||
TALER_TESTING_cmd_refresh_reveal (
|
||||
"refresh-(flipped-)reveal",
|
||||
"refresh-melt",
|
||||
MHD_HTTP_CONFLICT),
|
||||
TALER_TESTING_cmd_end ()
|
||||
@ -159,20 +164,22 @@ run (void *cls,
|
||||
* lib test suite.
|
||||
*/
|
||||
struct TALER_TESTING_Command refund[] = {
|
||||
CMD_TRANSFER_TO_EXCHANGE ("create-reserve-r1",
|
||||
CMD_TRANSFER_TO_EXCHANGE (
|
||||
"create-reserve-r1",
|
||||
"EUR:5.01"),
|
||||
CMD_EXEC_WIREWATCH ("wirewatch-r1"),
|
||||
TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-r1",
|
||||
TALER_TESTING_cmd_withdraw_amount (
|
||||
"withdraw-coin-r1",
|
||||
"create-reserve-r1",
|
||||
"EUR:5",
|
||||
0, /* age restriction off */
|
||||
MHD_HTTP_OK),
|
||||
TALER_TESTING_cmd_deposit ("deposit-refund-1",
|
||||
TALER_TESTING_cmd_deposit (
|
||||
"deposit-refund-1",
|
||||
"withdraw-coin-r1",
|
||||
0,
|
||||
bc.user42_payto,
|
||||
"{\"items\":[{\"name\":\"ice cream\","
|
||||
"\"value\":\"EUR:5\"}]}",
|
||||
"{\"items\":[{\"name\":\"ice cream\",\"value\":\"EUR:5\"}]}",
|
||||
GNUNET_TIME_UNIT_MINUTES,
|
||||
"EUR:5",
|
||||
MHD_HTTP_OK),
|
||||
@ -190,15 +197,15 @@ run (void *cls,
|
||||
/* This next deposit CMD is only used to provide a
|
||||
* good merchant signature to the next (failing) refund
|
||||
* operations. */
|
||||
TALER_TESTING_cmd_deposit ("deposit-refund-to-fail",
|
||||
TALER_TESTING_cmd_deposit (
|
||||
"deposit-refund-to-fail",
|
||||
"withdraw-coin-r1",
|
||||
0, /* coin index. */
|
||||
bc.user42_payto,
|
||||
/* This parameter will make any comparison about
|
||||
h_contract_terms fail, when /refund will be handled.
|
||||
So in other words, this is h_contract mismatch. */
|
||||
"{\"items\":[{\"name\":\"ice skate\","
|
||||
"\"value\":\"EUR:5\"}]}",
|
||||
"{\"items\":[{\"name\":\"ice skate\",\"value\":\"EUR:5\"}]}",
|
||||
GNUNET_TIME_UNIT_MINUTES,
|
||||
"EUR:5",
|
||||
MHD_HTTP_CONFLICT),
|
||||
@ -219,7 +226,8 @@ run (void *cls,
|
||||
* are out of date.
|
||||
*/
|
||||
struct TALER_TESTING_Command expired_keys[] = {
|
||||
TALER_TESTING_cmd_modify_header_dl ("modify-expiration",
|
||||
TALER_TESTING_cmd_modify_header_dl (
|
||||
"modify-expiration",
|
||||
config_file,
|
||||
MHD_HTTP_HEADER_EXPIRES,
|
||||
"Wed, 19 Jan 586524 08:01:49 GMT"),
|
||||
@ -232,7 +240,8 @@ run (void *cls,
|
||||
CMD_TRANSFER_TO_EXCHANGE ("create-reserve-r2",
|
||||
"EUR:55.01"),
|
||||
CMD_EXEC_WIREWATCH ("wirewatch-r2"),
|
||||
TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-r2",
|
||||
TALER_TESTING_cmd_withdraw_amount (
|
||||
"withdraw-coin-r2",
|
||||
"create-reserve-r2",
|
||||
"EUR:5",
|
||||
0, /* age restriction off */
|
||||
@ -242,17 +251,22 @@ run (void *cls,
|
||||
#endif
|
||||
|
||||
struct TALER_TESTING_Command commands[] = {
|
||||
TALER_TESTING_cmd_wire_add ("add-wire-account",
|
||||
TALER_TESTING_cmd_wire_add (
|
||||
"add-wire-account",
|
||||
"payto://x-taler-bank/localhost/2?receiver-name=2",
|
||||
MHD_HTTP_NO_CONTENT,
|
||||
false),
|
||||
TALER_TESTING_cmd_exec_offline_sign_keys ("offline-sign-future-keys",
|
||||
TALER_TESTING_cmd_exec_offline_sign_keys (
|
||||
"offline-sign-future-keys",
|
||||
config_file),
|
||||
TALER_TESTING_cmd_check_keys_pull_all_keys ("refetch /keys",
|
||||
TALER_TESTING_cmd_check_keys_pull_all_keys (
|
||||
"refetch /keys",
|
||||
1),
|
||||
TALER_TESTING_cmd_batch ("refresh-reveal-409-conflict",
|
||||
TALER_TESTING_cmd_batch (
|
||||
"refresh-reveal-409-conflict",
|
||||
refresh_409_conflict),
|
||||
TALER_TESTING_cmd_batch ("refund",
|
||||
TALER_TESTING_cmd_batch (
|
||||
"refund",
|
||||
refund),
|
||||
#if 0
|
||||
TALER_TESTING_cmd_batch ("expired-keys",
|
||||
|
158
src/testing/testing_api_cmd_exec_wget.c
Normal file
158
src/testing/testing_api_cmd_exec_wget.c
Normal file
@ -0,0 +1,158 @@
|
||||
/*
|
||||
This file is part of TALER
|
||||
Copyright (C) 2023 Taler Systems SA
|
||||
|
||||
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 Foundation; either version 3,
|
||||
or (at your option) any later version.
|
||||
|
||||
TALER is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with TALER; see the file COPYING. If not, see
|
||||
<http://www.gnu.org/licenses/>
|
||||
*/
|
||||
/**
|
||||
* @file testing/testing_api_cmd_exec_wget.c
|
||||
* @brief run a wget command
|
||||
* @author Christian Grothoff
|
||||
*/
|
||||
#include "platform.h"
|
||||
#include "taler_json_lib.h"
|
||||
#include <gnunet/gnunet_curl_lib.h>
|
||||
#include "taler_signatures.h"
|
||||
#include "taler_testing_lib.h"
|
||||
|
||||
|
||||
/**
|
||||
* State for a "wget" CMD.
|
||||
*/
|
||||
struct WgetState
|
||||
{
|
||||
/**
|
||||
* Process for the wgeter.
|
||||
*/
|
||||
struct GNUNET_OS_Process *wget_proc;
|
||||
|
||||
/**
|
||||
* URL to used by the wget.
|
||||
*/
|
||||
const char *url;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Run the command; use the `wget' program.
|
||||
*
|
||||
* @param cls closure.
|
||||
* @param cmd command currently being executed.
|
||||
* @param is interpreter state.
|
||||
*/
|
||||
static void
|
||||
wget_run (void *cls,
|
||||
const struct TALER_TESTING_Command *cmd,
|
||||
struct TALER_TESTING_Interpreter *is)
|
||||
{
|
||||
struct WgetState *ws = cls;
|
||||
|
||||
(void) cmd;
|
||||
ws->wget_proc
|
||||
= GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_ALL,
|
||||
NULL, NULL, NULL,
|
||||
"wget",
|
||||
"wget",
|
||||
ws->url,
|
||||
NULL);
|
||||
if (NULL == ws->wget_proc)
|
||||
{
|
||||
GNUNET_break (0);
|
||||
TALER_TESTING_interpreter_fail (is);
|
||||
return;
|
||||
}
|
||||
TALER_TESTING_wait_for_sigchld (is);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Free the state of a "wget" CMD, and possibly
|
||||
* kills its process if it did not terminate regularly.
|
||||
*
|
||||
* @param cls closure.
|
||||
* @param cmd the command being freed.
|
||||
*/
|
||||
static void
|
||||
wget_cleanup (void *cls,
|
||||
const struct TALER_TESTING_Command *cmd)
|
||||
{
|
||||
struct WgetState *ws = cls;
|
||||
|
||||
(void) cmd;
|
||||
if (NULL != ws->wget_proc)
|
||||
{
|
||||
GNUNET_break (0 ==
|
||||
GNUNET_OS_process_kill (ws->wget_proc,
|
||||
SIGKILL));
|
||||
GNUNET_OS_process_wait (ws->wget_proc);
|
||||
GNUNET_OS_process_destroy (ws->wget_proc);
|
||||
ws->wget_proc = NULL;
|
||||
}
|
||||
GNUNET_free (ws);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Offer "wget" CMD internal data to other commands.
|
||||
*
|
||||
* @param cls closure.
|
||||
* @param[out] ret result.
|
||||
* @param trait name of the trait.
|
||||
* @param index index number of the object to offer.
|
||||
* @return #GNUNET_OK on success.
|
||||
*/
|
||||
static enum GNUNET_GenericReturnValue
|
||||
wget_traits (void *cls,
|
||||
const void **ret,
|
||||
const char *trait,
|
||||
unsigned int index)
|
||||
{
|
||||
struct WgetState *ws = cls;
|
||||
struct TALER_TESTING_Trait traits[] = {
|
||||
TALER_TESTING_make_trait_process (&ws->wget_proc),
|
||||
TALER_TESTING_trait_end ()
|
||||
};
|
||||
|
||||
return TALER_TESTING_get_trait (traits,
|
||||
ret,
|
||||
trait,
|
||||
index);
|
||||
}
|
||||
|
||||
|
||||
struct TALER_TESTING_Command
|
||||
TALER_TESTING_cmd_exec_wget (const char *label,
|
||||
const char *url)
|
||||
{
|
||||
struct WgetState *ws;
|
||||
|
||||
ws = GNUNET_new (struct WgetState);
|
||||
ws->url = url;
|
||||
|
||||
{
|
||||
struct TALER_TESTING_Command cmd = {
|
||||
.cls = ws,
|
||||
.label = label,
|
||||
.run = &wget_run,
|
||||
.cleanup = &wget_cleanup,
|
||||
.traits = &wget_traits
|
||||
};
|
||||
|
||||
return cmd;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* end of testing_api_cmd_exec_wget.c */
|
186
src/testing/testing_api_cmd_nexus_fetch_transactions.c
Normal file
186
src/testing/testing_api_cmd_nexus_fetch_transactions.c
Normal file
@ -0,0 +1,186 @@
|
||||
/*
|
||||
This file is part of TALER
|
||||
Copyright (C) 2023 Taler Systems SA
|
||||
|
||||
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 Foundation; either version 3,
|
||||
or (at your option) any later version.
|
||||
|
||||
TALER is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with TALER; see the file COPYING. If not, see
|
||||
<http://www.gnu.org/licenses/>
|
||||
*/
|
||||
/**
|
||||
* @file testing/testing_api_cmd_nexus_fetch_transactions.c
|
||||
* @brief run a nft command
|
||||
* @author Christian Grothoff
|
||||
*/
|
||||
#include "platform.h"
|
||||
#include "taler_json_lib.h"
|
||||
#include <gnunet/gnunet_curl_lib.h>
|
||||
#include "taler_signatures.h"
|
||||
#include "taler_testing_lib.h"
|
||||
|
||||
|
||||
/**
|
||||
* State for a "nft" CMD.
|
||||
*/
|
||||
struct NftState
|
||||
{
|
||||
/**
|
||||
* Process for the nfter.
|
||||
*/
|
||||
struct GNUNET_OS_Process *nft_proc;
|
||||
|
||||
const char *username;
|
||||
const char *password;
|
||||
const char *bank_base_url;
|
||||
const char *account_id;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Run the command; use the `nft' program.
|
||||
*
|
||||
* @param cls closure.
|
||||
* @param cmd command currently being executed.
|
||||
* @param is interpreter state.
|
||||
*/
|
||||
static void
|
||||
nft_run (void *cls,
|
||||
const struct TALER_TESTING_Command *cmd,
|
||||
struct TALER_TESTING_Interpreter *is)
|
||||
{
|
||||
struct NftState *ws = cls;
|
||||
char *url;
|
||||
char *user;
|
||||
char *pass;
|
||||
|
||||
(void) cmd;
|
||||
GNUNET_asprintf (&url,
|
||||
"%s/bank-accounts/%s/fetch-transactions",
|
||||
ws->bank_base_url,
|
||||
ws->account_id);
|
||||
GNUNET_asprintf (&user,
|
||||
"--user=%s",
|
||||
ws->username);
|
||||
GNUNET_asprintf (&pass,
|
||||
"--password=%s",
|
||||
ws->password);
|
||||
ws->nft_proc
|
||||
= GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_ALL,
|
||||
NULL, NULL, NULL,
|
||||
"wget",
|
||||
"wget",
|
||||
"--header=Content-Type:application/json",
|
||||
"--auth-no-challenge",
|
||||
"--post-data={\"level\":\"all\",\"rangeType\":\"latest\"}",
|
||||
user,
|
||||
pass,
|
||||
url,
|
||||
NULL);
|
||||
GNUNET_free (url);
|
||||
GNUNET_free (user);
|
||||
GNUNET_free (pass);
|
||||
if (NULL == ws->nft_proc)
|
||||
{
|
||||
GNUNET_break (0);
|
||||
TALER_TESTING_interpreter_fail (is);
|
||||
return;
|
||||
}
|
||||
TALER_TESTING_wait_for_sigchld (is);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Free the state of a "nft" CMD, and possibly
|
||||
* kills its process if it did not terminate regularly.
|
||||
*
|
||||
* @param cls closure.
|
||||
* @param cmd the command being freed.
|
||||
*/
|
||||
static void
|
||||
nft_cleanup (void *cls,
|
||||
const struct TALER_TESTING_Command *cmd)
|
||||
{
|
||||
struct NftState *ws = cls;
|
||||
|
||||
(void) cmd;
|
||||
if (NULL != ws->nft_proc)
|
||||
{
|
||||
GNUNET_break (0 ==
|
||||
GNUNET_OS_process_kill (ws->nft_proc,
|
||||
SIGKILL));
|
||||
GNUNET_OS_process_wait (ws->nft_proc);
|
||||
GNUNET_OS_process_destroy (ws->nft_proc);
|
||||
ws->nft_proc = NULL;
|
||||
}
|
||||
GNUNET_free (ws);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Offer "nft" CMD internal data to other commands.
|
||||
*
|
||||
* @param cls closure.
|
||||
* @param[out] ret result.
|
||||
* @param trait name of the trait.
|
||||
* @param index index number of the object to offer.
|
||||
* @return #GNUNET_OK on success.
|
||||
*/
|
||||
static enum GNUNET_GenericReturnValue
|
||||
nft_traits (void *cls,
|
||||
const void **ret,
|
||||
const char *trait,
|
||||
unsigned int index)
|
||||
{
|
||||
struct NftState *ws = cls;
|
||||
struct TALER_TESTING_Trait traits[] = {
|
||||
TALER_TESTING_make_trait_process (&ws->nft_proc),
|
||||
TALER_TESTING_trait_end ()
|
||||
};
|
||||
|
||||
return TALER_TESTING_get_trait (traits,
|
||||
ret,
|
||||
trait,
|
||||
index);
|
||||
}
|
||||
|
||||
|
||||
struct TALER_TESTING_Command
|
||||
TALER_TESTING_cmd_nexus_fetch_transactions (
|
||||
const char *label,
|
||||
const char *username,
|
||||
const char *password,
|
||||
const char *bank_base_url,
|
||||
const char *account_id)
|
||||
{
|
||||
struct NftState *ws;
|
||||
|
||||
ws = GNUNET_new (struct NftState);
|
||||
ws->username = username;
|
||||
ws->password = password;
|
||||
ws->bank_base_url = bank_base_url;
|
||||
ws->account_id = account_id;
|
||||
|
||||
{
|
||||
struct TALER_TESTING_Command cmd = {
|
||||
.cls = ws,
|
||||
.label = label,
|
||||
.run = &nft_run,
|
||||
.cleanup = &nft_cleanup,
|
||||
.traits = &nft_traits
|
||||
};
|
||||
|
||||
return cmd;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* end of testing_api_cmd_nexus_fetch_transactions.c */
|
Loading…
Reference in New Issue
Block a user