aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-05-08 12:44:40 +0200
committerChristian Grothoff <christian@grothoff.org>2017-05-08 12:44:40 +0200
commit5e36e520a5a9d1461cf0efaee777238a46f1890b (patch)
tree1bc5d9816bbdae9c654634ec88de25184255a26b /src
parent18a020dd0241fbb7deead15b96d5f5fed9f1b9b5 (diff)
updates to distinguish clearly between wtid and json transfer details
Diffstat (limited to 'src')
-rw-r--r--src/exchange-lib/exchange_api_reserve.c2
-rw-r--r--src/exchange/taler-exchange-aggregator.c12
-rw-r--r--src/exchange/taler-exchange-httpd_responses.c4
-rw-r--r--src/exchangedb/plugin_exchangedb_postgres.c20
-rw-r--r--src/include/taler_exchangedb_plugin.h10
-rw-r--r--src/include/taler_wire_plugin.h2
-rw-r--r--src/wire/plugin_wire_test.c5
7 files changed, 31 insertions, 24 deletions
diff --git a/src/exchange-lib/exchange_api_reserve.c b/src/exchange-lib/exchange_api_reserve.c
index 89c4fdc08..716be641d 100644
--- a/src/exchange-lib/exchange_api_reserve.c
+++ b/src/exchange-lib/exchange_api_reserve.c
@@ -335,7 +335,7 @@ parse_reserve_history (struct TALER_EXCHANGE_Handle *exchange,
struct GNUNET_JSON_Specification closing_spec[] = {
GNUNET_JSON_spec_json ("receiver_account_details",
&rhistory[off].details.close_details.receiver_account_details),
- GNUNET_JSON_spec_fixed_auto ("wire_transfer",
+ GNUNET_JSON_spec_fixed_auto ("wtid",
&rhistory[off].details.close_details.wtid),
GNUNET_JSON_spec_fixed_auto ("exchange_sig",
&rhistory[off].details.close_details.exchange_sig),
diff --git a/src/exchange/taler-exchange-aggregator.c b/src/exchange/taler-exchange-aggregator.c
index 39e61f3ad..2931d27af 100644
--- a/src/exchange/taler-exchange-aggregator.c
+++ b/src/exchange/taler-exchange-aggregator.c
@@ -48,7 +48,7 @@ struct WirePlugin
* Handle to the plugin.
*/
struct TALER_WIRE_Plugin *wire_plugin;
-
+
/**
* Name of the plugin.
*/
@@ -745,7 +745,7 @@ prepare_close_cb (void *cls,
const char *buf,
size_t buf_size)
{
- GNUNET_assert (cls == ctc);
+ GNUNET_assert (cls == ctc);
ctc->ph = NULL;
if (NULL == buf)
{
@@ -801,7 +801,7 @@ prepare_close_cb (void *cls,
* Function called with details about expired reserves.
* We trigger the reserve closure by inserting the respective
* closing record and prewire instructions into the respective
- * tables.
+ * tables.
*
* @param cls a `struct TALER_EXCHANGEDB_Session *`
* @param reserve_pub public key of the reserve
@@ -851,7 +851,7 @@ expired_reserve_cb (void *cls,
GNUNET_SCHEDULER_shutdown ();
return GNUNET_SYSERR;
}
-
+
/* lookup `closing_fee` */
if (GNUNET_OK !=
update_fees (wp,
@@ -973,7 +973,7 @@ run_reserve_closures (void *cls)
struct TALER_EXCHANGEDB_Session *session;
int ret;
const struct GNUNET_SCHEDULER_TaskContext *tc;
-
+
task = NULL;
reserves_idle = GNUNET_NO;
tc = GNUNET_SCHEDULER_get_task_context ();
@@ -1370,11 +1370,13 @@ prepare_cb (void *cls,
*
* @param cls NULL
* @param success #GNUNET_OK on success, #GNUNET_SYSERR on failure
+ * @param serial_id unique ID of the wire transfer in the bank's records; UINT64_MAX on error
* @param emsg NULL on success, otherwise an error message
*/
static void
wire_confirm_cb (void *cls,
int success,
+ uint64_t serial_id,
const char *emsg)
{
struct TALER_EXCHANGEDB_Session *session = wpd->session;
diff --git a/src/exchange/taler-exchange-httpd_responses.c b/src/exchange/taler-exchange-httpd_responses.c
index 9ce9bb811..a839413b7 100644
--- a/src/exchange/taler-exchange-httpd_responses.c
+++ b/src/exchange/taler-exchange-httpd_responses.c
@@ -886,7 +886,7 @@ compile_reserve_history (const struct TALER_EXCHANGEDB_ReserveHistory *rh,
rcc.reserve_pub = pos->details.closing->reserve_pub;
TALER_JSON_hash (pos->details.closing->receiver_account_details,
&rcc.h_wire);
- rcc.wtid = pos->details.closing->transfer_details;
+ rcc.wtid = pos->details.closing->wtid;
TEH_KS_sign (&rcc.purpose,
&pub,
&sig);
@@ -895,7 +895,7 @@ compile_reserve_history (const struct TALER_EXCHANGEDB_ReserveHistory *rh,
json_pack ("{s:s, s:O, s:o, s:o, s:o, s:o, s:o, s:o}",
"type", "CLOSING",
"receiver_account_details", pos->details.closing->receiver_account_details,
- "transfer_details", GNUNET_JSON_from_data_auto (&pos->details.closing->transfer_details),
+ "wtid", GNUNET_JSON_from_data_auto (&pos->details.closing->wtid),
"exchange_pub", GNUNET_JSON_from_data_auto (&pub),
"exchange_sig", GNUNET_JSON_from_data_auto (&sig),
"timestamp", GNUNET_JSON_from_time_abs (pos->details.closing->execution_date),
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c
index 352d51ccd..6a59b9f58 100644
--- a/src/exchangedb/plugin_exchangedb_postgres.c
+++ b/src/exchangedb/plugin_exchangedb_postgres.c
@@ -371,7 +371,7 @@ postgres_create_tables (void *cls)
"(close_uuid BIGSERIAL PRIMARY KEY"
",reserve_pub BYTEA NOT NULL REFERENCES reserves (reserve_pub) ON DELETE CASCADE"
",execution_date INT8 NOT NULL"
- ",transfer_details BYTEA NOT NULL CHECK (LENGTH(transfer_details)=32)"
+ ",wtid BYTEA NOT NULL CHECK (LENGTH(wtid)=32)"
",receiver_account TEXT NOT NULL"
",amount_val INT8 NOT NULL"
",amount_frac INT4 NOT NULL"
@@ -733,7 +733,7 @@ postgres_prepare (PGconn *db_conn)
"INSERT INTO reserves_close "
"(reserve_pub"
",execution_date"
- ",transfer_details"
+ ",wtid"
",receiver_account"
",amount_val"
",amount_frac"
@@ -1542,7 +1542,7 @@ postgres_prepare (PGconn *db_conn)
" close_uuid"
",reserve_pub"
",execution_date"
- ",transfer_details"
+ ",wtid"
",receiver_account"
",amount_val"
",amount_frac"
@@ -1585,7 +1585,7 @@ postgres_prepare (PGconn *db_conn)
",closing_fee_curr"
",execution_date"
",receiver_account"
- ",transfer_details"
+ ",wtid"
" FROM reserves_close"
" WHERE reserve_pub=$1;",
1, NULL);
@@ -2671,8 +2671,8 @@ postgres_get_reserve_history (void *cls,
&closing->execution_date),
TALER_PQ_result_spec_json ("receiver_account",
&closing->receiver_account_details),
- GNUNET_PQ_result_spec_auto_from_type ("transfer_details",
- &closing->transfer_details),
+ GNUNET_PQ_result_spec_auto_from_type ("wtid",
+ &closing->wtid),
GNUNET_PQ_result_spec_end
};
if (GNUNET_OK !=
@@ -5082,7 +5082,7 @@ postgres_get_expired_reserves (void *cls,
* @param reserve_pub which reserve is this about?
* @param execution_date when did we perform the transfer?
* @param receiver_account to which account do we transfer?
- * @param transfer_details wire transfer details
+ * @param wtid wire transfer details
* @param amount_with_fee amount we charged to the reserve
* @param closing_fee how high is the closing fee
* @return #GNUNET_OK on success, #GNUNET_NO if the record exists,
@@ -5094,7 +5094,7 @@ postgres_insert_reserve_closed (void *cls,
const struct TALER_ReservePublicKeyP *reserve_pub,
struct GNUNET_TIME_Absolute execution_date,
const json_t *receiver_account,
- const struct TALER_WireTransferIdentifierRawP *transfer_details,
+ const struct TALER_WireTransferIdentifierRawP *wtid,
const struct TALER_Amount *amount_with_fee,
const struct TALER_Amount *closing_fee)
{
@@ -5102,7 +5102,7 @@ postgres_insert_reserve_closed (void *cls,
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (reserve_pub),
GNUNET_PQ_query_param_absolute_time (&execution_date),
- GNUNET_PQ_query_param_auto_from_type (transfer_details),
+ GNUNET_PQ_query_param_auto_from_type (wtid),
TALER_PQ_query_param_json (receiver_account),
TALER_PQ_query_param_amount (amount_with_fee),
TALER_PQ_query_param_amount (closing_fee),
@@ -6261,7 +6261,7 @@ postgres_select_reserve_closed_above_serial_id (void *cls,
&reserve_pub),
GNUNET_PQ_result_spec_absolute_time ("execution_date",
&execution_date),
- GNUNET_PQ_result_spec_auto_from_type ("transfer_details",
+ GNUNET_PQ_result_spec_auto_from_type ("wtid",
&wtid),
TALER_PQ_result_spec_json ("receiver_account",
&receiver_account),
diff --git a/src/include/taler_exchangedb_plugin.h b/src/include/taler_exchangedb_plugin.h
index 370b114c2..a8df8c859 100644
--- a/src/include/taler_exchangedb_plugin.h
+++ b/src/include/taler_exchangedb_plugin.h
@@ -110,7 +110,7 @@ struct TALER_EXCHANGEDB_ClosingTransfer
* Detailed wire transfer information that uniquely identifies the
* wire transfer.
*/
- struct TALER_WireTransferIdentifierRawP transfer_details;
+ struct TALER_WireTransferIdentifierRawP wtid;
};
@@ -994,7 +994,7 @@ typedef int
* @param closing_fee how much did we charge for closing the reserve
* @param reserve_pub public key of the reserve
* @param receiver_account where did we send the funds
- * @param transfer_details details about the wire transfer
+ * @param wtid identifier used for the wire transfer
* @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop
*/
typedef int
@@ -1005,7 +1005,7 @@ typedef int
const struct TALER_Amount *closing_fee,
const struct TALER_ReservePublicKeyP *reserve_pub,
const json_t *receiver_account,
- const struct TALER_WireTransferIdentifierRawP *transfer_details);
+ const struct TALER_WireTransferIdentifierRawP *wtid);
/**
@@ -1848,7 +1848,7 @@ struct TALER_EXCHANGEDB_Plugin
* @param reserve_pub which reserve is this about?
* @param execution_date when did we perform the transfer?
* @param receiver_account to which account do we transfer?
- * @param transfer_details wire transfer details
+ * @param wtid identifier for the wire transfer
* @param amount_with_fee amount we charged to the reserve
* @param closing_fee how high is the closing fee
* @return #GNUNET_OK on success, #GNUNET_NO if the record exists,
@@ -1860,7 +1860,7 @@ struct TALER_EXCHANGEDB_Plugin
const struct TALER_ReservePublicKeyP *reserve_pub,
struct GNUNET_TIME_Absolute execution_date,
const json_t *receiver_account,
- const struct TALER_WireTransferIdentifierRawP *transfer_details,
+ const struct TALER_WireTransferIdentifierRawP *wtid,
const struct TALER_Amount *amount_with_fee,
const struct TALER_Amount *closing_fee);
diff --git a/src/include/taler_wire_plugin.h b/src/include/taler_wire_plugin.h
index 715f94d18..5b2bec3c0 100644
--- a/src/include/taler_wire_plugin.h
+++ b/src/include/taler_wire_plugin.h
@@ -81,11 +81,13 @@ struct TALER_WIRE_HistoryHandle;
*
* @param cls closure
* @param success #GNUNET_OK on success, #GNUNET_SYSERR on failure
+ * @param serial_id unique ID of the wire transfer in the bank's records; UINT64_MAX on error
* @param emsg NULL on success, otherwise an error message
*/
typedef void
(*TALER_WIRE_ConfirmationCallback)(void *cls,
int success,
+ uint64_t serial_id,
const char *emsg);
diff --git a/src/wire/plugin_wire_test.c b/src/wire/plugin_wire_test.c
index 0c14190e7..6f0acce4f 100644
--- a/src/wire/plugin_wire_test.c
+++ b/src/wire/plugin_wire_test.c
@@ -553,11 +553,13 @@ test_prepare_wire_transfer (void *cls,
* @param cls closure with the `struct TALER_WIRE_ExecuteHandle`
* @param http_status HTTP response code, #MHD_HTTP_OK (200) for successful status request
* 0 if the bank's reply is bogus (fails to follow the protocol)
+ * @param serial_id unique ID of the wire transfer in the bank's records; UINT64_MAX on error
* @param json detailed response from the HTTPD, or NULL if reply was not JSON
*/
static void
execute_cb (void *cls,
unsigned int http_status,
+ uint64_t serial_id,
const json_t *json)
{
struct TALER_WIRE_ExecuteHandle *eh = cls;
@@ -585,6 +587,7 @@ execute_cb (void *cls,
http_status);
eh->cc (eh->cc_cls,
(MHD_HTTP_OK == http_status) ? GNUNET_OK : GNUNET_SYSERR,
+ serial_id,
(MHD_HTTP_OK == http_status) ? NULL : s);
GNUNET_free (s);
GNUNET_free (eh);
@@ -825,7 +828,7 @@ bhist_cb (void *cls,
&bserial_id,
sizeof (bserial_id),
details)) )
- whh->hres_cb = NULL;
+ whh->hres_cb = NULL;
}
else
{