aboutsummaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/exchange_api_handle.c2
-rw-r--r--src/lib/testing_api_cmd_bank_admin_add_incoming.c2
-rw-r--r--src/lib/testing_api_cmd_bank_history_credit.c52
-rw-r--r--src/lib/testing_api_cmd_bank_history_debit.c70
-rw-r--r--src/lib/testing_api_helpers_bank.c45
5 files changed, 57 insertions, 114 deletions
diff --git a/src/lib/exchange_api_handle.c b/src/lib/exchange_api_handle.c
index 6b51519fd..abb95816c 100644
--- a/src/lib/exchange_api_handle.c
+++ b/src/lib/exchange_api_handle.c
@@ -1262,7 +1262,7 @@ keys_completed_cb (void *cls,
for (unsigned int i = 0; i<kd_old.num_denom_keys; i++)
kd.denom_keys[i].key.rsa_public_key
= GNUNET_CRYPTO_rsa_public_key_dup (
- kd_old.denom_keys[i].key.rsa_public_key);
+ kd_old.denom_keys[i].key.rsa_public_key);
kd.num_auditors = kd_old.num_auditors;
kd.auditors = GNUNET_new_array (kd.num_auditors,
diff --git a/src/lib/testing_api_cmd_bank_admin_add_incoming.c b/src/lib/testing_api_cmd_bank_admin_add_incoming.c
index 690b78437..d2f6cd2c6 100644
--- a/src/lib/testing_api_cmd_bank_admin_add_incoming.c
+++ b/src/lib/testing_api_cmd_bank_admin_add_incoming.c
@@ -398,7 +398,7 @@ admin_add_incoming_traits (void *cls,
{
struct AdminAddIncomingState *fts = cls;
struct TALER_TESTING_Trait traits[] = {
- TALER_TESTING_make_trait_url (1, fts->payto_debit_account),
+ TALER_TESTING_make_trait_payto (1, fts->payto_debit_account),
TALER_TESTING_MAKE_TRAIT_ROW_ID (&fts->serial_id),
TALER_TESTING_MAKE_TRAIT_CREDIT_ACCOUNT (fts->exchange_credit_url),
TALER_TESTING_make_trait_amount_obj (0, &fts->amount),
diff --git a/src/lib/testing_api_cmd_bank_history_credit.c b/src/lib/testing_api_cmd_bank_history_credit.c
index 92a28c22f..40ec99162 100644
--- a/src/lib/testing_api_cmd_bank_history_credit.c
+++ b/src/lib/testing_api_cmd_bank_history_credit.c
@@ -170,7 +170,7 @@ print_expected (struct History *h,
TALER_amount2s (&h[i].details.amount),
(unsigned long long) h[i].row_id,
TALER_B2S (&h[i].details.reserve_pub),
- h[i].details.account_url);
+ h[i].details.debit_account_url);
}
}
@@ -415,18 +415,6 @@ build_history (struct TALER_TESTING_Interpreter *is,
credit_account,
hs->account_url);
- /**
- * Discard transactions where the audited account played
- * _both_ the credit and the debit roles, but _only if_
- * the audit goes on both directions.. This needs more
- * explaination!
- */if (0 == strcasecmp (hs->account_url,
- credit_account))
- {
- GNUNET_break (0);
- continue;
- }
-
bank_hostname = strchr (hs->account_url, ':');
GNUNET_assert (NULL != bank_hostname);
bank_hostname += 3;
@@ -438,15 +426,6 @@ build_history (struct TALER_TESTING_Interpreter *is,
if (0 == strcasecmp (hs->account_url,
credit_account))
{
- h[total].url = GNUNET_strdup (debit_account);
- h[total].details.account_url = h[total].url;
- }
-
- /* This block _completes_ the information of the current item,
- * with amount / subject / exchange URL. */
- if (0 == strcasecmp (hs->account_url,
- credit_account))
- {
const struct TALER_Amount *amount;
const struct TALER_ReservePublicKeyP *reserve_pub;
const char *account_url;
@@ -461,10 +440,12 @@ build_history (struct TALER_TESTING_Interpreter *is,
TALER_TESTING_get_trait_url
(pos, 1,
&account_url));
+ h[total].url = GNUNET_strdup (debit_account);
+ h[total].details.debit_account_url = h[total].url;
h[total].details.amount = *amount;
h[total].row_id = *row_id;
h[total].details.reserve_pub = *reserve_pub;
- h[total].details.account_url = account_url;
+ h[total].details.credit_account_url = account_url;
TALER_LOG_INFO ("+1-bit of my history\n");
total++;
}
@@ -530,8 +511,8 @@ check_result (struct TALER_TESTING_Interpreter *is,
&details->reserve_pub)) ||
(0 != TALER_amount_cmp (&h[off].details.amount,
&details->amount)) ||
- (0 != strcasecmp (h[off].details.account_url,
- details->account_url)) )
+ (0 != strcasecmp (h[off].details.debit_account_url,
+ details->debit_account_url)) )
{
GNUNET_break (0);
print_expected (h,
@@ -582,20 +563,12 @@ history_cb (void *cls,
struct HistoryState *hs = is->commands[is->ip].cls;
(void) row_id;
- if (MHD_HTTP_OK != http_status)
- {
- hs->hh = NULL;
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Unwanted response code from /history: %u\n",
- http_status);
- TALER_TESTING_interpreter_fail (is);
- return GNUNET_SYSERR;
- }
if (NULL == details)
{
hs->hh = NULL;
if ( (hs->results_obtained != compute_result_count (is)) ||
- (GNUNET_YES == hs->failed) )
+ (GNUNET_YES == hs->failed) ||
+ (MHD_HTTP_NO_CONTENT != http_status) )
{
uint64_t total;
struct History *h;
@@ -622,6 +595,15 @@ history_cb (void *cls,
return GNUNET_OK;
}
+ if (MHD_HTTP_OK != http_status)
+ {
+ hs->hh = NULL;
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Unwanted response code from /history: %u\n",
+ http_status);
+ TALER_TESTING_interpreter_fail (is);
+ return GNUNET_SYSERR;
+ }
/* check current element */
if (GNUNET_OK != check_result (is,
hs->results_obtained,
diff --git a/src/lib/testing_api_cmd_bank_history_debit.c b/src/lib/testing_api_cmd_bank_history_debit.c
index 0b0cc40e1..ec4a323e6 100644
--- a/src/lib/testing_api_cmd_bank_history_debit.c
+++ b/src/lib/testing_api_cmd_bank_history_debit.c
@@ -170,7 +170,7 @@ print_expected (struct History *h,
TALER_amount2s (&h[i].details.amount),
(unsigned long long) h[i].row_id,
TALER_B2S (&h[i].details.wtid),
- h[i].details.account_url);
+ h[i].details.credit_account_url);
}
}
@@ -219,12 +219,10 @@ build_history (struct TALER_TESTING_Interpreter *is,
int inc;
unsigned int start;
unsigned int end;
-
- /**
- * @var turns GNUNET_YES whenever either no 'start' value was
- * given for the history query, or the given value is found
- * in the list of all the CMDs.
- */int ok;
+ /* GNUNET_YES whenever either no 'start' value was given for the history
+ * query, or the given value is found in the list of all the CMDs.
+ */
+ int ok;
const uint64_t *row_id_start = NULL;
if (NULL != hs->start_row_reference)
@@ -278,11 +276,11 @@ build_history (struct TALER_TESTING_Interpreter *is,
const char *debit_account;
const char *credit_account;
- /**
- * The following command allows us to skip over those CMDs
+ /* The following command allows us to skip over those CMDs
* that do not offer a "row_id" trait. Such skipped CMDs are
* not interesting for building a history.
- */if (GNUNET_OK != TALER_TESTING_get_trait_uint64 (pos,
+ */
+ if (GNUNET_OK != TALER_TESTING_get_trait_uint64 (pos,
0,
&row_id))
continue;
@@ -408,18 +406,16 @@ build_history (struct TALER_TESTING_Interpreter *is,
(GNUNET_OK == TALER_TESTING_GET_TRAIT_CREDIT_ACCOUNT
(pos, &credit_account));
- TALER_LOG_INFO ("Potential history bit:"
- " %s->%s; my account: %s\n",
+ TALER_LOG_INFO ("Potential history bit: %s->%s; my account: %s\n",
debit_account,
credit_account,
hs->account_url);
- /**
- * Discard transactions where the audited account played
- * _both_ the debit and the debit roles, but _only if_
- * the audit goes on both directions.. This needs more
- * explaination!
- */if (0 == strcasecmp (hs->account_url,
+ /* Discard transactions where the audited account played _both_ the debit
+ * and the debit roles, but _only if_ the audit goes on both directions..
+ * This needs more explaination!
+ */
+ if (0 == strcasecmp (hs->account_url,
debit_account))
{
GNUNET_break (0);
@@ -437,15 +433,6 @@ build_history (struct TALER_TESTING_Interpreter *is,
if (0 == strcasecmp (hs->account_url,
debit_account))
{
- h[total].url = GNUNET_strdup (credit_account);
- h[total].details.account_url = h[total].url;
- }
-
- /* This block _completes_ the information of the current item,
- * with amount / subject / exchange URL. */
- if (0 == strcasecmp (hs->account_url,
- debit_account))
- {
const struct TALER_Amount *amount;
const struct TALER_WireTransferIdentifierRawP *wtid;
const char *account_url;
@@ -460,10 +447,12 @@ build_history (struct TALER_TESTING_Interpreter *is,
TALER_TESTING_get_trait_url
(pos, 1,
&account_url));
+ h[total].url = GNUNET_strdup (credit_account);
+ h[total].details.credit_account_url = h[total].url;
h[total].details.amount = *amount;
h[total].row_id = *row_id;
h[total].details.wtid = *wtid;
- h[total].details.account_url = account_url;
+ h[total].details.debit_account_url = account_url;
TALER_LOG_INFO ("+1-bit of my history\n");
total++;
}
@@ -529,8 +518,8 @@ check_result (struct TALER_TESTING_Interpreter *is,
&details->wtid)) ||
(0 != TALER_amount_cmp (&h[off].details.amount,
&details->amount)) ||
- (0 != strcasecmp (h[off].details.account_url,
- details->account_url)) )
+ (0 != strcasecmp (h[off].details.credit_account_url,
+ details->credit_account_url)) )
{
GNUNET_break (0);
print_expected (h,
@@ -581,20 +570,12 @@ history_cb (void *cls,
struct HistoryState *hs = is->commands[is->ip].cls;
(void) row_id;
- if (MHD_HTTP_OK != http_status)
- {
- hs->hh = NULL;
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Unwanted response code from /history: %u\n",
- http_status);
- TALER_TESTING_interpreter_fail (is);
- return GNUNET_SYSERR;
- }
if (NULL == details)
{
hs->hh = NULL;
if ( (hs->results_obtained != compute_result_count (is)) ||
- (GNUNET_YES == hs->failed) )
+ (GNUNET_YES == hs->failed) ||
+ (MHD_HTTP_NO_CONTENT != http_status) )
{
uint64_t total;
struct History *h;
@@ -621,6 +602,15 @@ history_cb (void *cls,
return GNUNET_OK;
}
+ if (MHD_HTTP_OK != http_status)
+ {
+ hs->hh = NULL;
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Unwanted response code from /history: %u\n",
+ http_status);
+ TALER_TESTING_interpreter_fail (is);
+ return GNUNET_SYSERR;
+ }
/* check current element */
if (GNUNET_OK != check_result (is,
hs->results_obtained,
diff --git a/src/lib/testing_api_helpers_bank.c b/src/lib/testing_api_helpers_bank.c
index 1f0617992..5147034af 100644
--- a/src/lib/testing_api_helpers_bank.c
+++ b/src/lib/testing_api_helpers_bank.c
@@ -349,10 +349,10 @@ TALER_TESTING_prepare_bank (const char *config_filename,
"%s%s",
bc->bank_url,
EXCHANGE_ACCOUNT_NAME);
- bc->exchange_payto = TALER_TESTING_make_xtalerbank_payto (bc->bank_url,
- EXCHANGE_ACCOUNT_NAME);
- bc->user42_payto = TALER_TESTING_make_xtalerbank_payto (bc->bank_url, "42");
- bc->user43_payto = TALER_TESTING_make_xtalerbank_payto (bc->bank_url, "43");
+ bc->exchange_payto = TALER_payto_xtalerbank_make (bc->bank_url,
+ EXCHANGE_ACCOUNT_NAME);
+ bc->user42_payto = TALER_payto_xtalerbank_make (bc->bank_url, "42");
+ bc->user43_payto = TALER_payto_xtalerbank_make (bc->bank_url, "43");
return GNUNET_OK;
}
@@ -424,47 +424,18 @@ TALER_TESTING_prepare_fakebank (const char *config_filename,
}
bc->bank_url = fakebank_url;
GNUNET_asprintf (&bc->exchange_account_url,
- "%s%s",
+ "%s/%s",
bc->bank_url,
EXCHANGE_ACCOUNT_NAME);
bc->exchange_auth.method = TALER_BANK_AUTH_NONE;
- bc->exchange_payto = TALER_TESTING_make_xtalerbank_payto (bc->bank_url, "2");
- bc->user42_payto = TALER_TESTING_make_xtalerbank_payto (bc->bank_url, "42");
- bc->user43_payto = TALER_TESTING_make_xtalerbank_payto (bc->bank_url, "43");
+ bc->exchange_payto = TALER_payto_xtalerbank_make (bc->bank_url, "2");
+ bc->user42_payto = TALER_payto_xtalerbank_make (bc->bank_url, "42");
+ bc->user43_payto = TALER_payto_xtalerbank_make (bc->bank_url, "43");
return GNUNET_OK;
}
/**
- * Create an x-taler-bank payto:// URL from a @a bank_url
- * and an @a account_name.
- *
- * @param bank_url the bank URL
- * @param account_name the account name
- * @return payto:// URL
- */
-char *
-TALER_TESTING_make_xtalerbank_payto (const char *bank_url,
- const char *account_name)
-{
- char *payto;
- int ends_slash;
-
- if (0 < strlen (bank_url))
- ends_slash = '/' == bank_url[strlen (bank_url) - 1];
- else
- ends_slash = 0;
- GNUNET_asprintf (&payto,
- (ends_slash)
- ? "payto://x-taler-bank/%s%s"
- : "payto://x-taler-bank/%s/%s",
- bank_url,
- account_name);
- return payto;
-}
-
-
-/**
* Allocate and return a piece of wire-details. Combines
* a @a payto -URL and adds some salt to create the JSON.
*