updates to distinguish clearly between wtid and json transfer details

This commit is contained in:
Christian Grothoff 2017-05-08 12:44:40 +02:00
parent 18a020dd02
commit 5e36e520a5
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
7 changed files with 31 additions and 24 deletions

View File

@ -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),

View File

@ -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;

View File

@ -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),

View File

@ -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),

View File

@ -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);

View File

@ -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);

View File

@ -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
{