donau

Donation authority for GNU Taler (experimental)
Log | Files | Refs | Submodules | README | LICENSE

commit ffddf74b59250a9a6865bf6a50ec9b0127c64959
parent 24c840c27efbf3ce6c4bd321e26de1d11efcc96a
Author: Casaburi Johannes <johannes.casaburi@students.bfh.ch>
Date:   Fri,  5 Jan 2024 11:50:03 +0100

cleanup

Diffstat:
Msrc/donau/donau-httpd.c | 7-------
Msrc/donau/donau-httpd_csr.c | 9---------
Msrc/donau/donau-httpd_keys.c | 4++--
Msrc/donaudb/test_donaudb.c | 44--------------------------------------------
Msrc/include/donaudb_lib.h | 150-------------------------------------------------------------------------------
Msrc/testing/test_donau_api.c | 7+++----
Msrc/testing/testing_api_misc.c | 131+++----------------------------------------------------------------------------
7 files changed, 10 insertions(+), 342 deletions(-)

diff --git a/src/donau/donau-httpd.c b/src/donau/donau-httpd.c @@ -103,13 +103,6 @@ unsigned int DH_currency_fraction_digits; char *DH_currency; /** - * What is the largest amount we allow a peer to - * merge into a reserve before always triggering - * an AML check? - */ -struct TALER_Amount DH_aml_threshold; - -/** * Our base URL. */ char *DH_base_url; diff --git a/src/donau/donau-httpd_csr.c b/src/donau/donau-httpd_csr.c @@ -83,15 +83,6 @@ DH_handler_csr_withdraw (struct DH_RequestContext *rc, rc->connection, &denom_pub_hash); } - if (GNUNET_TIME_absolute_is_past (dk->meta.expire_withdraw.abs_time)) - { - /* This denomination is past the expiration time for withdraws/refreshes*/ - return DH_RESPONSE_reply_expired_denom_pub_hash ( - rc->connection, - &denom_pub_hash, - TALER_EC_DONAU_GENERIC_DENOMINATION_EXPIRED, - "csr-withdraw"); - } if (GNUNET_TIME_absolute_is_future (dk->meta.start.abs_time)) { /* This denomination is not yet valid, no need to check diff --git a/src/donau/donau-httpd_keys.c b/src/donau/donau-httpd_keys.c @@ -377,7 +377,7 @@ finish_keys_response (struct DH_KeyStateHandle *ksh) struct GNUNET_TIME_Timestamp last_cherry_pick_date; struct GNUNET_CONTAINER_Heap *heap; struct GNUNET_HashContext *hash_context = NULL; - struct GNUNET_HashCode grouped_hash_xor = {0}; + //struct GNUNET_HashCode grouped_hash_xor = {0}; sctx.signkeys = json_array (); GNUNET_assert (NULL != sctx.signkeys); @@ -578,7 +578,7 @@ static void destroy_key_state (struct DH_KeyStateHandle *ksh, bool free_helper) { - struct DH_GlobalFee *gf; + //struct DH_GlobalFee *gf; clear_response_cache (ksh); //while (NULL != (gf = ksh->gf_head)) diff --git a/src/donaudb/test_donaudb.c b/src/donaudb/test_donaudb.c @@ -65,50 +65,6 @@ static int result; */ static struct DONAUDB_Plugin *plugin; - -/** - * Callback that should never be called. - */ -static void -dead_prepare_cb (void *cls, - uint64_t rowid, - const char *wire_method, - const char *buf, - size_t buf_size) -{ - (void) cls; - (void) rowid; - (void) wire_method; - (void) buf; - (void) buf_size; - GNUNET_assert (0); -} - - -/** - * Callback that is called with wire prepare data - * and then marks it as finished. - */ -static void -mark_prepare_cb (void *cls, - uint64_t rowid, - const char *wire_method, - const char *buf, - size_t buf_size) -{ - (void) cls; - GNUNET_assert (11 == buf_size); - GNUNET_assert (0 == strcasecmp (wire_method, - "testcase")); - GNUNET_assert (0 == memcmp (buf, - "hello world", - buf_size)); - GNUNET_break (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == - plugin->wire_prepare_data_mark_finished (plugin->cls, - rowid)); -} - - int main (int argc, char *const argv[]) diff --git a/src/include/donaudb_lib.h b/src/include/donaudb_lib.h @@ -47,154 +47,4 @@ DONAUDB_plugin_load (const struct GNUNET_CONFIGURATION_Handle *cfg); void DONAUDB_plugin_unload (struct DONAUDB_Plugin *plugin); -/** - * Information about an account from the configuration. - */ -struct DONAUDB_AccountInfo -{ - /** - * Authentication data. Only parsed if - * #DONAUDB_ALO_AUTHDATA was set. - */ - const struct TALER_BANK_AuthenticationData *auth; - - /** - * Section in the configuration file that specifies the - * account. Must start with "donau-account-". - */ - const char *section_name; - - /** - * Name of the wire method used by this account. - */ - const char *method; - - /** - * true if this account is enabed to be debited - * by the donau-aggregator. - */ - bool debit_enabled; - - /** - * true if this account is enabed to be credited by wallets - * and needs to be watched by the donau-wirewatch. - * Also, the account will only be included in /wire if credit - * is enabled. - */ - bool credit_enabled; -}; - -struct DONAUDB_TransactionList; -/** - * Calculate the total value of all transactions performed. - * Stores @a off plus the cost of all transactions in @a tl - * in @a ret. - * - * @param tl transaction list to process - * @param off offset to use as the starting value - * @param[out] ret where the resulting total is to be stored - * @return #GNUNET_OK on success, #GNUNET_SYSERR on errors - */ -enum GNUNET_GenericReturnValue -DONAUDB_calculate_transaction_list_totals ( - struct DONAUDB_TransactionList *tl, - const struct TALER_Amount *off, - struct TALER_Amount *ret); - - -/** - * Function called with information about a wire account. - * - * @param cls closure - * @param ai account information - */ -typedef void -(*DONAUDB_AccountCallback)( - void *cls, - const struct DONAUDB_AccountInfo *ai); - - -/** - * Return information about all accounts that - * were loaded by #DONAUDB_load_accounts(). - * - * @param cb callback to invoke - * @param cb_cls closure for @a cb - */ -void -DONAUDB_find_accounts (DONAUDB_AccountCallback cb, - void *cb_cls); - - -/** - * Find the wire plugin for the given payto:// URL. - * Only useful after the accounts have been loaded - * using #DONAUDB_load_accounts(). - * - * @param method wire method we need an account for - * @return NULL on error - */ -const struct DONAUDB_AccountInfo * -DONAUDB_find_account_by_method (const char *method); - - -/** - * Find the wire plugin for the given payto:// URL - * Only useful after the accounts have been loaded - * using #DONAUDB_load_accounts(). - * - * @param url wire address we need an account for - * @return NULL on error - */ -const struct DONAUDB_AccountInfo * -DONAUDB_find_account_by_payto_uri (const char *url); - - -/** - * Options for #DONAUDB_load_accounts() - */ -enum DONAUDB_AccountLoaderOptions -{ - DONAUDB_ALO_NONE = 0, - - /** - * Load accounts enabled for DEBITs. - */ - DONAUDB_ALO_DEBIT = 1, - - /** - * Load accounts enabled for CREDITs. - */ - DONAUDB_ALO_CREDIT = 2, - - /** - * Load authentication data from the - * "taler-accountcredentials-" section - * to access the account at the bank. - */ - DONAUDB_ALO_AUTHDATA = 4 -}; - - -/** - * Load account information opf the donau from - * @a cfg. - * - * @param cfg configuration to load from - * @param options loader options - * @return #GNUNET_OK on success, #GNUNET_NO if no accounts are configured - */ -enum GNUNET_GenericReturnValue -DONAUDB_load_accounts ( - const struct GNUNET_CONFIGURATION_Handle *cfg, - enum DONAUDB_AccountLoaderOptions options); - - -/** - * Free resources allocated by - * #DONAUDB_load_accounts(). - */ -void -DONAUDB_unload_accounts (void); - #endif diff --git a/src/testing/test_donau_api.c b/src/testing/test_donau_api.c @@ -33,7 +33,6 @@ #include <microhttpd.h> #include "taler/taler_bank_service.h" #include "taler/taler_fakebank_lib.h" -#include "taler/taler_testing_lib.h" /** * Configuration file we use. One (big) configuration is used @@ -44,7 +43,7 @@ static char *config_file; /** * Our credentials. */ -static struct TALER_TESTING_Credentials cred; +static struct DONAU_TESTING_Credentials cred; /** * Some tests behave differently when using CS as we cannot @@ -64,7 +63,7 @@ static bool uses_cs; */ static void run (void *cls, - struct TALER_TESTING_Interpreter *is) + struct DONAU_TESTING_Interpreter *is) { // tests } @@ -87,7 +86,7 @@ main (int argc, cipher); GNUNET_free (cipher); } - return TALER_TESTING_main (argv, + return DONAU_TESTING_main (argv, "INFO", config_file, "donau-account-2", diff --git a/src/testing/testing_api_misc.c b/src/testing/testing_api_misc.c @@ -28,7 +28,7 @@ bool -TALER_TESTING_has_in_name (const char *prog, +DONAU_TESTING_has_in_name (const char *prog, const char *marker) { size_t name_pos; @@ -51,127 +51,6 @@ TALER_TESTING_has_in_name (const char *prog, marker)); } - -enum GNUNET_GenericReturnValue -TALER_TESTING_get_credentials ( - const char *cfg_file, - const char *donau_account_section, - enum TALER_TESTING_BankSystem bs, - struct TALER_TESTING_Credentials *ua) -{ - unsigned long long port; - char *donau_payto_uri; - - ua->cfg = GNUNET_CONFIGURATION_create (); - if (GNUNET_OK != - GNUNET_CONFIGURATION_load (ua->cfg, - cfg_file)) - { - GNUNET_break (0); - GNUNET_CONFIGURATION_destroy (ua->cfg); - return GNUNET_SYSERR; - } - if (0 != - strncasecmp (donau_account_section, - "donau-account-", - strlen ("donau-account-"))) - { - GNUNET_break (0); - return GNUNET_SYSERR; - } - if (GNUNET_OK != - GNUNET_CONFIGURATION_get_value_string (ua->cfg, - donau_account_section, - "PAYTO_URI", - &donau_payto_uri)) - { - GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, - donau_account_section, - "PAYTO_URI"); - return GNUNET_SYSERR; - } - if (GNUNET_OK != - GNUNET_CONFIGURATION_get_value_number (ua->cfg, - "bank", - "HTTP_PORT", - &port)) - { - GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, - "bank", - "HTTP_PORT"); - return GNUNET_SYSERR; - } - { - char *csn; - - GNUNET_asprintf (&csn, - "donau-accountcredentials-%s", - &donau_account_section[strlen ("donau-account-")]); - if (GNUNET_OK != - TALER_BANK_auth_parse_cfg (ua->cfg, - csn, - &ua->ba)) - { - GNUNET_break (0); - GNUNET_free (csn); - return GNUNET_SYSERR; - } - GNUNET_free (csn); - } - if (GNUNET_OK != - GNUNET_CONFIGURATION_get_value_string (ua->cfg, - "donau", - "BASE_URL", - &ua->donau_url)) - { - GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, - "donau", - "BASE_URL"); - return GNUNET_SYSERR; - } - - switch (bs) - { - case TALER_TESTING_BS_FAKEBANK: - ua->donau_payto - = donau_payto_uri; - ua->user42_payto - = GNUNET_strdup ("payto://x-taler-bank/localhost/42?receiver-name=42"); - ua->user43_payto - = GNUNET_strdup ("payto://x-taler-bank/localhost/43?receiver-name=43"); - break; - case TALER_TESTING_BS_IBAN: - ua->donau_payto - = donau_payto_uri; - ua->user42_payto - = GNUNET_strdup ( - "payto://iban/SANDBOXX/FR7630006000011234567890189?receiver-name=User42"); - ua->user43_payto - = GNUNET_strdup ( - "payto://iban/SANDBOXX/GB33BUKB20201555555555?receiver-name=User43"); - break; - } - return GNUNET_OK; -} - - -json_t * -TALER_TESTING_make_wire_details (const char *payto) -{ - struct TALER_WireSaltP salt; - - /* salt must be constant for aggregation tests! */ - memset (&salt, - 47, - sizeof (salt)); - return GNUNET_JSON_PACK ( - GNUNET_JSON_pack_string ("payto_uri", - payto), - GNUNET_JSON_pack_data_auto ("salt", - &salt)); -} - - /** * Remove @a option directory from @a section in @a cfg. * @@ -206,7 +85,7 @@ remove_dir (const struct GNUNET_CONFIGURATION_Handle *cfg, enum GNUNET_GenericReturnValue -TALER_TESTING_cleanup_files_cfg ( +DONAU_TESTING_cleanup_files_cfg ( void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg) { @@ -247,7 +126,7 @@ TALER_TESTING_cleanup_files_cfg ( const struct DONAU_DenomPublicKey * -TALER_TESTING_find_pk ( +DONAU_TESTING_find_pk ( const struct DONAU_Keys *keys, const struct TALER_Amount *amount, bool age_restricted) @@ -308,7 +187,7 @@ TALER_TESTING_find_pk ( int -TALER_TESTING_wait_httpd_ready (const char *base_url) +DONAU_TESTING_wait_httpd_ready (const char *base_url) { char *wget_cmd; unsigned int iter; @@ -340,7 +219,7 @@ TALER_TESTING_wait_httpd_ready (const char *base_url) enum GNUNET_GenericReturnValue -TALER_TESTING_url_port_free (const char *url) +DONAU_TESTING_url_port_free (const char *url) { const char *port; long pnum;