aboutsummaryrefslogtreecommitdiff
path: root/src/exchangedb
diff options
context:
space:
mode:
Diffstat (limited to 'src/exchangedb')
-rw-r--r--src/exchangedb/exchangedb_accounts.c12
-rw-r--r--src/exchangedb/exchangedb_fees.c8
-rw-r--r--src/exchangedb/plugin_exchangedb_postgres.c31
-rw-r--r--src/exchangedb/test_exchangedb.c32
4 files changed, 30 insertions, 53 deletions
diff --git a/src/exchangedb/exchangedb_accounts.c b/src/exchangedb/exchangedb_accounts.c
index e31509021..037793953 100644
--- a/src/exchangedb/exchangedb_accounts.c
+++ b/src/exchangedb/exchangedb_accounts.c
@@ -58,7 +58,7 @@ check_for_account (void *cls,
const char *section)
{
struct FindAccountContext *ctx = cls;
- char *plugin_name;
+ char *method;
char *payto_url;
char *wire_response_filename;
struct TALER_EXCHANGEDB_AccountInfo ai;
@@ -81,12 +81,12 @@ check_for_account (void *cls,
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_string (ctx->cfg,
section,
- "PLUGIN",
- &plugin_name))
+ "METHOD",
+ &method))
{
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING,
section,
- "PLUGIN");
+ "METHOD");
GNUNET_free (payto_url);
return;
}
@@ -97,7 +97,7 @@ check_for_account (void *cls,
&wire_response_filename))
wire_response_filename = NULL;
ai.section_name = section;
- ai.plugin_name = plugin_name;
+ ai.method = method;
ai.payto_url = payto_url;
ai.wire_response_filename = wire_response_filename;
@@ -112,7 +112,7 @@ check_for_account (void *cls,
ctx->cb (ctx->cb_cls,
&ai);
GNUNET_free (payto_url);
- GNUNET_free (plugin_name);
+ GNUNET_free (method);
GNUNET_free_non_null (wire_response_filename);
}
diff --git a/src/exchangedb/exchangedb_fees.c b/src/exchangedb/exchangedb_fees.c
index f06be73ad..386c5de90 100644
--- a/src/exchangedb/exchangedb_fees.c
+++ b/src/exchangedb/exchangedb_fees.c
@@ -144,12 +144,12 @@ TALER_EXCHANGEDB_fees_read (const struct GNUNET_CONFIGURATION_Handle *cfg,
/**
* Convert @a af to @a wf.
*
- * @param wireplugin name of the wire plugin the fees are for
+ * @param method name of the wire method the fees are for
* @param[in,out] af aggregate fees, host format (updated to round time)
* @param[out] wf aggregate fees, disk / signature format
*/
void
-TALER_EXCHANGEDB_fees_2_wf (const char *wireplugin,
+TALER_EXCHANGEDB_fees_2_wf (const char *method,
struct TALER_EXCHANGEDB_AggregateFees *af,
struct TALER_MasterWireFeePS *wf)
{
@@ -157,8 +157,8 @@ TALER_EXCHANGEDB_fees_2_wf (const char *wireplugin,
(void) GNUNET_TIME_round_abs (&af->end_date);
wf->purpose.size = htonl (sizeof (*wf));
wf->purpose.purpose = htonl (TALER_SIGNATURE_MASTER_WIRE_FEES);
- GNUNET_CRYPTO_hash (wireplugin,
- strlen (wireplugin) + 1,
+ GNUNET_CRYPTO_hash (method,
+ strlen (method) + 1,
&wf->h_wire_method);
wf->start_date = GNUNET_TIME_absolute_hton (af->start_date);
wf->end_date = GNUNET_TIME_absolute_hton (af->end_date);
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c
index 6ddbead9e..5f2c67161 100644
--- a/src/exchangedb/plugin_exchangedb_postgres.c
+++ b/src/exchangedb/plugin_exchangedb_postgres.c
@@ -253,7 +253,7 @@ postgres_create_tables (void *cls)
GNUNET_PQ_make_execute ("CREATE TABLE IF NOT EXISTS reserves_in"
"(reserve_in_serial_id BIGSERIAL UNIQUE"
",reserve_pub BYTEA NOT NULL REFERENCES reserves (reserve_pub) ON DELETE CASCADE"
- ",wire_reference BYTEA NOT NULL"
+ ",wire_reference INT8 NOT NULL"
",credit_val INT8 NOT NULL"
",credit_frac INT4 NOT NULL"
",sender_account_details TEXT NOT NULL"
@@ -2158,8 +2158,7 @@ reserves_update (void *cls,
* @param sender_account_details account information for the sender (payto://-URL)
* @param exchange_account_section name of the section in the configuration for the exchange's
* account into which the deposit was made
- * @param wire_reference unique reference identifying the wire transfer (binary blob)
- * @param wire_reference_size number of bytes in @a wire_reference
+ * @param wire_ref unique reference identifying the wire transfer
* @return transaction status code
*/
static enum GNUNET_DB_QueryStatus
@@ -2170,8 +2169,7 @@ postgres_reserves_in_insert (void *cls,
struct GNUNET_TIME_Absolute execution_time,
const char *sender_account_details,
const char *exchange_account_section,
- const void *wire_reference,
- size_t wire_reference_size)
+ uint64_t wire_ref)
{
struct PostgresClosure *pg = cls;
enum GNUNET_DB_QueryStatus reserve_exists;
@@ -2252,8 +2250,7 @@ postgres_reserves_in_insert (void *cls,
{
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (&reserve.pub),
- GNUNET_PQ_query_param_fixed_size (wire_reference,
- wire_reference_size),
+ GNUNET_PQ_query_param_uint64 (&wire_ref),
TALER_PQ_query_param_amount (balance),
GNUNET_PQ_query_param_string (exchange_account_section),
GNUNET_PQ_query_param_string (sender_account_details),
@@ -2311,8 +2308,7 @@ postgres_reserves_in_insert (void *cls,
* @param session the database session handle
* @param exchange_account_name name of the section in the exchange's configuration
* for the account that we are tracking here
- * @param[out] wire_reference set to unique reference identifying the wire transfer (binary blob)
- * @param[out] wire_reference_size set to number of bytes in @a wire_reference
+ * @param[out] wire_ref set to unique reference identifying the wire transfer
* @return transaction status code
*/
static enum GNUNET_DB_QueryStatus
@@ -2320,17 +2316,15 @@ postgres_get_latest_reserve_in_reference (void *cls,
struct TALER_EXCHANGEDB_Session *
session,
const char *exchange_account_name,
- void **wire_reference,
- size_t *wire_reference_size)
+ uint64_t *wire_reference)
{
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_string (exchange_account_name),
GNUNET_PQ_query_param_end
};
struct GNUNET_PQ_ResultSpec rs[] = {
- GNUNET_PQ_result_spec_variable_size ("wire_reference",
- wire_reference,
- wire_reference_size),
+ GNUNET_PQ_result_spec_uint64 ("wire_reference",
+ wire_reference),
GNUNET_PQ_result_spec_end
};
@@ -6192,14 +6186,12 @@ reserves_in_serial_helper_cb (void *cls,
char *sender_account_details;
struct GNUNET_TIME_Absolute execution_date;
uint64_t rowid;
- void *wire_reference;
- size_t wire_reference_size;
+ uint64_t wire_reference;
struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_auto_from_type ("reserve_pub",
&reserve_pub),
- GNUNET_PQ_result_spec_variable_size ("wire_reference",
- &wire_reference,
- &wire_reference_size),
+ GNUNET_PQ_result_spec_uint64 ("wire_reference",
+ &wire_reference),
TALER_PQ_RESULT_SPEC_AMOUNT ("credit",
&credit),
TALER_PQ_result_spec_absolute_time ("execution_date",
@@ -6227,7 +6219,6 @@ reserves_in_serial_helper_cb (void *cls,
&credit,
sender_account_details,
wire_reference,
- wire_reference_size,
execution_date);
GNUNET_PQ_cleanup_result (rs);
if (GNUNET_OK != ret)
diff --git a/src/exchangedb/test_exchangedb.c b/src/exchangedb/test_exchangedb.c
index a1e20e83a..583e3c178 100644
--- a/src/exchangedb/test_exchangedb.c
+++ b/src/exchangedb/test_exchangedb.c
@@ -944,8 +944,7 @@ audit_refund_cb (void *cls,
* @param reserve_pub public key of the reserve (also the WTID)
* @param credit amount that was received
* @param sender_account_details information about the sender's bank account
- * @param wire_reference unique reference identifying the wire transfer (binary blob)
- * @param wire_reference_size number of bytes in @a wire_reference
+ * @param wire_reference unique reference identifying the wire transfer
* @param execution_date when did we receive the funds
* @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop
*/
@@ -955,8 +954,7 @@ audit_reserve_in_cb (void *cls,
const struct TALER_ReservePublicKeyP *reserve_pub,
const struct TALER_Amount *credit,
const char *sender_account_details,
- const void *wire_reference,
- size_t wire_reference_size,
+ uint64_t wire_reference,
struct GNUNET_TIME_Absolute execution_date)
{
auditor_row_cnt++;
@@ -1507,8 +1505,7 @@ run (void *cls)
const char *sndr = "payto://x-taler-bank/localhost:8080/1";
unsigned int matched;
unsigned int cnt;
- void *rr;
- size_t rr_size;
+ uint64_t rr;
enum GNUNET_DB_QueryStatus qs;
struct GNUNET_TIME_Absolute now;
@@ -1578,8 +1575,7 @@ run (void *cls)
plugin->get_latest_reserve_in_reference (plugin->cls,
session,
"account-1",
- &rr,
- &rr_size));
+ &rr));
now = GNUNET_TIME_absolute_get ();
(void) GNUNET_TIME_round_abs (&now);
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
@@ -1590,17 +1586,13 @@ run (void *cls)
now,
sndr,
"account-1",
- "TEST",
4));
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
plugin->get_latest_reserve_in_reference (plugin->cls,
session,
"account-1",
- &rr,
- &rr_size));
- FAILIF (4 != rr_size);
- FAILIF (0 != memcmp ("TEST", rr, 4));
- GNUNET_free (rr);
+ &rr));
+ FAILIF (4 != rr);
FAILIF (GNUNET_OK !=
check_reserve (session,
&reserve_pub,
@@ -1617,24 +1609,18 @@ run (void *cls)
now,
sndr,
"account-1",
- "TEST2",
5));
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
plugin->get_latest_reserve_in_reference (plugin->cls,
session,
"account-1",
- &rr,
- &rr_size));
- GNUNET_free (rr);
+ &rr));
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
plugin->get_latest_reserve_in_reference (plugin->cls,
session,
"account-1",
- &rr,
- &rr_size));
- FAILIF (5 != rr_size);
- FAILIF (0 != memcmp ("TEST2", rr, 5));
- GNUNET_free (rr);
+ &rr));
+ FAILIF (5 != rr);
FAILIF (GNUNET_OK !=
check_reserve (session,
&reserve_pub,