aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/auditor/taler-helper-auditor-aggregation.c56
-rw-r--r--src/auditor/taler-helper-auditor-wire.c109
-rw-r--r--src/exchange/taler-exchange-httpd_transfers_get.c83
-rw-r--r--src/exchangedb/exchange-0001.sql4
-rw-r--r--src/exchangedb/irbt_callbacks.c55
-rw-r--r--src/exchangedb/lrbt_callbacks.c99
-rw-r--r--src/exchangedb/plugin_exchangedb_postgres.c7
-rw-r--r--src/include/taler_exchange_service.h4
-rw-r--r--src/include/taler_exchangedb_plugin.h2
-rw-r--r--src/include/taler_signatures.h4
-rw-r--r--src/lib/exchange_api_transfers_get.c6
11 files changed, 217 insertions, 212 deletions
diff --git a/src/auditor/taler-helper-auditor-aggregation.c b/src/auditor/taler-helper-auditor-aggregation.c
index 99fe16e01..d4ad08aaa 100644
--- a/src/auditor/taler-helper-auditor-aggregation.c
+++ b/src/auditor/taler-helper-auditor-aggregation.c
@@ -358,9 +358,9 @@ struct WireCheckContext
struct TALER_Amount total_deposits;
/**
- * Hash of the wire transfer details of the receiver.
+ * Target account details of the receiver.
*/
- struct TALER_MerchantWireHash h_wire;
+ const char *payto_uri;
/**
* Execution time of the wire transfer.
@@ -682,8 +682,7 @@ check_transaction_history_for_deposit (
* @param[in,out] cls a `struct WireCheckContext`
* @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 where did we transfer the funds?
+ * @param account_pay_uri where did we transfer the funds?
* @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
@@ -698,8 +697,7 @@ wire_transfer_information_cb (
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_pay_uri,
struct GNUNET_TIME_Absolute exec_time,
const struct TALER_PrivateContractHash *h_contract_terms,
const struct TALER_DenominationPublicKey *denom_pub,
@@ -714,24 +712,6 @@ wire_transfer_information_cb (
struct TALER_EXCHANGEDB_TransactionList *tl;
struct TALER_CoinPublicInfo coin;
enum GNUNET_DB_QueryStatus qs;
- struct TALER_MerchantWireHash hw;
-
- if (GNUNET_OK !=
- TALER_JSON_merchant_wire_signature_hash (account_details,
- &hw))
- {
- report_row_inconsistency ("aggregation",
- rowid,
- "failed to compute hash of given wire data");
- }
- else if (0 !=
- GNUNET_memcmp (&hw,
- h_wire))
- {
- report_row_inconsistency ("aggregation",
- rowid,
- "database contains wrong hash code for wire details");
- }
/* Obtain coin's transaction history */
qs = TALER_ARL_edb->get_coin_transactions (TALER_ARL_edb->cls,
@@ -857,14 +837,13 @@ wire_transfer_information_cb (
"aggregation (contribution)",
rowid,
&coin_value_without_fee,
- &
- total_deposit_without_refunds,
+ &total_deposit_without_refunds,
-1);
}
}
/* Check other details of wire transfer match */
- if (0 != GNUNET_memcmp (h_wire,
- &wcc->h_wire))
+ if (0 != strcmp (account_pay_uri,
+ wcc->payto_uri))
{
report_row_inconsistency ("aggregation",
rowid,
@@ -1007,16 +986,16 @@ get_wire_fee (struct AggregationContext *ac,
* @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
+ * @param payto_uri bank account details of the receiver
* @param amount amount that was wired
* @return #GNUNET_OK to continue, #GNUNET_SYSERR to stop iteration
*/
-static int
+static enum GNUNET_GenericReturnValue
check_wire_out_cb (void *cls,
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)
{
struct AggregationContext *ac = cls;
@@ -1035,7 +1014,7 @@ check_wire_out_cb (void *cls,
TALER_B2S (wtid),
TALER_amount2s (amount),
GNUNET_STRINGS_absolute_time_to_string (date));
- if (NULL == (method = TALER_JSON_wire_to_method (wire)))
+ if (NULL == (method = TALER_payto_get_method (payto_uri)))
{
report_row_inconsistency ("wire_out",
rowid,
@@ -1049,14 +1028,7 @@ check_wire_out_cb (void *cls,
GNUNET_assert (GNUNET_OK ==
TALER_amount_set_zero (amount->currency,
&wcc.total_deposits));
- if (GNUNET_OK !=
- TALER_JSON_merchant_wire_signature_hash (wire,
- &wcc.h_wire))
- {
- GNUNET_break (0);
- GNUNET_free (method);
- return GNUNET_SYSERR;
- }
+ wcc.payto_uri = payto_uri;
qs = TALER_ARL_edb->lookup_wire_transfer (TALER_ARL_edb->cls,
wtid,
&wire_transfer_information_cb,
@@ -1156,8 +1128,8 @@ check_wire_out_cb (void *cls,
TALER_ARL_report (report_wire_out_inconsistencies,
GNUNET_JSON_PACK (
- GNUNET_JSON_pack_object_incref ("destination_account",
- (json_t *) wire),
+ GNUNET_JSON_pack_string ("destination_account",
+ payto_uri),
GNUNET_JSON_pack_uint64 ("rowid",
rowid),
TALER_JSON_pack_amount ("expected",
diff --git a/src/auditor/taler-helper-auditor-wire.c b/src/auditor/taler-helper-auditor-wire.c
index 80a4568ff..3d8b0d1fd 100644
--- a/src/auditor/taler-helper-auditor-wire.c
+++ b/src/auditor/taler-helper-auditor-wire.c
@@ -942,16 +942,16 @@ check_time_difference (const char *table,
* @param rowid unique serial ID for the refresh session in our DB
* @param date timestamp of the transfer (roughly)
* @param wtid wire transfer subject
- * @param wire wire transfer details of the receiver
+ * @param payto_uri wire transfer details of the receiver
* @param amount amount that was wired
* @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop
*/
-static int
+static enum GNUNET_GenericReturnValue
wire_out_cb (void *cls,
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)
{
struct WireAccount *wa = cls;
@@ -997,62 +997,55 @@ wire_out_cb (void *cls,
return GNUNET_SYSERR;
return GNUNET_OK;
}
+ if (0 != strcasecmp (payto_uri,
+ roi->details.credit_account_uri))
{
- char *payto_uri;
-
- payto_uri = TALER_JSON_wire_to_payto (wire);
- if (0 != strcasecmp (payto_uri,
- roi->details.credit_account_uri))
- {
- /* Destination bank account is wrong in actual wire transfer, so
- we should count the wire transfer as entirely spurious, and
- additionally consider the justified wire transfer as missing. */
- TALER_ARL_report (report_wire_out_inconsistencies,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_uint64 ("row",
- rowid),
- TALER_JSON_pack_amount ("amount_wired",
- &roi->details.amount),
- TALER_JSON_pack_amount ("amount_justified",
- &zero),
- GNUNET_JSON_pack_data_auto ("wtid", wtid),
- TALER_JSON_pack_time_abs_human ("timestamp",
- date),
- GNUNET_JSON_pack_string ("diagnostic",
- "receiver account mismatch"),
- GNUNET_JSON_pack_string ("target",
- payto_uri),
- GNUNET_JSON_pack_string ("account_section",
- wa->ai->section_name)));
- TALER_ARL_amount_add (&total_bad_amount_out_plus,
- &total_bad_amount_out_plus,
- &roi->details.amount);
- TALER_ARL_report (report_wire_out_inconsistencies,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_uint64 ("row",
- rowid),
- TALER_JSON_pack_amount ("amount_wired",
- &zero),
- TALER_JSON_pack_amount ("amount_justified",
- amount),
- GNUNET_JSON_pack_data_auto ("wtid",
- wtid),
- TALER_JSON_pack_time_abs_human ("timestamp",
- date),
- GNUNET_JSON_pack_string ("diagnostic",
- "receiver account mismatch"),
- GNUNET_JSON_pack_string ("target",
- roi->details.
- credit_account_uri),
- GNUNET_JSON_pack_string ("account_section",
- wa->ai->section_name)));
- TALER_ARL_amount_add (&total_bad_amount_out_minus,
- &total_bad_amount_out_minus,
- amount);
- GNUNET_free (payto_uri);
- goto cleanup;
- }
- GNUNET_free (payto_uri);
+ /* Destination bank account is wrong in actual wire transfer, so
+ we should count the wire transfer as entirely spurious, and
+ additionally consider the justified wire transfer as missing. */
+ TALER_ARL_report (report_wire_out_inconsistencies,
+ GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_uint64 ("row",
+ rowid),
+ TALER_JSON_pack_amount ("amount_wired",
+ &roi->details.amount),
+ TALER_JSON_pack_amount ("amount_justified",
+ &zero),
+ GNUNET_JSON_pack_data_auto ("wtid", wtid),
+ TALER_JSON_pack_time_abs_human ("timestamp",
+ date),
+ GNUNET_JSON_pack_string ("diagnostic",
+ "receiver account mismatch"),
+ GNUNET_JSON_pack_string ("target",
+ payto_uri),
+ GNUNET_JSON_pack_string ("account_section",
+ wa->ai->section_name)));
+ TALER_ARL_amount_add (&total_bad_amount_out_plus,
+ &total_bad_amount_out_plus,
+ &roi->details.amount);
+ TALER_ARL_report (report_wire_out_inconsistencies,
+ GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_uint64 ("row",
+ rowid),
+ TALER_JSON_pack_amount ("amount_wired",
+ &zero),
+ TALER_JSON_pack_amount ("amount_justified",
+ amount),
+ GNUNET_JSON_pack_data_auto ("wtid",
+ wtid),
+ TALER_JSON_pack_time_abs_human ("timestamp",
+ date),
+ GNUNET_JSON_pack_string ("diagnostic",
+ "receiver account mismatch"),
+ GNUNET_JSON_pack_string ("target",
+ roi->details.
+ credit_account_uri),
+ GNUNET_JSON_pack_string ("account_section",
+ wa->ai->section_name)));
+ TALER_ARL_amount_add (&total_bad_amount_out_minus,
+ &total_bad_amount_out_minus,
+ amount);
+ goto cleanup;
}
if (0 != TALER_amount_cmp (&roi->details.amount,
amount))
diff --git a/src/exchange/taler-exchange-httpd_transfers_get.c b/src/exchange/taler-exchange-httpd_transfers_get.c
index 8d41cfdf8..e63acdc2a 100644
--- a/src/exchange/taler-exchange-httpd_transfers_get.c
+++ b/src/exchange/taler-exchange-httpd_transfers_get.c
@@ -77,7 +77,7 @@ struct AggregatedDepositDetail
* @param connection connection to the client
* @param total total amount that was transferred
* @param merchant_pub public key of the merchant
- * @param h_wire destination account
+ * @param payto_uri destination account
* @param wire_fee wire fee that was charged
* @param exec_time execution time of the wire transfer
* @param wdd_head linked list with details about the combined deposits
@@ -87,7 +87,7 @@ static MHD_RESULT
reply_transfer_details (struct MHD_Connection *connection,
const struct TALER_Amount *total,
const struct TALER_MerchantPublicKeyP *merchant_pub,
- const struct TALER_MerchantWireHash *h_wire,
+ const char *payto_uri,
const struct TALER_Amount *wire_fee,
struct GNUNET_TIME_Absolute exec_time,
const struct AggregatedDepositDetail *wdd_head)
@@ -145,7 +145,8 @@ reply_transfer_details (struct MHD_Connection *connection,
TALER_amount_hton (&wdp.wire_fee,
wire_fee);
wdp.merchant_pub = *merchant_pub;
- wdp.h_wire = *h_wire;
+ TALER_payto_hash (payto_uri,
+ &wdp.h_payto);
GNUNET_CRYPTO_hash_context_finish (hash_context,
&wdp.h_details);
{
@@ -172,8 +173,8 @@ reply_transfer_details (struct MHD_Connection *connection,
wire_fee),
GNUNET_JSON_pack_data_auto ("merchant_pub",
merchant_pub),
- GNUNET_JSON_pack_data_auto ("h_wire",
- h_wire),
+ GNUNET_JSON_pack_data_auto ("h_payto",
+ &wdp.h_payto),
GNUNET_JSON_pack_time_abs ("execution_time",
exec_time),
GNUNET_JSON_pack_array_steal ("deposits",
@@ -211,12 +212,6 @@ struct WtidTransactionContext
struct TALER_MerchantPublicKeyP merchant_pub;
/**
- * Hash of the wire details of the merchant (identical for all
- * deposits), only valid if @e is_valid is #GNUNET_YES.
- */
- struct TALER_MerchantWireHash h_wire;
-
- /**
* Wire fee applicable at @e exec_time.
*/
struct TALER_Amount wire_fee;
@@ -237,9 +232,9 @@ struct WtidTransactionContext
struct AggregatedDepositDetail *wdd_tail;
/**
- * Which method was used to wire the funds?
+ * Where were the funds wired?
*/
- char *wire_method;
+ char *payto_uri;
/**
* JSON array with details about the individual deposits.
@@ -253,7 +248,7 @@ struct WtidTransactionContext
* (as they should). Set to #GNUNET_SYSERR if we encountered an
* internal error.
*/
- int is_valid;
+ enum GNUNET_GenericReturnValue is_valid;
};
@@ -265,8 +260,7 @@ struct WtidTransactionContext
* @param cls our context for transmission
* @param rowid which row in the DB is the information from (for diagnostics), ignored
* @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 wire where the funds were sent
+ * @param account_payto_uri where the funds were sent
* @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 public key of the @a coin_pub (ignored)
@@ -278,8 +272,7 @@ static void
handle_deposit_data (void *cls,
uint64_t rowid,
const struct TALER_MerchantPublicKeyP *merchant_pub,
- const struct TALER_MerchantWireHash *h_wire,
- const json_t *wire,
+ const char *account_payto_uri,
struct GNUNET_TIME_Absolute exec_time,
const struct TALER_PrivateContractHash *h_contract_terms,
const struct TALER_DenominationPublicKey *denom_pub,
@@ -288,25 +281,17 @@ handle_deposit_data (void *cls,
const struct TALER_Amount *deposit_fee)
{
struct WtidTransactionContext *ctx = cls;
- char *wire_method;
(void) rowid;
(void) denom_pub;
if (GNUNET_SYSERR == ctx->is_valid)
return;
- if (NULL == (wire_method = TALER_JSON_wire_to_method (wire)))
- {
- GNUNET_break (0);
- ctx->is_valid = GNUNET_SYSERR;
- return;
- }
if (GNUNET_NO == ctx->is_valid)
{
/* First one we encounter, setup general information in 'ctx' */
ctx->merchant_pub = *merchant_pub;
- ctx->h_wire = *h_wire;
+ ctx->payto_uri = GNUNET_strdup (account_payto_uri);
ctx->exec_time = exec_time;
- ctx->wire_method = wire_method; /* captures the reference */
ctx->is_valid = GNUNET_YES;
if (0 >
TALER_amount_subtract (&ctx->total,
@@ -326,17 +311,13 @@ handle_deposit_data (void *cls,
(it should, otherwise the deposits should not have been aggregated) */
if ( (0 != GNUNET_memcmp (&ctx->merchant_pub,
merchant_pub)) ||
- (0 != strcmp (wire_method,
- ctx->wire_method)) ||
- (0 != GNUNET_memcmp (&ctx->h_wire,
- h_wire)) )
+ (0 != strcmp (account_payto_uri,
+ ctx->payto_uri)) )
{
GNUNET_break (0);
ctx->is_valid = GNUNET_SYSERR;
- GNUNET_free (wire_method);
return;
}
- GNUNET_free (wire_method);
if (0 >
TALER_amount_subtract (&delta,
deposit_value,
@@ -389,8 +370,7 @@ free_ctx (struct WtidTransactionContext *ctx)
wdd);
GNUNET_free (wdd);
}
- GNUNET_free (ctx->wire_method);
- ctx->wire_method = NULL;
+ GNUNET_free (ctx->payto_uri);
}
@@ -458,14 +438,29 @@ get_transfer_deposits (void *cls,
NULL);
return GNUNET_DB_STATUS_HARD_ERROR;
}
- qs = TEH_plugin->get_wire_fee (TEH_plugin->cls,
- ctx->wire_method,
- ctx->exec_time,
- &wire_fee_start_date,
- &wire_fee_end_date,
- &ctx->wire_fee,
- &closing_fee,
- &wire_fee_master_sig);
+ {
+ char *wire_method;
+
+ wire_method = TALER_payto_get_method (ctx->payto_uri);
+ if (NULL == wire_method)
+ {
+ GNUNET_break (0);
+ *mhd_ret = TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_DB_INVARIANT_FAILURE,
+ "payto:// without wire method encountered");
+ return GNUNET_DB_STATUS_HARD_ERROR;
+ }
+ qs = TEH_plugin->get_wire_fee (TEH_plugin->cls,
+ wire_method,
+ ctx->exec_time,
+ &wire_fee_start_date,
+ &wire_fee_end_date,
+ &ctx->wire_fee,
+ &closing_fee,
+ &wire_fee_master_sig);
+ GNUNET_free (wire_method);
+ }
if (0 >= qs)
{
if ( (GNUNET_DB_STATUS_HARD_ERROR == qs) ||
@@ -530,7 +525,7 @@ TEH_handler_transfers_get (struct TEH_RequestContext *rc,
mhd_ret = reply_transfer_details (rc->connection,
&ctx.total,
&ctx.merchant_pub,
- &ctx.h_wire,
+ ctx.payto_uri,
&ctx.wire_fee,
ctx.exec_time,
ctx.wdd_head);
diff --git a/src/exchangedb/exchange-0001.sql b/src/exchangedb/exchange-0001.sql
index 905b5450c..e82d82b4b 100644
--- a/src/exchangedb/exchange-0001.sql
+++ b/src/exchangedb/exchange-0001.sql
@@ -143,8 +143,8 @@ CREATE INDEX IF NOT EXISTS reserves_in_exchange_account_serial
reserve_in_serial_id DESC
);
-
-CREATE TABLE IF NOT EXISTS reserves_close
+qq
+CREATE TABLE IF NOT EXISTS reserves_closeq
(close_uuid BIGSERIAL PRIMARY KEY
,reserve_uuid INT8 NOT NULL REFERENCES reserves (reserve_uuid) ON DELETE CASCADE
,execution_date INT8 NOT NULL
diff --git a/src/exchangedb/irbt_callbacks.c b/src/exchangedb/irbt_callbacks.c
index fe0df26b2..f008a2fe4 100644
--- a/src/exchangedb/irbt_callbacks.c
+++ b/src/exchangedb/irbt_callbacks.c
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet
- Copyright (C) 2020 Taler Systems SA
+ Copyright (C) 2020, 2021 Taler Systems SA
GNUnet is free software: you can redistribute it and/or modify it
under the terms of the GNU Affero General Public License as published
@@ -100,6 +100,37 @@ irbt_cb_table_denomination_revocations (
/**
+ * Function called with denominations records to insert into table.
+ *
+ * @param pg plugin context
+ * @param td record to insert
+ */
+static enum GNUNET_DB_QueryStatus
+irbt_cb_table_wire_targets (struct PostgresClosure *pg,
+ const struct TALER_EXCHANGEDB_TableData *td)
+{
+ struct TALER_PaytoHash payto_hash;
+ struct GNUNET_PQ_QueryParam params[] = {
+ GNUNET_PQ_query_param_auto_from_type (&payto_hash),
+ GNUNET_PQ_query_param_string (
+ td->details.wire_targets.payto_uri),
+ GNUNET_PQ_query_param_auto_from_type (
+ &td->details.wire_targets.kyc_ok),
+ GNUNET_PQ_query_param_string (
+ td->details.wire_targets.oauth_username),
+ GNUNET_PQ_query_param_end
+ };
+
+ TALER_payto_hash (
+ td->details.wire_targets.payto_uri,
+ &payto_hash);
+ return GNUNET_PQ_eval_prepared_non_select (pg->conn,
+ "insert_into_table_wire_targets",
+ params);
+}
+
+
+/**
* Function called with reserves records to insert into table.
*
* @param pg plugin context
@@ -112,7 +143,6 @@ irbt_cb_table_reserves (struct PostgresClosure *pg,
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_uint64 (&td->serial),
GNUNET_PQ_query_param_auto_from_type (&td->details.reserves.reserve_pub),
- GNUNET_PQ_query_param_string (td->details.reserves.account_details),
TALER_PQ_query_param_amount (&td->details.reserves.current_balance),
TALER_PQ_query_param_absolute_time (&td->details.reserves.expiration_date),
TALER_PQ_query_param_absolute_time (&td->details.reserves.gc_date),
@@ -139,8 +169,7 @@ irbt_cb_table_reserves_in (struct PostgresClosure *pg,
GNUNET_PQ_query_param_uint64 (&td->serial),
GNUNET_PQ_query_param_uint64 (&td->details.reserves_in.wire_reference),
TALER_PQ_query_param_amount (&td->details.reserves_in.credit),
- GNUNET_PQ_query_param_string (
- td->details.reserves_in.sender_account_details),
+ GNUNET_PQ_query_param_uint64 (&td->details.reserves_in.sender_account),
GNUNET_PQ_query_param_string (
td->details.reserves_in.exchange_account_section),
TALER_PQ_query_param_absolute_time (
@@ -170,7 +199,8 @@ irbt_cb_table_reserves_close (struct PostgresClosure *pg,
TALER_PQ_query_param_absolute_time (
&td->details.reserves_close.execution_date),
GNUNET_PQ_query_param_auto_from_type (&td->details.reserves_close.wtid),
- GNUNET_PQ_query_param_string (td->details.reserves_close.receiver_account),
+ GNUNET_PQ_query_param_uint64 (
+ &td->details.reserves_close.wire_target_serial_id),
TALER_PQ_query_param_amount (&td->details.reserves_close.amount),
TALER_PQ_query_param_amount (&td->details.reserves_close.closing_fee),
GNUNET_PQ_query_param_uint64 (&td->details.reserves_close.reserve_uuid),
@@ -462,9 +492,11 @@ irbt_cb_table_deposits (struct PostgresClosure *pg,
{
uint8_t tiny = td->details.deposits.tiny ? 1 : 0;
uint8_t done = td->details.deposits.done ? 1 : 0;
- struct TALER_MerchantWireHash h_wire;
+ uint8_t extension_blocked = td->details.deposits.extension_blocked ? 1 : 0;
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_uint64 (&td->serial),
+ GNUNET_PQ_query_param_uint64 (&td->details.deposits.shard),
+ GNUNET_PQ_query_param_uint64 (&td->details.deposits.known_coin_id),
TALER_PQ_query_param_amount (&td->details.deposits.amount_with_fee),
TALER_PQ_query_param_absolute_time (&td->details.deposits.wallet_timestamp),
TALER_PQ_query_param_absolute_time (
@@ -474,17 +506,16 @@ irbt_cb_table_deposits (struct PostgresClosure *pg,
GNUNET_PQ_query_param_auto_from_type (&td->details.deposits.merchant_pub),
GNUNET_PQ_query_param_auto_from_type (
&td->details.deposits.h_contract_terms),
- GNUNET_PQ_query_param_auto_from_type (&h_wire),
GNUNET_PQ_query_param_auto_from_type (&td->details.deposits.coin_sig),
- TALER_PQ_query_param_json (td->details.deposits.wire),
+ GNUNET_PQ_query_param_auto_from_type (&td->details.deposits.wire_salt),
+ GNUNET_PQ_query_param_uint64 (&td->details.deposits.wire_target_serial_id),
GNUNET_PQ_query_param_auto_from_type (&tiny),
GNUNET_PQ_query_param_auto_from_type (&done),
- GNUNET_PQ_query_param_uint64 (&td->details.deposits.known_coin_id),
+ GNUNET_PQ_query_param_auto_from_type (&extension_blocked),
+ TALER_PQ_query_param_json (td->details.deposits.extension_options),
GNUNET_PQ_query_param_end
};
- TALER_JSON_merchant_wire_signature_hash (td->details.deposits.wire,
- &h_wire);
return GNUNET_PQ_eval_prepared_non_select (pg->conn,
"insert_into_table_deposits",
params);
@@ -530,7 +561,7 @@ irbt_cb_table_wire_out (struct PostgresClosure *pg,
GNUNET_PQ_query_param_uint64 (&td->serial),
TALER_PQ_query_param_absolute_time (&td->details.wire_out.execution_date),
GNUNET_PQ_query_param_auto_from_type (&td->details.wire_out.wtid_raw),
- TALER_PQ_query_param_json (td->details.wire_out.wire_target),
+ GNUNET_PQ_query_param_uint64 (&td->details.wire_out.wire_target_serial_id),
GNUNET_PQ_query_param_string (
td->details.wire_out.exchange_account_section),
TALER_PQ_query_param_amount (&td->details.wire_out.amount),
diff --git a/src/exchangedb/lrbt_callbacks.c b/src/exchangedb/lrbt_callbacks.c
index 2edff5584..f52fc3ab5 100644
--- a/src/exchangedb/lrbt_callbacks.c
+++ b/src/exchangedb/lrbt_callbacks.c
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet
- Copyright (C) 2020 Taler Systems SA
+ Copyright (C) 2020, 2021 Taler Systems SA
GNUnet is free software: you can redistribute it and/or modify it
under the terms of the GNU Affero General Public License as published
@@ -156,7 +156,6 @@ lrbt_cb_table_wire_targets (void *cls,
unsigned int num_results)
{
struct LookupRecordsByTableContext *ctx = cls;
- struct PostgresClosure *pg = ctx->pg;
struct TALER_EXCHANGEDB_TableData td = {
.table = TALER_EXCHANGEDB_RT_WIRE_TARGETS
};
@@ -216,8 +215,6 @@ lrbt_cb_table_reserves (void *cls,
&td.serial),
GNUNET_PQ_result_spec_auto_from_type ("reserve_pub",
&td.details.reserves.reserve_pub),
- GNUNET_PQ_result_spec_string ("account_details",
- &td.details.reserves.account_details),
TALER_PQ_RESULT_SPEC_AMOUNT ("current_balance",
&td.details.reserves.current_balance),
TALER_PQ_result_spec_absolute_time ("expiration_date",
@@ -270,12 +267,11 @@ lrbt_cb_table_reserves_in (void *cls,
&td.details.reserves_in.wire_reference),
TALER_PQ_RESULT_SPEC_AMOUNT ("credit",
&td.details.reserves_in.credit),
- GNUNET_PQ_result_spec_string ("sender_account_details",
- &td.details.reserves_in.
- sender_account_details),
- GNUNET_PQ_result_spec_string ("exchange_account_section",
- &td.details.reserves_in.
- exchange_account_section),
+ GNUNET_PQ_result_spec_uint64 ("sender_account",
+ &td.details.reserves_in.sender_account),
+ GNUNET_PQ_result_spec_string (
+ "exchange_account_section",
+ &td.details.reserves_in.exchange_account_section),
TALER_PQ_result_spec_absolute_time ("execution_date",
&td.details.reserves_in.execution_date),
GNUNET_PQ_result_spec_uint64 ("reserve_uuid",
@@ -322,21 +318,20 @@ lrbt_cb_table_reserves_close (void *cls,
struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_uint64 ("serial",
&td.serial),
+ GNUNET_PQ_result_spec_uint64 ("reserve_uuid",
+ &td.details.reserves_close.reserve_uuid),
TALER_PQ_result_spec_absolute_time (
"execution_date",
&td.details.reserves_close.execution_date),
GNUNET_PQ_result_spec_auto_from_type ("wtid",
&td.details.reserves_close.wtid),
- GNUNET_PQ_result_spec_string (
- "receiver_account",
- &td.details.reserves_close.receiver_account),
+ GNUNET_PQ_result_spec_uint64 (
+ "wire_target_serial_id",
+ &td.details.reserves_close.wire_target_serial_id),
TALER_PQ_RESULT_SPEC_AMOUNT ("amount",
&td.details.reserves_close.amount),
TALER_PQ_RESULT_SPEC_AMOUNT ("closing_fee",
&td.details.reserves_close.closing_fee),
- GNUNET_PQ_result_spec_uint64 ("reserve_uuid",
- &td.details.reserves_close.reserve_uuid),
-
GNUNET_PQ_result_spec_end
};
@@ -377,25 +372,30 @@ lrbt_cb_table_reserves_out (void *cls,
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_auto_from_type ("h_blind_ev",
- &td.details.reserves_out.h_blind_ev),
+ GNUNET_PQ_result_spec_uint64 (
+ "serial",
+ &td.serial),
+ GNUNET_PQ_result_spec_auto_from_type (
+ "h_blind_ev",
+ &td.details.reserves_out.h_blind_ev),
+ GNUNET_PQ_result_spec_uint64 (
+ "denominations_serial",
+ &td.details.reserves_out.denominations_serial),
TALER_PQ_result_spec_denom_sig (
"denom_sig",
&td.details.reserves_out.denom_sig),
- GNUNET_PQ_result_spec_auto_from_type ("reserve_sig",
- &td.details.reserves_out.reserve_sig),
+ GNUNET_PQ_result_spec_uint64 (
+ "reserve_uuid",
+ &td.details.reserves_out.reserve_uuid),
+ GNUNET_PQ_result_spec_auto_from_type (
+ "reserve_sig",
+ &td.details.reserves_out.reserve_sig),
TALER_PQ_result_spec_absolute_time (
"execution_date",
&td.details.reserves_out.execution_date),
- TALER_PQ_RESULT_SPEC_AMOUNT ("amount_with_fee",
- &td.details.reserves_out.amount_with_fee),
- GNUNET_PQ_result_spec_uint64 ("reserve_uuid",
- &td.details.reserves_out.reserve_uuid),
- GNUNET_PQ_result_spec_uint64 ("denominations_serial",
- &td.details.reserves_out.
- denominations_serial),
+ TALER_PQ_RESULT_SPEC_AMOUNT (
+ "amount_with_fee",
+ &td.details.reserves_out.amount_with_fee),
GNUNET_PQ_result_spec_end
};
@@ -883,6 +883,9 @@ lrbt_cb_table_deposits (void *cls,
GNUNET_PQ_result_spec_uint64 (
"shard",
&td.details.deposits.shard),
+ GNUNET_PQ_result_spec_uint64 (
+ "known_coin_id",
+ &td.details.deposits.known_coin_id),
TALER_PQ_RESULT_SPEC_AMOUNT (
"amount_with_fee",
&td.details.deposits.amount_with_fee),
@@ -907,24 +910,24 @@ lrbt_cb_table_deposits (void *cls,
GNUNET_PQ_result_spec_auto_from_type (
"coin_sig",
&td.details.deposits.coin_sig),
+ GNUNET_PQ_result_spec_auto_from_type (
+ "wire_salt",
+ &td.details.deposits.wire_salt),
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),
GNUNET_PQ_result_spec_auto_from_type (
"done",
&td.details.deposits.done),
- GNUNET_PQ_result_spec_uint64 (
- "known_coin_id",
- &td.details.deposits.known_coin_id),
+ GNUNET_PQ_result_spec_auto_from_type (
+ "extension_blocked",
+ &td.details.deposits.extension_blocked),
+ TALER_PQ_result_spec_json (
+ "extension_options",
+ &td.details.deposits.extension_options),
GNUNET_PQ_result_spec_end
};
@@ -1019,17 +1022,21 @@ lrbt_cb_table_wire_out (void *cls,
struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_uint64 ("serial",
&td.serial),
- TALER_PQ_result_spec_absolute_time ("execution_date",
- &td.details.wire_out.execution_date),
- GNUNET_PQ_result_spec_auto_from_type ("wtid_raw",
- &td.details.wire_out.wtid_raw),
- TALER_PQ_result_spec_json ("wire_target",
- &td.details.wire_out.wire_target),
+ TALER_PQ_result_spec_absolute_time (
+ "execution_date",
+ &td.details.wire_out.execution_date),
+ GNUNET_PQ_result_spec_auto_from_type (
+ "wtid_raw",
+ &td.details.wire_out.wtid_raw),
+ GNUNET_PQ_result_spec_uint64 (
+ "wire_target_serial_id",
+ &td.details.wire_out.wire_target_serial_id),
GNUNET_PQ_result_spec_string (
"exchange_account_section",
&td.details.wire_out.exchange_account_section),
- TALER_PQ_RESULT_SPEC_AMOUNT ("amount",
- &td.details.wire_out.amount),
+ TALER_PQ_RESULT_SPEC_AMOUNT (
+ "amount",
+ &td.details.wire_out.amount),
GNUNET_PQ_result_spec_end
};
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c
index 846b59b01..fe21b9d30 100644
--- a/src/exchangedb/plugin_exchangedb_postgres.c
+++ b/src/exchangedb/plugin_exchangedb_postgres.c
@@ -10729,6 +10729,10 @@ postgres_lookup_records_by_table (void *cls,
statement = "select_above_serial_by_table_denomination_revocations";
rh = &lrbt_cb_table_denomination_revocations;
break;
+ case TALER_EXCHANGEDB_RT_WIRE_TARGETS:
+ statement = "select_above_serial_by_table_wire_targets";
+ rh = &lrbt_cb_table_wire_targets;
+ break;
case TALER_EXCHANGEDB_RT_RESERVES:
statement = "select_above_serial_by_table_reserves";
rh = &lrbt_cb_table_reserves;
@@ -10862,6 +10866,9 @@ postgres_insert_records_by_table (void *cls,
case TALER_EXCHANGEDB_RT_DENOMINATION_REVOCATIONS:
rh = &irbt_cb_table_denomination_revocations;
break;
+ case TALER_EXCHANGEDB_RT_WIRE_TARGETS:
+ rh = &irbt_cb_table_wire_targets;
+ break;
case TALER_EXCHANGEDB_RT_RESERVES:
rh = &irbt_cb_table_reserves;
break;
diff --git a/src/include/taler_exchange_service.h b/src/include/taler_exchange_service.h
index 7f3436cce..36a23598e 100644
--- a/src/include/taler_exchange_service.h
+++ b/src/include/taler_exchange_service.h
@@ -1709,9 +1709,9 @@ struct TALER_EXCHANGE_TransferData
struct TALER_ExchangeSignatureP exchange_sig;
/**
- * hash of the wire transfer address the transfer went to
+ * hash of the payto:// URI the transfer went to
*/
- struct TALER_MerchantWireHash h_wire;
+ struct TALER_PaytoHash h_wire;
/**
* time when the exchange claims to have performed the wire transfer
diff --git a/src/include/taler_exchangedb_plugin.h b/src/include/taler_exchangedb_plugin.h
index 1c5b92589..ac4bd9d86 100644
--- a/src/include/taler_exchangedb_plugin.h
+++ b/src/include/taler_exchangedb_plugin.h
@@ -230,7 +230,7 @@ struct TALER_EXCHANGEDB_TableData
uint64_t reserve_uuid;
struct GNUNET_TIME_Absolute execution_date;
struct TALER_WireTransferIdentifierRawP wtid;
- uint64_t receiver_account;
+ uint64_t wire_target_serial_id;
struct TALER_Amount amount;
struct TALER_Amount closing_fee;
} reserves_close;
diff --git a/src/include/taler_signatures.h b/src/include/taler_signatures.h
index f0da70d4c..56d59767e 100644
--- a/src/include/taler_signatures.h
+++ b/src/include/taler_signatures.h
@@ -1383,9 +1383,9 @@ struct TALER_WireDepositDataPS
struct TALER_MerchantPublicKeyP merchant_pub;
/**
- * Hash of wire details of the merchant.
+ * Hash of bank account of the merchant.
*/
- struct TALER_MerchantWireHash h_wire;
+ struct TALER_PaytoHash h_payto;
/**
* Hash of the individual deposits that were aggregated,
diff --git a/src/lib/exchange_api_transfers_get.c b/src/lib/exchange_api_transfers_get.c
index 0002d6af6..87d654c05 100644
--- a/src/lib/exchange_api_transfers_get.c
+++ b/src/lib/exchange_api_transfers_get.c
@@ -79,7 +79,7 @@ struct TALER_EXCHANGE_TransfersGetHandle
* @return #GNUNET_OK if we are done and all is well,
* #GNUNET_SYSERR if the response was bogus
*/
-static int
+static enum GNUNET_GenericReturnValue
check_transfers_get_response_ok (
struct TALER_EXCHANGE_TransfersGetHandle *wdh,
const json_t *json)
@@ -92,7 +92,7 @@ check_transfers_get_response_ok (
TALER_JSON_spec_amount_any ("total", &td.total_amount),
TALER_JSON_spec_amount_any ("wire_fee", &td.wire_fee),
GNUNET_JSON_spec_fixed_auto ("merchant_pub", &merchant_pub),
- GNUNET_JSON_spec_fixed_auto ("h_wire", &td.h_wire),
+ GNUNET_JSON_spec_fixed_auto ("h_payto", &td.h_payto),
TALER_JSON_spec_absolute_time ("execution_time", &td.execution_time),
GNUNET_JSON_spec_json ("deposits", &details_j),
GNUNET_JSON_spec_fixed_auto ("exchange_sig", &td.exchange_sig),
@@ -199,7 +199,7 @@ check_transfers_get_response_ok (
TALER_SIGNATURE_EXCHANGE_CONFIRM_WIRE_DEPOSIT),
.purpose.size = htonl (sizeof (wdp)),
.merchant_pub = merchant_pub,
- .h_wire = td.h_wire
+ .h_payto = td.h_payto
};
TALER_amount_hton (&wdp.total,