-more dB work
This commit is contained in:
parent
d83a65320a
commit
bc57abc3da
@ -775,7 +775,7 @@ commit (enum GNUNET_DB_QueryStatus qs)
|
||||
* @param rowid deposit table row of the coin's deposit
|
||||
* @param coin_pub public key of the coin
|
||||
* @param amount value of the deposit, including fee
|
||||
* @param wire where should the funds be wired
|
||||
* @param payto_uri where should the funds be wired
|
||||
* @param deadline what was the requested wire transfer deadline
|
||||
* @param tiny did the exchange defer this transfer because it is too small?
|
||||
* NOTE: only valid in internal audit mode!
|
||||
@ -787,7 +787,7 @@ wire_missing_cb (void *cls,
|
||||
uint64_t rowid,
|
||||
const struct TALER_CoinSpendPublicKeyP *coin_pub,
|
||||
const struct TALER_Amount *amount,
|
||||
const json_t *wire,
|
||||
const char *payto_uri,
|
||||
struct GNUNET_TIME_Absolute deadline,
|
||||
/* bool? */ int tiny,
|
||||
/* bool? */ int done)
|
||||
@ -824,8 +824,8 @@ wire_missing_cb (void *cls,
|
||||
deadline),
|
||||
GNUNET_JSON_pack_data_auto ("coin_pub",
|
||||
coin_pub),
|
||||
GNUNET_JSON_pack_object_incref ("account",
|
||||
(json_t *) wire));
|
||||
GNUNET_JSON_pack_string ("account",
|
||||
payto_uri));
|
||||
if (internal_checks)
|
||||
{
|
||||
/* the 'done' bit is only useful in 'internal' mode */
|
||||
|
@ -89,7 +89,6 @@ COMMENT ON COLUMN wire_targets.oauth_username
|
||||
CREATE TABLE IF NOT EXISTS reserves
|
||||
(reserve_uuid BIGSERIAL UNIQUE
|
||||
,reserve_pub BYTEA PRIMARY KEY CHECK(LENGTH(reserve_pub)=32)
|
||||
,account_details TEXT NOT NULL
|
||||
,current_balance_val INT8 NOT NULL
|
||||
,current_balance_frac INT4 NOT NULL
|
||||
,expiration_date INT8 NOT NULL
|
||||
@ -199,6 +198,73 @@ CREATE INDEX IF NOT EXISTS reserves_out_for_get_withdraw_info
|
||||
,h_blind_ev
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS auditors
|
||||
(auditor_uuid BIGSERIAL UNIQUE
|
||||
,auditor_pub BYTEA PRIMARY KEY CHECK (LENGTH(auditor_pub)=32)
|
||||
,auditor_name VARCHAR NOT NULL
|
||||
,auditor_url VARCHAR NOT NULL
|
||||
,is_active BOOLEAN NOT NULL
|
||||
,last_change INT8 NOT NULL
|
||||
);
|
||||
COMMENT ON TABLE auditors
|
||||
IS 'Table with auditors the exchange uses or has used in the past. Entries never expire as we need to remember the last_change column indefinitely.';
|
||||
COMMENT ON COLUMN auditors.auditor_pub
|
||||
IS 'Public key of the auditor.';
|
||||
COMMENT ON COLUMN auditors.auditor_url
|
||||
IS 'The base URL of the auditor.';
|
||||
COMMENT ON COLUMN auditors.is_active
|
||||
IS 'true if we are currently supporting the use of this auditor.';
|
||||
COMMENT ON COLUMN auditors.last_change
|
||||
IS 'Latest time when active status changed. Used to detect replays of old messages.';
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS auditor_denom_sigs
|
||||
(auditor_denom_serial BIGSERIAL UNIQUE
|
||||
,auditor_uuid INT8 NOT NULL REFERENCES auditors (auditor_uuid) ON DELETE CASCADE
|
||||
,denominations_serial INT8 NOT NULL REFERENCES denominations (denominations_serial) ON DELETE CASCADE
|
||||
,auditor_sig BYTEA CHECK (LENGTH(auditor_sig)=64)
|
||||
,PRIMARY KEY (denominations_serial, auditor_uuid)
|
||||
);
|
||||
COMMENT ON TABLE auditor_denom_sigs
|
||||
IS 'Table with auditor signatures on exchange denomination keys.';
|
||||
COMMENT ON COLUMN auditor_denom_sigs.auditor_uuid
|
||||
IS 'Identifies the auditor.';
|
||||
COMMENT ON COLUMN auditor_denom_sigs.denominations_serial
|
||||
IS 'Denomination the signature is for.';
|
||||
COMMENT ON COLUMN auditor_denom_sigs.auditor_sig
|
||||
IS 'Signature of the auditor, of purpose TALER_SIGNATURE_AUDITOR_EXCHANGE_KEYS.';
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS exchange_sign_keys
|
||||
(esk_serial BIGSERIAL UNIQUE
|
||||
,exchange_pub BYTEA PRIMARY KEY CHECK (LENGTH(exchange_pub)=32)
|
||||
,master_sig BYTEA NOT NULL CHECK (LENGTH(master_sig)=64)
|
||||
,valid_from INT8 NOT NULL
|
||||
,expire_sign INT8 NOT NULL
|
||||
,expire_legal INT8 NOT NULL
|
||||
);
|
||||
COMMENT ON TABLE exchange_sign_keys
|
||||
IS 'Table with master public key signatures on exchange online signing keys.';
|
||||
COMMENT ON COLUMN exchange_sign_keys.exchange_pub
|
||||
IS 'Public online signing key of the exchange.';
|
||||
COMMENT ON COLUMN exchange_sign_keys.master_sig
|
||||
IS 'Signature affirming the validity of the signing key of purpose TALER_SIGNATURE_MASTER_SIGNING_KEY_VALIDITY.';
|
||||
COMMENT ON COLUMN exchange_sign_keys.valid_from
|
||||
IS 'Time when this online signing key will first be used to sign messages.';
|
||||
COMMENT ON COLUMN exchange_sign_keys.expire_sign
|
||||
IS 'Time when this online signing key will no longer be used to sign.';
|
||||
COMMENT ON COLUMN exchange_sign_keys.expire_legal
|
||||
IS 'Time when this online signing key legally expires.';
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS signkey_revocations
|
||||
(signkey_revocations_serial_id BIGSERIAL UNIQUE
|
||||
,esk_serial INT8 PRIMARY KEY REFERENCES exchange_sign_keys (esk_serial) ON DELETE CASCADE
|
||||
,master_sig BYTEA NOT NULL CHECK (LENGTH(master_sig)=64)
|
||||
);
|
||||
COMMENT ON TABLE signkey_revocations
|
||||
IS 'remembering which online signing keys have been revoked';
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS known_coins
|
||||
(known_coin_id BIGSERIAL UNIQUE
|
||||
@ -517,65 +583,6 @@ COMMENT ON INDEX prepare_get_index
|
||||
IS 'for wire_prepare_data_get';
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS auditors
|
||||
(auditor_uuid BIGSERIAL UNIQUE
|
||||
,auditor_pub BYTEA PRIMARY KEY CHECK (LENGTH(auditor_pub)=32)
|
||||
,auditor_name VARCHAR NOT NULL
|
||||
,auditor_url VARCHAR NOT NULL
|
||||
,is_active BOOLEAN NOT NULL
|
||||
,last_change INT8 NOT NULL
|
||||
);
|
||||
COMMENT ON TABLE auditors
|
||||
IS 'Table with auditors the exchange uses or has used in the past. Entries never expire as we need to remember the last_change column indefinitely.';
|
||||
COMMENT ON COLUMN auditors.auditor_pub
|
||||
IS 'Public key of the auditor.';
|
||||
COMMENT ON COLUMN auditors.auditor_url
|
||||
IS 'The base URL of the auditor.';
|
||||
COMMENT ON COLUMN auditors.is_active
|
||||
IS 'true if we are currently supporting the use of this auditor.';
|
||||
COMMENT ON COLUMN auditors.last_change
|
||||
IS 'Latest time when active status changed. Used to detect replays of old messages.';
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS auditor_denom_sigs
|
||||
(auditor_denom_serial BIGSERIAL UNIQUE
|
||||
,auditor_uuid INT8 NOT NULL REFERENCES auditors (auditor_uuid) ON DELETE CASCADE
|
||||
,denominations_serial INT8 NOT NULL REFERENCES denominations (denominations_serial) ON DELETE CASCADE
|
||||
,auditor_sig BYTEA CHECK (LENGTH(auditor_sig)=64)
|
||||
,PRIMARY KEY (denominations_serial, auditor_uuid)
|
||||
);
|
||||
COMMENT ON TABLE auditor_denom_sigs
|
||||
IS 'Table with auditor signatures on exchange denomination keys.';
|
||||
COMMENT ON COLUMN auditor_denom_sigs.auditor_uuid
|
||||
IS 'Identifies the auditor.';
|
||||
COMMENT ON COLUMN auditor_denom_sigs.denominations_serial
|
||||
IS 'Denomination the signature is for.';
|
||||
COMMENT ON COLUMN auditor_denom_sigs.auditor_sig
|
||||
IS 'Signature of the auditor, of purpose TALER_SIGNATURE_AUDITOR_EXCHANGE_KEYS.';
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS exchange_sign_keys
|
||||
(esk_serial BIGSERIAL UNIQUE
|
||||
,exchange_pub BYTEA PRIMARY KEY CHECK (LENGTH(exchange_pub)=32)
|
||||
,master_sig BYTEA NOT NULL CHECK (LENGTH(master_sig)=64)
|
||||
,valid_from INT8 NOT NULL
|
||||
,expire_sign INT8 NOT NULL
|
||||
,expire_legal INT8 NOT NULL
|
||||
);
|
||||
COMMENT ON TABLE exchange_sign_keys
|
||||
IS 'Table with master public key signatures on exchange online signing keys.';
|
||||
COMMENT ON COLUMN exchange_sign_keys.exchange_pub
|
||||
IS 'Public online signing key of the exchange.';
|
||||
COMMENT ON COLUMN exchange_sign_keys.master_sig
|
||||
IS 'Signature affirming the validity of the signing key of purpose TALER_SIGNATURE_MASTER_SIGNING_KEY_VALIDITY.';
|
||||
COMMENT ON COLUMN exchange_sign_keys.valid_from
|
||||
IS 'Time when this online signing key will first be used to sign messages.';
|
||||
COMMENT ON COLUMN exchange_sign_keys.expire_sign
|
||||
IS 'Time when this online signing key will no longer be used to sign.';
|
||||
COMMENT ON COLUMN exchange_sign_keys.expire_legal
|
||||
IS 'Time when this online signing key legally expires.';
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS wire_accounts
|
||||
(payto_uri VARCHAR PRIMARY KEY
|
||||
,master_sig BYTEA CHECK (LENGTH(master_sig)=64)
|
||||
@ -596,15 +603,6 @@ COMMENT ON COLUMN wire_accounts.last_change
|
||||
-- and is of no concern to the auditor
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS signkey_revocations
|
||||
(signkey_revocations_serial_id BIGSERIAL UNIQUE
|
||||
,esk_serial INT8 PRIMARY KEY REFERENCES exchange_sign_keys (esk_serial) ON DELETE CASCADE
|
||||
,master_sig BYTEA NOT NULL CHECK (LENGTH(master_sig)=64)
|
||||
);
|
||||
COMMENT ON TABLE signkey_revocations
|
||||
IS 'remembering which online signing keys have been revoked';
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS work_shards
|
||||
(shard_serial_id BIGSERIAL UNIQUE
|
||||
,last_attempt INT8 NOT NULL
|
||||
|
@ -48,6 +48,10 @@ lrbt_cb_table_denominations (void *cls,
|
||||
struct GNUNET_PQ_ResultSpec rs[] = {
|
||||
GNUNET_PQ_result_spec_uint64 ("serial",
|
||||
&td.serial),
|
||||
GNUNET_PQ_result_spec_uint32 ("denom_type",
|
||||
&td.details.denominations.denom_type),
|
||||
GNUNET_PQ_result_spec_uint32 ("age_restrictions",
|
||||
&td.details.denominations.age_restrictions),
|
||||
TALER_PQ_result_spec_denom_pub (
|
||||
"denom_pub",
|
||||
&td.details.denominations.denom_pub),
|
||||
@ -139,6 +143,54 @@ lrbt_cb_table_denomination_revocations (void *cls,
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function called with wire_targets 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_wire_targets (void *cls,
|
||||
PGresult *result,
|
||||
unsigned int num_results)
|
||||
{
|
||||
struct LookupRecordsByTableContext *ctx = cls;
|
||||
struct PostgresClosure *pg = ctx->pg;
|
||||
struct TALER_EXCHANGEDB_TableData td = {
|
||||
.table = TALER_EXCHANGEDB_RT_WIRE_TARGETS
|
||||
};
|
||||
|
||||
for (unsigned int i = 0; i<num_results; i++)
|
||||
{
|
||||
struct GNUNET_PQ_ResultSpec rs[] = {
|
||||
GNUNET_PQ_result_spec_uint64 ("serial",
|
||||
&td.serial),
|
||||
GNUNET_PQ_result_spec_string ("payto_uri",
|
||||
&td.details.wire_targets.payto_uri),
|
||||
GNUNET_PQ_result_spec_auto_from_type ("kyc_ok",
|
||||
&td.details.wire_targets.kyc_ok),
|
||||
GNUNET_PQ_result_spec_string ("oauth_username",
|
||||
&td.details.wire_targets.oauth_username),
|
||||
GNUNET_PQ_result_spec_end
|
||||
};
|
||||
|
||||
if (GNUNET_OK !=
|
||||
GNUNET_PQ_extract_result (result,
|
||||
rs,
|
||||
i))
|
||||
{
|
||||
GNUNET_break (0);
|
||||
ctx->error = true;
|
||||
return;
|
||||
}
|
||||
ctx->cb (ctx->cb_cls,
|
||||
&td);
|
||||
GNUNET_PQ_cleanup_result (rs);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function called with reserves table entries.
|
||||
*
|
||||
@ -828,6 +880,9 @@ lrbt_cb_table_deposits (void *cls,
|
||||
GNUNET_PQ_result_spec_uint64 (
|
||||
"serial",
|
||||
&td.serial),
|
||||
GNUNET_PQ_result_spec_uint64 (
|
||||
"shard",
|
||||
&td.details.deposits.shard),
|
||||
TALER_PQ_RESULT_SPEC_AMOUNT (
|
||||
"amount_with_fee",
|
||||
&td.details.deposits.amount_with_fee),
|
||||
@ -852,9 +907,15 @@ lrbt_cb_table_deposits (void *cls,
|
||||
GNUNET_PQ_result_spec_auto_from_type (
|
||||
"coin_sig",
|
||||
&td.details.deposits.coin_sig),
|
||||
TALER_PQ_result_spec_json (
|
||||
"wire",
|
||||
&td.details.deposits.wire),
|
||||
GNUNET_PQ_result_spec_uint64 (
|
||||
"wire_target_serial_id",
|
||||
&td.details.deposits.wire_target_serial_id),
|
||||
GNUNET_PQ_result_spec_json (
|
||||
"extension_options",
|
||||
&td.details.deposits.extension_options),
|
||||
GNUNET_PQ_result_spec_auto_from_type (
|
||||
"extension_blocked",
|
||||
&td.details.deposits.extension_blocked),
|
||||
GNUNET_PQ_result_spec_auto_from_type (
|
||||
"tiny",
|
||||
&td.details.deposits.tiny),
|
||||
|
@ -1144,8 +1144,7 @@ prepare_statements (struct PostgresClosure *pg)
|
||||
"SELECT"
|
||||
" aggregation_serial_id"
|
||||
",deposits.h_contract_terms"
|
||||
",deposits.wire"
|
||||
",deposits.h_wire"
|
||||
",payto_uri"
|
||||
",kc.coin_pub"
|
||||
",deposits.merchant_pub"
|
||||
",wire_out.execution_date"
|
||||
@ -1157,6 +1156,8 @@ prepare_statements (struct PostgresClosure *pg)
|
||||
" FROM aggregation_tracking"
|
||||
" JOIN deposits"
|
||||
" USING (deposit_serial_id)"
|
||||
" JOIN wire_targets"
|
||||
" USING (wire_target_serial_id)"
|
||||
" JOIN known_coins kc"
|
||||
" USING (known_coin_id)"
|
||||
" JOIN denominations denom"
|
||||
@ -1172,9 +1173,13 @@ prepare_statements (struct PostgresClosure *pg)
|
||||
",wire_out.execution_date"
|
||||
",amount_with_fee_val"
|
||||
",amount_with_fee_frac"
|
||||
",wire_salt"
|
||||
",payto_uri"
|
||||
",denom.fee_deposit_val"
|
||||
",denom.fee_deposit_frac"
|
||||
" FROM deposits"
|
||||
" JOIN wire_targets"
|
||||
" USING (wire_target_serial_id)"
|
||||
" JOIN aggregation_tracking"
|
||||
" USING (deposit_serial_id)"
|
||||
" JOIN known_coins"
|
||||
@ -1184,10 +1189,9 @@ prepare_statements (struct PostgresClosure *pg)
|
||||
" JOIN wire_out"
|
||||
" USING (wtid_raw)"
|
||||
" WHERE coin_pub=$1"
|
||||
" AND h_contract_terms=$2"
|
||||
" AND h_wire=$3"
|
||||
" AND merchant_pub=$4;",
|
||||
4),
|
||||
" AND merchant_pub=$3"
|
||||
" AND h_contract_terms=$2",
|
||||
3),
|
||||
/* Used in #postgres_insert_aggregation_tracking */
|
||||
GNUNET_PQ_make_prepare ("insert_aggregation_tracking",
|
||||
"INSERT INTO aggregation_tracking "
|
||||
@ -1278,12 +1282,15 @@ prepare_statements (struct PostgresClosure *pg)
|
||||
",coin_pub"
|
||||
",amount_with_fee_val"
|
||||
",amount_with_fee_frac"
|
||||
",wire"
|
||||
",payto_uri"
|
||||
",wire_deadline"
|
||||
",tiny"
|
||||
",done"
|
||||
" FROM deposits d"
|
||||
" JOIN known_coins USING (known_coin_id)"
|
||||
" JOIN known_coins"
|
||||
" USING (known_coin_id)"
|
||||
" JOIN wire_targets"
|
||||
" USING (wire_target_serial_id)"
|
||||
" WHERE wire_deadline >= $1"
|
||||
" AND wire_deadline < $2"
|
||||
" AND NOT (EXISTS (SELECT 1"
|
||||
@ -1314,11 +1321,15 @@ prepare_statements (struct PostgresClosure *pg)
|
||||
" wireout_uuid"
|
||||
",execution_date"
|
||||
",wtid_raw"
|
||||
",wire_target"
|
||||
",payto_uri"
|
||||
",amount_val"
|
||||
",amount_frac"
|
||||
" FROM wire_out"
|
||||
" WHERE wireout_uuid>=$1 AND exchange_account_section=$2"
|
||||
" JOIN wire_targets"
|
||||
" USING (wire_target_serial_id)"
|
||||
" WHERE "
|
||||
" wireout_uuid>=$1 "
|
||||
" AND exchange_account_section=$2"
|
||||
" ORDER BY wireout_uuid ASC;",
|
||||
2),
|
||||
/* Used in #postgres_insert_recoup_request() to store recoup
|
||||
@ -6934,22 +6945,19 @@ handle_wt_result (void *cls,
|
||||
{
|
||||
uint64_t rowid;
|
||||
struct TALER_PrivateContractHash h_contract_terms;
|
||||
struct TALER_MerchantWireHash h_wire;
|
||||
struct TALER_CoinSpendPublicKeyP coin_pub;
|
||||
struct TALER_MerchantPublicKeyP merchant_pub;
|
||||
struct GNUNET_TIME_Absolute exec_time;
|
||||
struct TALER_Amount amount_with_fee;
|
||||
struct TALER_Amount deposit_fee;
|
||||
struct TALER_DenominationPublicKey denom_pub;
|
||||
json_t *wire;
|
||||
char *payto_uri;
|
||||
struct GNUNET_PQ_ResultSpec rs[] = {
|
||||
GNUNET_PQ_result_spec_uint64 ("aggregation_serial_id", &rowid),
|
||||
GNUNET_PQ_result_spec_auto_from_type ("h_contract_terms",
|
||||
&h_contract_terms),
|
||||
TALER_PQ_result_spec_json ("wire",
|
||||
&wire),
|
||||
GNUNET_PQ_result_spec_auto_from_type ("h_wire",
|
||||
&h_wire),
|
||||
GNUNET_PQ_result_spec_string ("payto_uri",
|
||||
&payto_uri),
|
||||
TALER_PQ_result_spec_denom_pub ("denom_pub",
|
||||
&denom_pub),
|
||||
GNUNET_PQ_result_spec_auto_from_type ("coin_pub",
|
||||
@ -6977,8 +6985,7 @@ handle_wt_result (void *cls,
|
||||
ctx->cb (ctx->cb_cls,
|
||||
rowid,
|
||||
&merchant_pub,
|
||||
&h_wire,
|
||||
wire,
|
||||
payto_uri,
|
||||
exec_time,
|
||||
&h_contract_terms,
|
||||
&denom_pub,
|
||||
@ -7070,13 +7077,18 @@ postgres_lookup_transfer_by_deposit (
|
||||
struct GNUNET_PQ_QueryParam params[] = {
|
||||
GNUNET_PQ_query_param_auto_from_type (coin_pub),
|
||||
GNUNET_PQ_query_param_auto_from_type (h_contract_terms),
|
||||
GNUNET_PQ_query_param_auto_from_type (h_wire),
|
||||
GNUNET_PQ_query_param_auto_from_type (merchant_pub),
|
||||
GNUNET_PQ_query_param_end
|
||||
};
|
||||
char *payto_uri;
|
||||
struct TALER_WireSalt wire_salt;
|
||||
struct GNUNET_PQ_ResultSpec rs[] = {
|
||||
GNUNET_PQ_result_spec_auto_from_type ("wtid_raw",
|
||||
wtid),
|
||||
GNUNET_PQ_result_spec_auto_from_type ("wire_salt",
|
||||
&wire_salt),
|
||||
GNUNET_PQ_result_spec_string ("payto_uri",
|
||||
&payto_uri),
|
||||
TALER_PQ_result_spec_absolute_time ("execution_date",
|
||||
exec_time),
|
||||
TALER_PQ_RESULT_SPEC_AMOUNT ("amount_with_fee",
|
||||
@ -7093,13 +7105,24 @@ postgres_lookup_transfer_by_deposit (
|
||||
rs);
|
||||
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs)
|
||||
{
|
||||
*pending = false;
|
||||
memset (kyc,
|
||||
0,
|
||||
sizeof (*kyc));
|
||||
kyc->type = TALER_EXCHANGEDB_KYC_DEPOSIT;
|
||||
kyc->ok = true;
|
||||
return qs;
|
||||
struct TALER_MerchantWireHash wh;
|
||||
|
||||
TALER_merchant_wire_signature_hash (payto_uri,
|
||||
&wire_salt,
|
||||
&wh);
|
||||
GNUNET_PQ_cleanup_result (rs);
|
||||
if (0 ==
|
||||
GNUNET_memcmp (&wh,
|
||||
h_wire))
|
||||
{
|
||||
*pending = false;
|
||||
memset (kyc,
|
||||
0,
|
||||
sizeof (*kyc));
|
||||
kyc->type = TALER_EXCHANGEDB_KYC_DEPOSIT;
|
||||
kyc->ok = true;
|
||||
return qs;
|
||||
}
|
||||
}
|
||||
if (0 > qs)
|
||||
return qs;
|
||||
@ -8653,7 +8676,7 @@ wire_out_serial_helper_cb (void *cls,
|
||||
uint64_t rowid;
|
||||
struct GNUNET_TIME_Absolute date;
|
||||
struct TALER_WireTransferIdentifierRawP wtid;
|
||||
json_t *wire;
|
||||
char *payto_uri;
|
||||
struct TALER_Amount amount;
|
||||
struct GNUNET_PQ_ResultSpec rs[] = {
|
||||
GNUNET_PQ_result_spec_uint64 ("wireout_uuid",
|
||||
@ -8662,8 +8685,8 @@ wire_out_serial_helper_cb (void *cls,
|
||||
&date),
|
||||
GNUNET_PQ_result_spec_auto_from_type ("wtid_raw",
|
||||
&wtid),
|
||||
TALER_PQ_result_spec_json ("wire_target",
|
||||
&wire),
|
||||
GNUNET_PQ_result_spec_string ("payto_uri",
|
||||
&payto_uri),
|
||||
TALER_PQ_RESULT_SPEC_AMOUNT ("amount",
|
||||
&amount),
|
||||
GNUNET_PQ_result_spec_end
|
||||
@ -8683,7 +8706,7 @@ wire_out_serial_helper_cb (void *cls,
|
||||
rowid,
|
||||
date,
|
||||
&wtid,
|
||||
wire,
|
||||
payto_uri,
|
||||
&amount);
|
||||
GNUNET_PQ_cleanup_result (rs);
|
||||
if (GNUNET_OK != ret)
|
||||
@ -9536,7 +9559,7 @@ missing_wire_cb (void *cls,
|
||||
uint64_t rowid;
|
||||
struct TALER_CoinSpendPublicKeyP coin_pub;
|
||||
struct TALER_Amount amount;
|
||||
json_t *wire;
|
||||
char *payto_uri;
|
||||
struct GNUNET_TIME_Absolute deadline;
|
||||
uint8_t tiny;
|
||||
uint8_t done;
|
||||
@ -9547,8 +9570,8 @@ missing_wire_cb (void *cls,
|
||||
&coin_pub),
|
||||
TALER_PQ_RESULT_SPEC_AMOUNT ("amount_with_fee",
|
||||
&amount),
|
||||
TALER_PQ_result_spec_json ("wire",
|
||||
&wire),
|
||||
GNUNET_PQ_result_spec_string ("payto_uri",
|
||||
&payto_uri),
|
||||
TALER_PQ_result_spec_absolute_time ("wire_deadline",
|
||||
&deadline),
|
||||
GNUNET_PQ_result_spec_auto_from_type ("tiny",
|
||||
@ -9571,7 +9594,7 @@ missing_wire_cb (void *cls,
|
||||
rowid,
|
||||
&coin_pub,
|
||||
&amount,
|
||||
wire,
|
||||
payto_uri,
|
||||
deadline,
|
||||
tiny,
|
||||
done);
|
||||
|
@ -779,7 +779,8 @@ static uint64_t deposit_rowid;
|
||||
* @param amount_with_fee amount that was deposited including fee
|
||||
* @param deposit_fee amount the exchange gets to keep as transaction fees
|
||||
* @param h_contract_terms hash of the proposal data known to merchant and customer
|
||||
* @param wire wire details for the merchant
|
||||
* @param wire_target unique ID of the receiver account
|
||||
* @param payto_uri how to pay the merchant, URI in payto://-format;
|
||||
* @return transaction status code, #GNUNET_DB_STATUS_SUCCESS_ONE_RESULT to continue to iterate
|
||||
*/
|
||||
static enum GNUNET_DB_QueryStatus
|
||||
@ -790,15 +791,12 @@ deposit_cb (void *cls,
|
||||
const struct TALER_Amount *amount_with_fee,
|
||||
const struct TALER_Amount *deposit_fee,
|
||||
const struct TALER_PrivateContractHash *h_contract_terms,
|
||||
const json_t *wire)
|
||||
uint64_t wire_target,
|
||||
const char *payto_uri)
|
||||
{
|
||||
struct TALER_EXCHANGEDB_Deposit *deposit = cls;
|
||||
struct TALER_MerchantWireHash h_wire;
|
||||
|
||||
deposit_rowid = rowid;
|
||||
GNUNET_assert (GNUNET_OK ==
|
||||
TALER_JSON_merchant_wire_signature_hash (wire,
|
||||
&h_wire));
|
||||
if ( (0 != GNUNET_memcmp (merchant_pub,
|
||||
&deposit->merchant_pub)) ||
|
||||
(0 != TALER_amount_cmp (amount_with_fee,
|
||||
@ -810,8 +808,8 @@ deposit_cb (void *cls,
|
||||
(0 != memcmp (coin_pub,
|
||||
&deposit->coin.coin_pub,
|
||||
sizeof (struct TALER_CoinSpendPublicKeyP))) ||
|
||||
(0 != GNUNET_memcmp (&h_wire,
|
||||
&deposit->h_wire)) )
|
||||
(0 != strcmp (payto_uri,
|
||||
deposit->receiver_wire_account)) )
|
||||
{
|
||||
GNUNET_break (0);
|
||||
return GNUNET_DB_STATUS_HARD_ERROR;
|
||||
@ -869,36 +867,18 @@ matching_deposit_cb (void *cls,
|
||||
* @param cls closure
|
||||
* @param rowid unique serial ID for the deposit in our DB
|
||||
* @param exchange_timestamp when did the deposit happen
|
||||
* @param wallet_timestamp when did the wallet sign the contract
|
||||
* @param merchant_pub public key of the merchant
|
||||
* @param deposit deposit details
|
||||
* @param denom_pub denomination of the @a coin_pub
|
||||
* @param coin_pub public key of the coin
|
||||
* @param coin_sig signature from the coin
|
||||
* @param amount_with_fee amount that was deposited including fee
|
||||
* @param h_contract_terms hash of the proposal data known to merchant and customer
|
||||
* @param refund_deadline by which the merchant advised that he might want
|
||||
* to get a refund
|
||||
* @param wire_deadline by which the merchant advised that he would like the
|
||||
* wire transfer to be executed
|
||||
* @param receiver_wire_account wire details for the merchant, NULL from iterate_matching_deposits()
|
||||
* @param done flag set if the deposit was already executed (or not)
|
||||
* @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop
|
||||
*/
|
||||
static int
|
||||
static enum GNUNET_GenericReturnValue
|
||||
audit_deposit_cb (void *cls,
|
||||
uint64_t rowid,
|
||||
struct GNUNET_TIME_Absolute exchange_timestamp,
|
||||
struct GNUNET_TIME_Absolute wallet_timestamp,
|
||||
const struct TALER_MerchantPublicKeyP *merchant_pub,
|
||||
const struct TALER_EXCHANGEDB_Deposit *deposit,
|
||||
const struct TALER_DenominationPublicKey *denom_pub,
|
||||
const struct TALER_CoinSpendPublicKeyP *coin_pub,
|
||||
const struct TALER_CoinSpendSignatureP *coin_sig,
|
||||
const struct TALER_Amount *amount_with_fee,
|
||||
const struct TALER_PrivateContractHash *h_contract_terms,
|
||||
struct GNUNET_TIME_Absolute refund_deadline,
|
||||
struct GNUNET_TIME_Absolute wire_deadline,
|
||||
const json_t *receiver_wire_account,
|
||||
int done)
|
||||
bool done)
|
||||
{
|
||||
auditor_row_cnt++;
|
||||
return GNUNET_OK;
|
||||
@ -1227,7 +1207,6 @@ test_wire_out (const struct TALER_EXCHANGEDB_Deposit *deposit)
|
||||
|
||||
/* setup values for wire transfer aggregation data */
|
||||
merchant_pub_wt = deposit->merchant_pub;
|
||||
h_wire_wt = deposit->h_wire;
|
||||
h_contract_terms_wt = deposit->h_contract_terms;
|
||||
coin_pub_wt = deposit->coin.coin_pub;
|
||||
|
||||
@ -1394,7 +1373,7 @@ drop:
|
||||
* @param rowid deposit table row of the coin's deposit
|
||||
* @param coin_pub public key of the coin
|
||||
* @param amount value of the deposit, including fee
|
||||
* @param wire where should the funds be wired
|
||||
* @param payto_uri where should the funds be wired
|
||||
* @param deadline what was the requested wire transfer deadline
|
||||
* @param tiny did the exchange defer this transfer because it is too small?
|
||||
* @param done did the exchange claim that it made a transfer?
|
||||
@ -1404,7 +1383,7 @@ wire_missing_cb (void *cls,
|
||||
uint64_t rowid,
|
||||
const struct TALER_CoinSpendPublicKeyP *coin_pub,
|
||||
const struct TALER_Amount *amount,
|
||||
const json_t *wire,
|
||||
const char *payto_uri,
|
||||
struct GNUNET_TIME_Absolute deadline,
|
||||
/* bool? */ int tiny,
|
||||
/* bool? */ int done)
|
||||
@ -1413,14 +1392,6 @@ wire_missing_cb (void *cls,
|
||||
struct TALER_MerchantWireHash h_wire;
|
||||
|
||||
(void) done;
|
||||
if (NULL != wire)
|
||||
GNUNET_assert (GNUNET_OK ==
|
||||
TALER_JSON_merchant_wire_signature_hash (wire,
|
||||
&h_wire));
|
||||
else
|
||||
memset (&h_wire,
|
||||
0,
|
||||
sizeof (h_wire));
|
||||
if (GNUNET_NO != tiny)
|
||||
{
|
||||
GNUNET_break (0);
|
||||
@ -1443,8 +1414,8 @@ wire_missing_cb (void *cls,
|
||||
GNUNET_break (0);
|
||||
result = 66;
|
||||
}
|
||||
if (0 != GNUNET_memcmp (&h_wire,
|
||||
&deposit->h_wire))
|
||||
if (0 != strcmp (payto_uri,
|
||||
&deposit->receiver_wire_account))
|
||||
{
|
||||
GNUNET_break (0);
|
||||
result = 66;
|
||||
@ -1868,7 +1839,6 @@ run (void *cls)
|
||||
FAILIF (1 !=
|
||||
plugin->have_deposit (plugin->cls,
|
||||
&deposit,
|
||||
GNUNET_YES,
|
||||
&deposit_fee,
|
||||
&r));
|
||||
FAILIF (now.abs_value_us != r.abs_value_us);
|
||||
@ -1966,7 +1936,6 @@ run (void *cls)
|
||||
FAILIF (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS !=
|
||||
plugin->have_deposit (plugin->cls,
|
||||
&deposit2,
|
||||
GNUNET_YES,
|
||||
&deposit_fee,
|
||||
&r));
|
||||
deposit2.merchant_pub = deposit.merchant_pub;
|
||||
@ -1974,7 +1943,6 @@ run (void *cls)
|
||||
FAILIF (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS !=
|
||||
plugin->have_deposit (plugin->cls,
|
||||
&deposit2,
|
||||
GNUNET_YES,
|
||||
&deposit_fee,
|
||||
&r));
|
||||
}
|
||||
|
@ -346,6 +346,18 @@ struct TALER_RefreshCommitmentP
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Age restriction commitment of a coin.
|
||||
*/
|
||||
struct TALER_AgeHash
|
||||
{
|
||||
/**
|
||||
* The commitment is a SHA-256 hash code.
|
||||
*/
|
||||
struct GNUNET_ShortHashCode shash;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Token used for access control to the merchant's unclaimed
|
||||
* orders.
|
||||
|
@ -127,6 +127,7 @@ enum TALER_EXCHANGEDB_ReplicatedTable
|
||||
{
|
||||
TALER_EXCHANGEDB_RT_DENOMINATIONS,
|
||||
TALER_EXCHANGEDB_RT_DENOMINATION_REVOCATIONS,
|
||||
TALER_EXCHANGEDB_RT_WIRE_TARGETS,
|
||||
TALER_EXCHANGEDB_RT_RESERVES,
|
||||
TALER_EXCHANGEDB_RT_RESERVES_IN,
|
||||
TALER_EXCHANGEDB_RT_RESERVES_CLOSE,
|
||||
@ -175,6 +176,8 @@ struct TALER_EXCHANGEDB_TableData
|
||||
*/
|
||||
struct
|
||||
{
|
||||
uint32_t denom_type;
|
||||
uint32_t age_restrictions;
|
||||
struct TALER_DenominationPublicKey denom_pub;
|
||||
struct TALER_MasterSignatureP master_sig;
|
||||
struct GNUNET_TIME_Absolute valid_from;
|
||||
@ -194,10 +197,16 @@ struct TALER_EXCHANGEDB_TableData
|
||||
uint64_t denominations_serial;
|
||||
} denomination_revocations;
|
||||
|
||||
struct
|
||||
{
|
||||
char *payto_uri;
|
||||
bool kyc_ok;
|
||||
char *oauth_username;
|
||||
} wire_targets;
|
||||
|
||||
struct
|
||||
{
|
||||
struct TALER_ReservePublicKeyP reserve_pub;
|
||||
char *account_details;
|
||||
/**
|
||||
* Note: not useful for auditor, because not UPDATEd!
|
||||
*/
|
||||
@ -210,7 +219,7 @@ struct TALER_EXCHANGEDB_TableData
|
||||
{
|
||||
uint64_t wire_reference;
|
||||
struct TALER_Amount credit;
|
||||
char *sender_account_details;
|
||||
uint64_t sender_account;
|
||||
char *exchange_account_section;
|
||||
struct GNUNET_TIME_Absolute execution_date;
|
||||
uint64_t reserve_uuid;
|
||||
@ -218,23 +227,23 @@ struct TALER_EXCHANGEDB_TableData
|
||||
|
||||
struct
|
||||
{
|
||||
uint64_t reserve_uuid;
|
||||
struct GNUNET_TIME_Absolute execution_date;
|
||||
struct TALER_WireTransferIdentifierRawP wtid;
|
||||
char *receiver_account;
|
||||
uint64_t receiver_account;
|
||||
struct TALER_Amount amount;
|
||||
struct TALER_Amount closing_fee;
|
||||
uint64_t reserve_uuid;
|
||||
} reserves_close;
|
||||
|
||||
struct
|
||||
{
|
||||
struct TALER_BlindedCoinHash h_blind_ev;
|
||||
uint64_t denominations_serial;
|
||||
struct TALER_DenominationSignature denom_sig;
|
||||
uint64_t reserve_uuid;
|
||||
struct TALER_ReserveSignatureP reserve_sig;
|
||||
struct GNUNET_TIME_Absolute execution_date;
|
||||
struct TALER_Amount amount_with_fee;
|
||||
uint64_t reserve_uuid;
|
||||
uint64_t denominations_serial;
|
||||
} reserves_out;
|
||||
|
||||
struct
|
||||
@ -269,40 +278,43 @@ struct TALER_EXCHANGEDB_TableData
|
||||
struct
|
||||
{
|
||||
struct TALER_CoinSpendPublicKeyP coin_pub;
|
||||
struct TALER_DenominationSignature denom_sig;
|
||||
struct TALER_AgeHash age_hash;
|
||||
uint64_t denominations_serial;
|
||||
struct TALER_DenominationSignature denom_sig;
|
||||
} known_coins;
|
||||
|
||||
struct
|
||||
{
|
||||
struct TALER_RefreshCommitmentP rc;
|
||||
uint64_t old_known_coin_id;
|
||||
struct TALER_CoinSpendSignatureP old_coin_sig;
|
||||
struct TALER_Amount amount_with_fee;
|
||||
uint32_t noreveal_index;
|
||||
uint64_t old_known_coin_id;
|
||||
} refresh_commitments;
|
||||
|
||||
struct
|
||||
{
|
||||
uint64_t melt_serial_id;
|
||||
uint32_t freshcoin_index;
|
||||
struct TALER_CoinSpendSignatureP link_sig;
|
||||
uint64_t denominations_serial;
|
||||
void *coin_ev;
|
||||
size_t coin_ev_size;
|
||||
// h_coin_ev omitted, to be recomputed!
|
||||
struct TALER_DenominationSignature ev_sig;
|
||||
uint64_t denominations_serial;
|
||||
uint64_t melt_serial_id;
|
||||
} refresh_revealed_coins;
|
||||
|
||||
struct
|
||||
{
|
||||
uint64_t melt_serial_id;
|
||||
struct TALER_TransferPublicKeyP tp;
|
||||
struct TALER_TransferPrivateKeyP tprivs[TALER_CNC_KAPPA - 1];
|
||||
uint64_t melt_serial_id;
|
||||
} refresh_transfer_keys;
|
||||
|
||||
struct
|
||||
{
|
||||
uint64_t shard;
|
||||
uint64_t known_coin_id;
|
||||
struct TALER_Amount amount_with_fee;
|
||||
struct GNUNET_TIME_Absolute wallet_timestamp;
|
||||
struct GNUNET_TIME_Absolute exchange_timestamp;
|
||||
@ -310,28 +322,28 @@ struct TALER_EXCHANGEDB_TableData
|
||||
struct GNUNET_TIME_Absolute wire_deadline;
|
||||
struct TALER_MerchantPublicKeyP merchant_pub;
|
||||
struct TALER_PrivateContractHash h_contract_terms;
|
||||
// h_wire omitted, to be recomputed!
|
||||
struct TALER_CoinSpendSignatureP coin_sig;
|
||||
json_t *wire;
|
||||
json_t *extensions;
|
||||
struct TALER_WireSalt wire_salt;
|
||||
uint64_t wire_target_serial_id;
|
||||
bool tiny;
|
||||
bool done;
|
||||
uint64_t known_coin_id;
|
||||
bool extension_blocked;
|
||||
json_t *extension_options;
|
||||
} deposits;
|
||||
|
||||
struct
|
||||
{
|
||||
uint64_t deposit_serial_id;
|
||||
struct TALER_MerchantSignatureP merchant_sig;
|
||||
uint64_t rtransaction_id;
|
||||
struct TALER_Amount amount_with_fee;
|
||||
uint64_t deposit_serial_id;
|
||||
} refunds;
|
||||
|
||||
struct
|
||||
{
|
||||
struct GNUNET_TIME_Absolute execution_date;
|
||||
struct TALER_WireTransferIdentifierRawP wtid_raw;
|
||||
json_t *wire_target;
|
||||
uint64_t wire_target_serial_id;
|
||||
char *exchange_account_section;
|
||||
struct TALER_Amount amount;
|
||||
} wire_out;
|
||||
@ -354,21 +366,21 @@ struct TALER_EXCHANGEDB_TableData
|
||||
|
||||
struct
|
||||
{
|
||||
uint64_t known_coin_id;
|
||||
struct TALER_CoinSpendSignatureP coin_sig;
|
||||
struct TALER_DenominationBlindingKeyP coin_blind;
|
||||
struct TALER_Amount amount;
|
||||
struct GNUNET_TIME_Absolute timestamp;
|
||||
uint64_t known_coin_id;
|
||||
uint64_t reserve_out_serial_id;
|
||||
} recoup;
|
||||
|
||||
struct
|
||||
{
|
||||
uint64_t known_coin_id;
|
||||
struct TALER_CoinSpendSignatureP coin_sig;
|
||||
struct TALER_DenominationBlindingKeyP coin_blind;
|
||||
struct TALER_Amount amount;
|
||||
struct GNUNET_TIME_Absolute timestamp;
|
||||
uint64_t known_coin_id;
|
||||
uint64_t rrc_serial;
|
||||
} recoup_refresh;
|
||||
|
||||
@ -1519,19 +1531,8 @@ typedef void
|
||||
* @param cls closure
|
||||
* @param rowid unique serial ID for the deposit in our DB
|
||||
* @param exchange_timestamp when did the deposit happen
|
||||
* @param wallet_timestamp when did the contract happen
|
||||
* @param merchant_pub public key of the merchant
|
||||
* @param deposit deposit details
|
||||
* @param denom_pub denomination public key of @a coin_pub
|
||||
* @param coin_pub public key of the coin
|
||||
* @param coin_sig signature from the coin
|
||||
* @param amount_with_fee amount that was deposited including fee
|
||||
* @param h_contract_terms hash of the proposal data known to merchant and customer
|
||||
* @param refund_deadline by which the merchant advised that he might want
|
||||
* to get a refund
|
||||
* @param wire_deadline by which the merchant advised that he would like the
|
||||
* wire transfer to be executed
|
||||
* @param receiver_wire_account wire details for the merchant including 'url' in payto://-format;
|
||||
* NULL from iterate_matching_deposits()
|
||||
* @param done flag set if the deposit was already executed (or not)
|
||||
* @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop
|
||||
*/
|
||||
@ -1841,7 +1842,7 @@ typedef void
|
||||
* @param rowid which row in the table is the information from (for diagnostics)
|
||||
* @param merchant_pub public key of the merchant (should be same for all callbacks with the same @e cls)
|
||||
* @param h_wire hash of wire transfer details of the merchant (should be same for all callbacks with the same @e cls)
|
||||
* @param account_details which account did the transfer go to?
|
||||
* @param account_payto_uri which account did the transfer go to?
|
||||
* @param exec_time execution time of the wire transfer (should be same for all callbacks with the same @e cls)
|
||||
* @param h_contract_terms which proposal was this payment about
|
||||
* @param denom_pub denomination of @a coin_pub
|
||||
@ -1854,8 +1855,7 @@ typedef void
|
||||
void *cls,
|
||||
uint64_t rowid,
|
||||
const struct TALER_MerchantPublicKeyP *merchant_pub,
|
||||
const struct TALER_MerchantWireHash *h_wire,
|
||||
const json_t *account_details,
|
||||
const char *account_payto_uri,
|
||||
struct GNUNET_TIME_Absolute exec_time,
|
||||
const struct TALER_PrivateContractHash *h_contract_terms,
|
||||
const struct TALER_DenominationPublicKey *denom_pub,
|
||||
@ -1872,7 +1872,7 @@ typedef void
|
||||
* @param rowid identifier of the respective row in the database
|
||||
* @param date timestamp of the wire transfer (roughly)
|
||||
* @param wtid wire transfer subject
|
||||
* @param wire wire transfer details of the receiver, including "url" in payto://-format
|
||||
* @param payto_uri details of the receiver, URI in payto://-format
|
||||
* @param amount amount that was wired
|
||||
* @return #GNUNET_OK to continue, #GNUNET_SYSERR to stop iteration
|
||||
*/
|
||||
@ -1882,7 +1882,7 @@ typedef enum GNUNET_GenericReturnValue
|
||||
uint64_t rowid,
|
||||
struct GNUNET_TIME_Absolute date,
|
||||
const struct TALER_WireTransferIdentifierRawP *wtid,
|
||||
const json_t *wire,
|
||||
const char *payto_uri,
|
||||
const struct TALER_Amount *amount);
|
||||
|
||||
|
||||
@ -2051,7 +2051,7 @@ typedef void
|
||||
* @param rowid deposit table row of the coin's deposit
|
||||
* @param coin_pub public key of the coin
|
||||
* @param amount value of the deposit, including fee
|
||||
* @param wire where should the funds be wired, including 'url' in payto://-format
|
||||
* @param payto_uri where should the funds be wired; URI in payto://-format
|
||||
* @param deadline what was the requested wire transfer deadline
|
||||
* @param tiny did the exchange defer this transfer because it is too small?
|
||||
* @param done did the exchange claim that it made a transfer?
|
||||
@ -2062,7 +2062,7 @@ typedef void
|
||||
uint64_t rowid,
|
||||
const struct TALER_CoinSpendPublicKeyP *coin_pub,
|
||||
const struct TALER_Amount *amount,
|
||||
const json_t *wire,
|
||||
const char *payto_uri,
|
||||
struct GNUNET_TIME_Absolute deadline,
|
||||
/* bool? */ int tiny,
|
||||
/* bool? */ int done);
|
||||
|
Loading…
Reference in New Issue
Block a user