aboutsummaryrefslogtreecommitdiff
path: root/src/auditor
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2019-08-25 16:18:24 +0200
committerFlorian Dold <florian.dold@gmail.com>2019-08-25 16:18:24 +0200
commiteb559970846f0fa27f1f25c482cd07210a56f4b1 (patch)
tree8526637825e520e1420b17515934ced794a33c01 /src/auditor
parent3742239c13001433eeade439a0e0490f07351c43 (diff)
re-format code
Diffstat (limited to 'src/auditor')
-rw-r--r--src/auditor/taler-auditor-exchange.c37
-rw-r--r--src/auditor/taler-auditor-httpd.c109
-rw-r--r--src/auditor/taler-auditor-httpd_db.c37
-rw-r--r--src/auditor/taler-auditor-httpd_db.h12
-rw-r--r--src/auditor/taler-auditor-httpd_deposit-confirmation.c13
-rw-r--r--src/auditor/taler-auditor-httpd_exchanges.c8
-rw-r--r--src/auditor/taler-auditor-httpd_mhd.c24
-rw-r--r--src/auditor/taler-auditor-httpd_parsing.c30
-rw-r--r--src/auditor/taler-auditor-httpd_responses.c69
-rw-r--r--src/auditor/taler-auditor-httpd_responses.h20
-rw-r--r--src/auditor/taler-auditor-sign.c52
-rw-r--r--src/auditor/taler-auditor.c357
-rw-r--r--src/auditor/taler-wire-auditor.c120
13 files changed, 495 insertions, 393 deletions
diff --git a/src/auditor/taler-auditor-exchange.c b/src/auditor/taler-auditor-exchange.c
index 04c13fd0d..3cd6edf09 100644
--- a/src/auditor/taler-auditor-exchange.c
+++ b/src/auditor/taler-auditor-exchange.c
@@ -66,13 +66,14 @@ main (int argc,
char *cfgfile = NULL;
const struct GNUNET_GETOPT_CommandLineOption options[] = {
GNUNET_GETOPT_option_cfgfile (&cfgfile),
- GNUNET_GETOPT_option_help ("Add or remove exchange to list of audited exchanges"),
+ GNUNET_GETOPT_option_help (
+ "Add or remove exchange to list of audited exchanges"),
GNUNET_GETOPT_option_mandatory
- (GNUNET_GETOPT_option_base32_auto ('m',
- "exchange-key",
- "KEY",
- "public key of the exchange (Crockford base32 encoded)",
- &master_public_key)),
+ (GNUNET_GETOPT_option_base32_auto ('m',
+ "exchange-key",
+ "KEY",
+ "public key of the exchange (Crockford base32 encoded)",
+ &master_public_key)),
GNUNET_GETOPT_option_string ('u',
"exchange-url",
"URL",
@@ -108,7 +109,7 @@ main (int argc,
cfgfile))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Malformed configuration file `%s', exit ...\n"),
+ _ ("Malformed configuration file `%s', exit ...\n"),
cfgfile);
GNUNET_free_non_null (cfgfile);
return 1;
@@ -120,22 +121,22 @@ main (int argc,
if (NULL == exchange_url)
{
FPRINTF (stderr,
- _("Missing either `%s' or `%s'.\n"),
- "-u URL",
- "--remove");
+ _ ("Missing either `%s' or `%s'.\n"),
+ "-u URL",
+ "--remove");
return 1;
}
if ( (0 == strlen (exchange_url)) ||
- ( (0 != strncasecmp ("http://",
- exchange_url,
- strlen ("http://"))) &&
- (0 != strncasecmp ("https://",
- exchange_url,
- strlen ("https://"))) ) ||
- ('/' != exchange_url[strlen(exchange_url)-1]) )
+ ( (0 != strncasecmp ("http://",
+ exchange_url,
+ strlen ("http://"))) &&
+ (0 != strncasecmp ("https://",
+ exchange_url,
+ strlen ("https://"))) ) ||
+ ('/' != exchange_url[strlen (exchange_url) - 1]) )
{
fprintf (stderr,
- "Exchange URL must begin with `http://` or `https://` and end with `/'\n");
+ "Exchange URL must begin with `http://` or `https://` and end with `/'\n");
return 1;
}
}
diff --git a/src/auditor/taler-auditor-httpd.c b/src/auditor/taler-auditor-httpd.c
index c7c2589c6..967a084ef 100644
--- a/src/auditor/taler-auditor-httpd.c
+++ b/src/auditor/taler-auditor-httpd.c
@@ -232,10 +232,10 @@ signal_loop (void)
break;
}
if (EINTR == errno)
- {
- ret = 2;
- continue;
- }
+ {
+ ret = 2;
+ continue;
+ }
switch (c)
{
case SIGTERM:
@@ -325,7 +325,8 @@ handle_version (struct TAH_RequestHandler *rh,
ver = json_pack ("{s:s, s:s, s:o}",
"version", AUDITOR_PROTOCOL_VERSION,
"currency", currency,
- "auditor_public_key", GNUNET_JSON_from_data_auto (&auditor_pub));
+ "auditor_public_key", GNUNET_JSON_from_data_auto (
+ &auditor_pub));
}
if (NULL == ver)
{
@@ -361,44 +362,42 @@ handle_mhd_request (void *cls,
size_t *upload_data_size,
void **con_cls)
{
- static struct TAH_RequestHandler handlers[] =
- {
- /* Our most popular handler (thus first!), used by merchants to
- probabilistically report us their deposit confirmations. */
- { "/deposit-confirmation", MHD_HTTP_METHOD_PUT, "application/json",
- NULL, 0,
- &TAH_DEPOSIT_CONFIRMATION_handler, MHD_HTTP_OK },
- { "/exchanges", MHD_HTTP_METHOD_GET, "application/json",
- NULL, 0,
- &TAH_EXCHANGES_handler, MHD_HTTP_OK },
- { "/version", MHD_HTTP_METHOD_GET, "application/json",
- NULL, 0,
- &handle_version, MHD_HTTP_OK },
- /* Landing page, for now tells humans to go away (FIXME: replace
- with auditor's welcome page!) */
- { "/", MHD_HTTP_METHOD_GET, "text/plain",
- "Hello, I'm the Taler auditor. This HTTP server is not for humans.\n", 0,
- &TAH_MHD_handler_static_response, MHD_HTTP_OK },
- /* /robots.txt: disallow everything */
- { "/robots.txt", MHD_HTTP_METHOD_GET, "text/plain",
- "User-agent: *\nDisallow: /\n", 0,
- &TAH_MHD_handler_static_response, MHD_HTTP_OK },
- /* AGPL licensing page, redirect to source. As per the AGPL-license,
- every deployment is required to offer the user a download of the
- source. We make this easy by including a redirect to the source
- here. */
- { "/agpl", MHD_HTTP_METHOD_GET, "text/plain",
- NULL, 0,
- &TAH_MHD_handler_agpl_redirect, MHD_HTTP_FOUND },
-
- { NULL, NULL, NULL, NULL, 0, 0 }
- };
- static struct TAH_RequestHandler h404 =
- {
- "", NULL, "text/html",
- "<html><title>404: not found</title></html>", 0,
- &TAH_MHD_handler_static_response, MHD_HTTP_NOT_FOUND
- };
+ static struct TAH_RequestHandler handlers[] = {
+ /* Our most popular handler (thus first!), used by merchants to
+ probabilistically report us their deposit confirmations. */
+ { "/deposit-confirmation", MHD_HTTP_METHOD_PUT, "application/json",
+ NULL, 0,
+ &TAH_DEPOSIT_CONFIRMATION_handler, MHD_HTTP_OK },
+ { "/exchanges", MHD_HTTP_METHOD_GET, "application/json",
+ NULL, 0,
+ &TAH_EXCHANGES_handler, MHD_HTTP_OK },
+ { "/version", MHD_HTTP_METHOD_GET, "application/json",
+ NULL, 0,
+ &handle_version, MHD_HTTP_OK },
+ /* Landing page, for now tells humans to go away (FIXME: replace
+ with auditor's welcome page!) */
+ { "/", MHD_HTTP_METHOD_GET, "text/plain",
+ "Hello, I'm the Taler auditor. This HTTP server is not for humans.\n", 0,
+ &TAH_MHD_handler_static_response, MHD_HTTP_OK },
+ /* /robots.txt: disallow everything */
+ { "/robots.txt", MHD_HTTP_METHOD_GET, "text/plain",
+ "User-agent: *\nDisallow: /\n", 0,
+ &TAH_MHD_handler_static_response, MHD_HTTP_OK },
+ /* AGPL licensing page, redirect to source. As per the AGPL-license,
+ every deployment is required to offer the user a download of the
+ source. We make this easy by including a redirect to the source
+ here. */
+ { "/agpl", MHD_HTTP_METHOD_GET, "text/plain",
+ NULL, 0,
+ &TAH_MHD_handler_agpl_redirect, MHD_HTTP_FOUND },
+
+ { NULL, NULL, NULL, NULL, 0, 0 }
+ };
+ static struct TAH_RequestHandler h404 = {
+ "", NULL, "text/html",
+ "<html><title>404: not found</title></html>", 0,
+ &TAH_MHD_handler_static_response, MHD_HTTP_NOT_FOUND
+ };
struct TAH_RequestHandler *rh;
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
@@ -407,7 +406,7 @@ handle_mhd_request (void *cls,
if (0 == strcasecmp (method,
MHD_HTTP_METHOD_HEAD))
method = MHD_HTTP_METHOD_GET; /* treat HEAD as GET here, MHD will do the rest */
- for (unsigned int i=0;NULL != handlers[i].url;i++)
+ for (unsigned int i = 0; NULL != handlers[i].url; i++)
{
rh = &handlers[i];
if ( (0 == strcasecmp (url,
@@ -802,7 +801,8 @@ main (int argc,
"SECONDS",
"after how long do connections timeout by default (in seconds)",
&connection_timeout),
- GNUNET_GETOPT_option_help ("HTTP server providing a RESTful API to access a Taler auditor"),
+ GNUNET_GETOPT_option_help (
+ "HTTP server providing a RESTful API to access a Taler auditor"),
GNUNET_GETOPT_option_loglevel (&loglev),
GNUNET_GETOPT_option_logfile (&logfile),
GNUNET_GETOPT_option_version (VERSION "-" VCS_VERSION),
@@ -830,7 +830,7 @@ main (int argc,
cfgfile))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Malformed configuration file `%s', exit ...\n"),
+ _ ("Malformed configuration file `%s', exit ...\n"),
cfgfile);
GNUNET_free_non_null (cfgfile);
return 1;
@@ -846,9 +846,9 @@ main (int argc,
listen_fds = getenv ("LISTEN_FDS");
if ( (NULL != listen_pid) &&
(NULL != listen_fds) &&
- (getpid() == strtol (listen_pid,
- NULL,
- 10)) &&
+ (getpid () == strtol (listen_pid,
+ NULL,
+ 10)) &&
(1 == strtoul (listen_fds,
NULL,
10)) )
@@ -885,7 +885,10 @@ main (int argc,
}
mhd
- = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_PIPE_FOR_SHUTDOWN | MHD_USE_DEBUG | MHD_USE_DUAL_STACK | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TCP_FASTOPEN,
+ = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_PIPE_FOR_SHUTDOWN
+ | MHD_USE_DEBUG | MHD_USE_DUAL_STACK
+ | MHD_USE_INTERNAL_POLLING_THREAD
+ | MHD_USE_TCP_FASTOPEN,
(-1 == fh) ? serve_port : 0,
NULL, NULL,
&handle_mhd_request, NULL,
@@ -893,7 +896,8 @@ main (int argc,
MHD_OPTION_LISTEN_BACKLOG_SIZE, (unsigned int) 1024,
MHD_OPTION_LISTEN_SOCKET, fh,
MHD_OPTION_EXTERNAL_LOGGER, &handle_mhd_logs, NULL,
- MHD_OPTION_NOTIFY_COMPLETED, &handle_mhd_completion_callback, NULL,
+ MHD_OPTION_NOTIFY_COMPLETED,
+ &handle_mhd_completion_callback, NULL,
MHD_OPTION_CONNECTION_TIMEOUT, connection_timeout,
MHD_OPTION_END);
if (NULL == mhd)
@@ -960,7 +964,8 @@ main (int argc,
close it here */
GNUNET_break (0 == close (sock));
while (0 != MHD_get_daemon_info (mhd,
- MHD_DAEMON_INFO_CURRENT_CONNECTIONS)->num_connections)
+ MHD_DAEMON_INFO_CURRENT_CONNECTIONS)->
+ num_connections)
sleep (1);
/* Now we're really done, practice clean shutdown */
MHD_stop_daemon (mhd);
diff --git a/src/auditor/taler-auditor-httpd_db.c b/src/auditor/taler-auditor-httpd_db.c
index 846829551..e0ab8f2e1 100644
--- a/src/auditor/taler-auditor-httpd_db.c
+++ b/src/auditor/taler-auditor-httpd_db.c
@@ -51,9 +51,9 @@
int
TAH_DB_run_transaction (struct MHD_Connection *connection,
const char *name,
- int *mhd_ret,
- TAH_DB_TransactionCallback cb,
- void *cb_cls)
+ int *mhd_ret,
+ TAH_DB_TransactionCallback cb,
+ void *cb_cls)
{
struct TALER_AUDITORDB_Session *session;
@@ -64,46 +64,47 @@ TAH_DB_run_transaction (struct MHD_Connection *connection,
GNUNET_break (0);
if (NULL != mhd_ret)
*mhd_ret = TAH_RESPONSE_reply_internal_db_error (connection,
- TALER_EC_DB_SETUP_FAILED);
+ TALER_EC_DB_SETUP_FAILED);
return GNUNET_SYSERR;
}
// TAH_plugin->preflight (TAH_plugin->cls, session); // FIXME: needed?
- for (unsigned int retries = 0;retries < MAX_TRANSACTION_COMMIT_RETRIES; retries++)
+ for (unsigned int retries = 0; retries < MAX_TRANSACTION_COMMIT_RETRIES;
+ retries++)
{
enum GNUNET_DB_QueryStatus qs;
if (GNUNET_OK !=
- TAH_plugin->start (TAH_plugin->cls,
- session))
+ TAH_plugin->start (TAH_plugin->cls,
+ session))
{
GNUNET_break (0);
if (NULL != mhd_ret)
- *mhd_ret = TAH_RESPONSE_reply_internal_db_error (connection,
- TALER_EC_DB_START_FAILED);
+ *mhd_ret = TAH_RESPONSE_reply_internal_db_error (connection,
+ TALER_EC_DB_START_FAILED);
return GNUNET_SYSERR;
}
qs = cb (cb_cls,
- connection,
- session,
- mhd_ret);
+ connection,
+ session,
+ mhd_ret);
if (0 > qs)
TAH_plugin->rollback (TAH_plugin->cls,
- session);
+ session);
if (GNUNET_DB_STATUS_HARD_ERROR == qs)
return GNUNET_SYSERR;
if (0 <= qs)
qs = TAH_plugin->commit (TAH_plugin->cls,
- session);
+ session);
if (GNUNET_DB_STATUS_HARD_ERROR == qs)
{
if (NULL != mhd_ret)
- *mhd_ret = TAH_RESPONSE_reply_commit_error (connection,
- TALER_EC_DB_COMMIT_FAILED_HARD);
+ *mhd_ret = TAH_RESPONSE_reply_commit_error (connection,
+ TALER_EC_DB_COMMIT_FAILED_HARD);
return GNUNET_SYSERR;
}
/* make sure callback did not violate invariants! */
GNUNET_assert ( (NULL == mhd_ret) ||
- (-1 == *mhd_ret) );
+ (-1 == *mhd_ret) );
if (0 <= qs)
return GNUNET_OK;
}
@@ -112,7 +113,7 @@ TAH_DB_run_transaction (struct MHD_Connection *connection,
MAX_TRANSACTION_COMMIT_RETRIES);
if (NULL != mhd_ret)
*mhd_ret = TAH_RESPONSE_reply_commit_error (connection,
- TALER_EC_DB_COMMIT_FAILED_ON_RETRY);
+ TALER_EC_DB_COMMIT_FAILED_ON_RETRY);
return GNUNET_SYSERR;
}
diff --git a/src/auditor/taler-auditor-httpd_db.h b/src/auditor/taler-auditor-httpd_db.h
index 9aad86c12..1f702c818 100644
--- a/src/auditor/taler-auditor-httpd_db.h
+++ b/src/auditor/taler-auditor-httpd_db.h
@@ -41,9 +41,9 @@
*/
typedef enum GNUNET_DB_QueryStatus
(*TAH_DB_TransactionCallback)(void *cls,
- struct MHD_Connection *connection,
- struct TALER_AUDITORDB_Session *session,
- int *mhd_ret);
+ struct MHD_Connection *connection,
+ struct TALER_AUDITORDB_Session *session,
+ int *mhd_ret);
/**
@@ -63,9 +63,9 @@ typedef enum GNUNET_DB_QueryStatus
int
TAH_DB_run_transaction (struct MHD_Connection *connection,
const char *name,
- int *mhd_ret,
- TAH_DB_TransactionCallback cb,
- void *cb_cls);
+ int *mhd_ret,
+ TAH_DB_TransactionCallback cb,
+ void *cb_cls);
#endif
diff --git a/src/auditor/taler-auditor-httpd_deposit-confirmation.c b/src/auditor/taler-auditor-httpd_deposit-confirmation.c
index af86378cd..2b73a910a 100644
--- a/src/auditor/taler-auditor-httpd_deposit-confirmation.c
+++ b/src/auditor/taler-auditor-httpd_deposit-confirmation.c
@@ -75,7 +75,7 @@ store_exchange_signing_key_transaction (void *cls,
{
TALER_LOG_WARNING ("Failed to store exchange signing key in database\n");
*mhd_ret = TAH_RESPONSE_reply_internal_db_error (connection,
- TALER_EC_AUDITOR_EXCHANGE_STORE_DB_ERROR);
+ TALER_EC_AUDITOR_EXCHANGE_STORE_DB_ERROR);
}
return qs;
}
@@ -109,9 +109,10 @@ deposit_confirmation_transaction (void *cls,
dc);
if (GNUNET_DB_STATUS_HARD_ERROR == qs)
{
- TALER_LOG_WARNING ("Failed to store /deposit-confirmation information in database\n");
+ TALER_LOG_WARNING (
+ "Failed to store /deposit-confirmation information in database\n");
*mhd_ret = TAH_RESPONSE_reply_internal_db_error (connection,
- TALER_EC_DEPOSIT_CONFIRMATION_STORE_DB_ERROR);
+ TALER_EC_DEPOSIT_CONFIRMATION_STORE_DB_ERROR);
}
return qs;
}
@@ -130,8 +131,10 @@ deposit_confirmation_transaction (void *cls,
*/
static int
verify_and_execute_deposit_confirmation (struct MHD_Connection *connection,
- const struct TALER_AUDITORDB_DepositConfirmation *dc,
- const struct TALER_AUDITORDB_ExchangeSigningKey *es)
+ const struct
+ TALER_AUDITORDB_DepositConfirmation *dc,
+ const struct
+ TALER_AUDITORDB_ExchangeSigningKey *es)
{
struct TALER_ExchangeSigningKeyValidityPS skv;
struct TALER_DepositConfirmationPS dcs;
diff --git a/src/auditor/taler-auditor-httpd_exchanges.c b/src/auditor/taler-auditor-httpd_exchanges.c
index 866e4c7be..881c45a23 100644
--- a/src/auditor/taler-auditor-httpd_exchanges.c
+++ b/src/auditor/taler-auditor-httpd_exchanges.c
@@ -109,7 +109,7 @@ list_exchanges (void *cls,
{
TALER_LOG_WARNING ("Failed to handle /exchanges in database\n");
*mhd_ret = TAH_RESPONSE_reply_internal_db_error (connection,
- TALER_EC_LIST_EXCHANGES_DB_ERROR);
+ TALER_EC_LIST_EXCHANGES_DB_ERROR);
}
return qs;
}
@@ -139,9 +139,9 @@ TAH_EXCHANGES_handler (struct TAH_RequestHandler *rh,
if (GNUNET_OK !=
TAH_DB_run_transaction (connection,
"list exchanges",
- &mhd_ret,
- &list_exchanges,
- (void *) ja))
+ &mhd_ret,
+ &list_exchanges,
+ (void *) ja))
return mhd_ret;
return reply_exchanges_success (connection,
ja);
diff --git a/src/auditor/taler-auditor-httpd_mhd.c b/src/auditor/taler-auditor-httpd_mhd.c
index b8fc65afd..5f13691f5 100644
--- a/src/auditor/taler-auditor-httpd_mhd.c
+++ b/src/auditor/taler-auditor-httpd_mhd.c
@@ -45,10 +45,10 @@
*/
int
TAH_MHD_handler_static_response (struct TAH_RequestHandler *rh,
- struct MHD_Connection *connection,
- void **connection_cls,
- const char *upload_data,
- size_t *upload_data_size)
+ struct MHD_Connection *connection,
+ void **connection_cls,
+ const char *upload_data,
+ size_t *upload_data_size)
{
struct MHD_Response *response;
int ret;
@@ -142,16 +142,16 @@ TAH_MHD_handler_agpl_redirect (struct TAH_RequestHandler *rh,
*/
int
TAH_MHD_handler_send_json_pack_error (struct TAH_RequestHandler *rh,
- struct MHD_Connection *connection,
- void **connection_cls,
- const char *upload_data,
- size_t *upload_data_size)
+ struct MHD_Connection *connection,
+ void **connection_cls,
+ const char *upload_data,
+ size_t *upload_data_size)
{
return TAH_RESPONSE_reply_json_pack (connection,
- rh->response_code,
- "{s:s}",
- "error",
- rh->data);
+ rh->response_code,
+ "{s:s}",
+ "error",
+ rh->data);
}
diff --git a/src/auditor/taler-auditor-httpd_parsing.c b/src/auditor/taler-auditor-httpd_parsing.c
index 36ae4a166..bac338cc0 100644
--- a/src/auditor/taler-auditor-httpd_parsing.c
+++ b/src/auditor/taler-auditor-httpd_parsing.c
@@ -33,7 +33,7 @@
/**
* Maximum POST request size.
*/
-#define REQUEST_BUFFER_MAX (1024*1024)
+#define REQUEST_BUFFER_MAX (1024 * 1024)
@@ -82,17 +82,17 @@ TAH_PARSE_post_json (struct MHD_Connection *connection,
TAH_RESPONSE_reply_internal_error (connection,
TALER_EC_PARSER_OUT_OF_MEMORY,
"out of memory"))
- ? GNUNET_SYSERR : GNUNET_NO;
+ ? GNUNET_SYSERR : GNUNET_NO;
case GNUNET_JSON_PR_CONTINUE:
return GNUNET_YES;
case GNUNET_JSON_PR_REQUEST_TOO_LARGE:
return (MHD_NO ==
TAH_RESPONSE_reply_request_too_large (connection))
- ? GNUNET_SYSERR : GNUNET_NO;
+ ? GNUNET_SYSERR : GNUNET_NO;
case GNUNET_JSON_PR_JSON_INVALID:
return (MHD_YES ==
TAH_RESPONSE_reply_invalid_json (connection))
- ? GNUNET_NO : GNUNET_SYSERR;
+ ? GNUNET_NO : GNUNET_SYSERR;
case GNUNET_JSON_PR_SUCCESS:
GNUNET_break (NULL != *json);
return GNUNET_YES;
@@ -147,9 +147,9 @@ TAH_PARSE_mhd_request_arg_data (struct MHD_Connection *connection,
{
return (MHD_NO ==
TAH_RESPONSE_reply_arg_missing (connection,
- TALER_EC_PARAMETER_MISSING,
- param_name))
- ? GNUNET_SYSERR : GNUNET_NO;
+ TALER_EC_PARAMETER_MISSING,
+ param_name))
+ ? GNUNET_SYSERR : GNUNET_NO;
}
if (GNUNET_OK !=
GNUNET_STRINGS_string_to_data (str,
@@ -158,9 +158,9 @@ TAH_PARSE_mhd_request_arg_data (struct MHD_Connection *connection,
out_size))
return (MHD_NO ==
TAH_RESPONSE_reply_arg_invalid (connection,
- TALER_EC_PARAMETER_MALFORMED,
- param_name))
- ? GNUNET_SYSERR : GNUNET_NO;
+ TALER_EC_PARAMETER_MALFORMED,
+ param_name))
+ ? GNUNET_SYSERR : GNUNET_NO;
return GNUNET_OK;
}
@@ -201,10 +201,12 @@ TAH_PARSE_json_data (struct MHD_Connection *connection,
MHD_HTTP_BAD_REQUEST,
"{s:s, s:I, s:s, s:I}",
"error", "parse error",
- "code", (json_int_t) TALER_EC_JSON_INVALID_WITH_DETAILS,
+ "code",
+ (json_int_t)
+ TALER_EC_JSON_INVALID_WITH_DETAILS,
"field", error_json_name,
"line", (json_int_t) error_line))
- ? GNUNET_NO : GNUNET_SYSERR;
+ ? GNUNET_NO : GNUNET_SYSERR;
return ret;
}
return GNUNET_YES;
@@ -255,7 +257,7 @@ TAH_PARSE_json_array (struct MHD_Connection *connection,
"{s:s, s:I}",
"error", "parse error",
"dimension", dim))
- ? GNUNET_NO : GNUNET_SYSERR;
+ ? GNUNET_NO : GNUNET_SYSERR;
return ret;
}
ret = GNUNET_JSON_parse (root,
@@ -273,7 +275,7 @@ TAH_PARSE_json_array (struct MHD_Connection *connection,
"error", "parse error",
"field", error_json_name,
"line", (json_int_t) error_line))
- ? GNUNET_NO : GNUNET_SYSERR;
+ ? GNUNET_NO : GNUNET_SYSERR;
return ret;
}
return GNUNET_YES;
diff --git a/src/auditor/taler-auditor-httpd_responses.c b/src/auditor/taler-auditor-httpd_responses.c
index 045a77772..4c7b429e3 100644
--- a/src/auditor/taler-auditor-httpd_responses.c
+++ b/src/auditor/taler-auditor-httpd_responses.c
@@ -65,22 +65,22 @@ TAH_RESPONSE_can_compress (struct MHD_Connection *connection)
const char *de;
ae = MHD_lookup_connection_value (connection,
- MHD_HEADER_KIND,
- MHD_HTTP_HEADER_ACCEPT_ENCODING);
+ MHD_HEADER_KIND,
+ MHD_HTTP_HEADER_ACCEPT_ENCODING);
if (NULL == ae)
return MHD_NO;
if (0 == strcmp (ae,
"*"))
return MHD_YES;
de = strstr (ae,
- "deflate");
+ "deflate");
if (NULL == de)
return MHD_NO;
if ( ( (de == ae) ||
- (de[-1] == ',') ||
- (de[-1] == ' ') ) &&
+ (de[-1] == ',') ||
+ (de[-1] == ' ') ) &&
( (de[strlen ("deflate")] == '\0') ||
- (de[strlen ("deflate")] == ',') ||
+ (de[strlen ("deflate")] == ',') ||
(de[strlen ("deflate")] == ';') ) )
return MHD_YES;
return MHD_NO;
@@ -96,7 +96,7 @@ TAH_RESPONSE_can_compress (struct MHD_Connection *connection)
*/
int
TAH_RESPONSE_body_compress (void **buf,
- size_t *buf_size)
+ size_t *buf_size)
{
Bytef *cbuf;
uLongf cbuf_size;
@@ -107,9 +107,9 @@ TAH_RESPONSE_body_compress (void **buf,
if (NULL == cbuf)
return MHD_NO;
ret = compress (cbuf,
- &cbuf_size,
- (const Bytef *) *buf,
- *buf_size);
+ &cbuf_size,
+ (const Bytef *) *buf,
+ *buf_size);
if ( (Z_OK != ret) ||
(cbuf_size >= *buf_size) )
{
@@ -144,7 +144,7 @@ TAH_RESPONSE_reply_json (struct MHD_Connection *connection,
int comp;
json_str = json_dumps (json,
- JSON_INDENT(2));
+ JSON_INDENT (2));
if (NULL == json_str)
{
/**
@@ -163,7 +163,7 @@ TAH_RESPONSE_reply_json (struct MHD_Connection *connection,
if (MHD_YES ==
TAH_RESPONSE_can_compress (connection))
comp = TAH_RESPONSE_body_compress (&json_str,
- &json_len);
+ &json_len);
resp = MHD_create_response_from_buffer (json_len,
json_str,
MHD_RESPMEM_MUST_FREE);
@@ -181,9 +181,9 @@ TAH_RESPONSE_reply_json (struct MHD_Connection *connection,
{
/* Need to indicate to client that body is compressed */
if (MHD_NO ==
- MHD_add_response_header (resp,
- MHD_HTTP_HEADER_CONTENT_ENCODING,
- "deflate"))
+ MHD_add_response_header (resp,
+ MHD_HTTP_HEADER_CONTENT_ENCODING,
+ "deflate"))
{
GNUNET_break (0);
MHD_destroy_response (resp);
@@ -249,14 +249,14 @@ TAH_RESPONSE_reply_json_pack (struct MHD_Connection *connection,
*/
int
TAH_RESPONSE_reply_arg_invalid (struct MHD_Connection *connection,
- enum TALER_ErrorCode ec,
+ enum TALER_ErrorCode ec,
const char *param_name)
{
return TAH_RESPONSE_reply_json_pack (connection,
MHD_HTTP_BAD_REQUEST,
"{s:s, s:I, s:s}",
"error", "invalid parameter",
- "code", (json_int_t) ec,
+ "code", (json_int_t) ec,
"parameter", param_name);
}
@@ -273,14 +273,14 @@ TAH_RESPONSE_reply_arg_invalid (struct MHD_Connection *connection,
*/
int
TAH_RESPONSE_reply_arg_unknown (struct MHD_Connection *connection,
- enum TALER_ErrorCode ec,
+ enum TALER_ErrorCode ec,
const char *param_name)
{
return TAH_RESPONSE_reply_json_pack (connection,
MHD_HTTP_NOT_FOUND,
"{s:s, s:I, s:s}",
"error", "unknown entity referenced",
- "code", (json_int_t) ec,
+ "code", (json_int_t) ec,
"parameter", param_name);
}
@@ -295,14 +295,14 @@ TAH_RESPONSE_reply_arg_unknown (struct MHD_Connection *connection,
*/
int
TAH_RESPONSE_reply_signature_invalid (struct MHD_Connection *connection,
- enum TALER_ErrorCode ec,
+ enum TALER_ErrorCode ec,
const char *param_name)
{
return TAH_RESPONSE_reply_json_pack (connection,
MHD_HTTP_UNAUTHORIZED,
"{s:s, s:I, s:s}",
"error", "invalid signature",
- "code", (json_int_t) ec,
+ "code", (json_int_t) ec,
"parameter", param_name);
}
@@ -317,14 +317,14 @@ TAH_RESPONSE_reply_signature_invalid (struct MHD_Connection *connection,
*/
int
TAH_RESPONSE_reply_arg_missing (struct MHD_Connection *connection,
- enum TALER_ErrorCode ec,
+ enum TALER_ErrorCode ec,
const char *param_name)
{
return TAH_RESPONSE_reply_json_pack (connection,
MHD_HTTP_BAD_REQUEST,
"{s:s, s:I, s:s}",
"error", "missing parameter",
- "code", (json_int_t) ec,
+ "code", (json_int_t) ec,
"parameter", param_name);
}
@@ -339,14 +339,14 @@ TAH_RESPONSE_reply_arg_missing (struct MHD_Connection *connection,
*/
int
TAH_RESPONSE_reply_permission_denied (struct MHD_Connection *connection,
- enum TALER_ErrorCode ec,
+ enum TALER_ErrorCode ec,
const char *hint)
{
return TAH_RESPONSE_reply_json_pack (connection,
MHD_HTTP_FORBIDDEN,
"{s:s, s:I, s:s}",
"error", "permission denied",
- "code", (json_int_t) ec,
+ "code", (json_int_t) ec,
"hint", hint);
}
@@ -361,14 +361,14 @@ TAH_RESPONSE_reply_permission_denied (struct MHD_Connection *connection,
*/
int
TAH_RESPONSE_reply_internal_error (struct MHD_Connection *connection,
- enum TALER_ErrorCode ec,
+ enum TALER_ErrorCode ec,
const char *hint)
{
return TAH_RESPONSE_reply_json_pack (connection,
MHD_HTTP_INTERNAL_SERVER_ERROR,
"{s:s, s:I, s:s}",
"error", "internal error",
- "code", (json_int_t) ec,
+ "code", (json_int_t) ec,
"hint", hint);
}
@@ -383,14 +383,14 @@ TAH_RESPONSE_reply_internal_error (struct MHD_Connection *connection,
*/
int
TAH_RESPONSE_reply_external_error (struct MHD_Connection *connection,
- enum TALER_ErrorCode ec,
+ enum TALER_ErrorCode ec,
const char *hint)
{
return TAH_RESPONSE_reply_json_pack (connection,
MHD_HTTP_BAD_REQUEST,
"{s:s, s:I, s:s}",
"error", "client error",
- "code", (json_int_t) ec,
+ "code", (json_int_t) ec,
"hint", hint);
}
@@ -405,13 +405,13 @@ TAH_RESPONSE_reply_external_error (struct MHD_Connection *connection,
*/
int
TAH_RESPONSE_reply_commit_error (struct MHD_Connection *connection,
- enum TALER_ErrorCode ec)
+ enum TALER_ErrorCode ec)
{
return TAH_RESPONSE_reply_json_pack (connection,
MHD_HTTP_INTERNAL_SERVER_ERROR,
"{s:s, s:I}",
"error", "commit failure",
- "code", (json_int_t) ec);
+ "code", (json_int_t) ec);
}
@@ -425,10 +425,10 @@ TAH_RESPONSE_reply_commit_error (struct MHD_Connection *connection,
*/
int
TAH_RESPONSE_reply_internal_db_error (struct MHD_Connection *connection,
- enum TALER_ErrorCode ec)
+ enum TALER_ErrorCode ec)
{
return TAH_RESPONSE_reply_internal_error (connection,
- ec,
+ ec,
"Failure in database interaction");
}
@@ -472,7 +472,8 @@ TAH_RESPONSE_reply_invalid_json (struct MHD_Connection *connection)
MHD_HTTP_BAD_REQUEST,
"{s:s, s:I}",
"error", "invalid json",
- "code", (json_int_t) TALER_EC_JSON_INVALID);
+ "code",
+ (json_int_t) TALER_EC_JSON_INVALID);
}
diff --git a/src/auditor/taler-auditor-httpd_responses.h b/src/auditor/taler-auditor-httpd_responses.h
index 95e6183ef..1cb5faa82 100644
--- a/src/auditor/taler-auditor-httpd_responses.h
+++ b/src/auditor/taler-auditor-httpd_responses.h
@@ -53,7 +53,7 @@ TAH_RESPONSE_add_global_headers (struct MHD_Response *response);
*/
int
TAH_RESPONSE_body_compress (void **buf,
- size_t *buf_size);
+ size_t *buf_size);
/**
@@ -107,7 +107,7 @@ TAH_RESPONSE_reply_json_pack (struct MHD_Connection *connection,
*/
int
TAH_RESPONSE_reply_signature_invalid (struct MHD_Connection *connection,
- enum TALER_ErrorCode ec,
+ enum TALER_ErrorCode ec,
const char *param_name);
@@ -121,7 +121,7 @@ TAH_RESPONSE_reply_signature_invalid (struct MHD_Connection *connection,
*/
int
TAH_RESPONSE_reply_arg_invalid (struct MHD_Connection *connection,
- enum TALER_ErrorCode ec,
+ enum TALER_ErrorCode ec,
const char *param_name);
@@ -137,7 +137,7 @@ TAH_RESPONSE_reply_arg_invalid (struct MHD_Connection *connection,
*/
int
TAH_RESPONSE_reply_arg_unknown (struct MHD_Connection *connection,
- enum TALER_ErrorCode ec,
+ enum TALER_ErrorCode ec,
const char *param_name);
@@ -151,7 +151,7 @@ TAH_RESPONSE_reply_arg_unknown (struct MHD_Connection *connection,
*/
int
TAH_RESPONSE_reply_arg_missing (struct MHD_Connection *connection,
- enum TALER_ErrorCode ec,
+ enum TALER_ErrorCode ec,
const char *param_name);
@@ -165,7 +165,7 @@ TAH_RESPONSE_reply_arg_missing (struct MHD_Connection *connection,
*/
int
TAH_RESPONSE_reply_permission_denied (struct MHD_Connection *connection,
- enum TALER_ErrorCode ec,
+ enum TALER_ErrorCode ec,
const char *hint);
@@ -179,7 +179,7 @@ TAH_RESPONSE_reply_permission_denied (struct MHD_Connection *connection,
*/
int
TAH_RESPONSE_reply_internal_error (struct MHD_Connection *connection,
- enum TALER_ErrorCode ec,
+ enum TALER_ErrorCode ec,
const char *hint);
@@ -193,7 +193,7 @@ TAH_RESPONSE_reply_internal_error (struct MHD_Connection *connection,
*/
int
TAH_RESPONSE_reply_external_error (struct MHD_Connection *connection,
- enum TALER_ErrorCode ec,
+ enum TALER_ErrorCode ec,
const char *hint);
@@ -207,7 +207,7 @@ TAH_RESPONSE_reply_external_error (struct MHD_Connection *connection,
*/
int
TAH_RESPONSE_reply_commit_error (struct MHD_Connection *connection,
- enum TALER_ErrorCode ec);
+ enum TALER_ErrorCode ec);
/**
* Send a response indicating a failure to talk to the Auditor's
@@ -219,7 +219,7 @@ TAH_RESPONSE_reply_commit_error (struct MHD_Connection *connection,
*/
int
TAH_RESPONSE_reply_internal_db_error (struct MHD_Connection *connection,
- enum TALER_ErrorCode ec);
+ enum TALER_ErrorCode ec);
/**
diff --git a/src/auditor/taler-auditor-sign.c b/src/auditor/taler-auditor-sign.c
index 0636900ff..1bd7e908e 100644
--- a/src/auditor/taler-auditor-sign.c
+++ b/src/auditor/taler-auditor-sign.c
@@ -86,14 +86,14 @@ print_dk (const struct TALER_DenominationKeyValidityPS *dk)
"Value: %s\n",
s = TALER_amount_to_string (&a));
GNUNET_free (s);
- TALER_amount_ntoh (&a,
- &dk->fee_withdraw);
+ TALER_amount_ntoh (&a,
+ &dk->fee_withdraw);
fprintf (stdout,
"Withdraw fee: %s\n",
s = TALER_amount_to_string (&a));
GNUNET_free (s);
- TALER_amount_ntoh (&a,
- &dk->fee_deposit);
+ TALER_amount_ntoh (&a,
+ &dk->fee_deposit);
fprintf (stdout,
"Deposit fee: %s\n",
s = TALER_amount_to_string (&a));
@@ -113,16 +113,20 @@ print_dk (const struct TALER_DenominationKeyValidityPS *dk)
fprintf (stdout,
"Validity start time: %s\n",
- GNUNET_STRINGS_absolute_time_to_string (GNUNET_TIME_absolute_ntoh (dk->start)));
+ GNUNET_STRINGS_absolute_time_to_string (GNUNET_TIME_absolute_ntoh (
+ dk->start)));
fprintf (stdout,
"Withdraw end time: %s\n",
- GNUNET_STRINGS_absolute_time_to_string (GNUNET_TIME_absolute_ntoh (dk->expire_withdraw)));
+ GNUNET_STRINGS_absolute_time_to_string (GNUNET_TIME_absolute_ntoh (
+ dk->expire_withdraw)));
fprintf (stdout,
"Deposit end time: %s\n",
- GNUNET_STRINGS_absolute_time_to_string (GNUNET_TIME_absolute_ntoh (dk->expire_deposit)));
+ GNUNET_STRINGS_absolute_time_to_string (GNUNET_TIME_absolute_ntoh (
+ dk->expire_deposit)));
fprintf (stdout,
"Legal dispute end time: %s\n",
- GNUNET_STRINGS_absolute_time_to_string (GNUNET_TIME_absolute_ntoh (dk->expire_legal)));
+ GNUNET_STRINGS_absolute_time_to_string (GNUNET_TIME_absolute_ntoh (
+ dk->expire_legal)));
fprintf (stdout,
"\n");
@@ -153,22 +157,22 @@ main (int argc,
GNUNET_GETOPT_option_cfgfile (&cfgfile),
GNUNET_GETOPT_option_help ("Sign denomination keys of an exchange"),
GNUNET_GETOPT_option_mandatory
- (GNUNET_GETOPT_option_base32_auto ('m',
- "exchange-key",
- "KEY",
- "public key of the exchange (Crockford base32 encoded)",
- &master_public_key)),
+ (GNUNET_GETOPT_option_base32_auto ('m',
+ "exchange-key",
+ "KEY",
+ "public key of the exchange (Crockford base32 encoded)",
+ &master_public_key)),
GNUNET_GETOPT_option_string ('u',
"auditor-url",
"URL",
"URL of the auditor (informative link for the user)",
&auditor_url),
GNUNET_GETOPT_option_mandatory
- (GNUNET_GETOPT_option_filename ('r',
- "exchange-request",
- "FILENAME",
- "set of keys the exchange requested the auditor to sign",
- &exchange_request_file)),
+ (GNUNET_GETOPT_option_filename ('r',
+ "exchange-request",
+ "FILENAME",
+ "set of keys the exchange requested the auditor to sign",
+ &exchange_request_file)),
GNUNET_GETOPT_option_filename ('o',
"output",
"FILENAME",
@@ -203,7 +207,7 @@ main (int argc,
cfgfile))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Malformed configuration file `%s', exit ...\n"),
+ _ ("Malformed configuration file `%s', exit ...\n"),
cfgfile);
GNUNET_free_non_null (cfgfile);
return 1;
@@ -325,7 +329,7 @@ main (int argc,
return 1;
}
GNUNET_DISK_file_close (fh);
- for (unsigned int i=0;i<dks_len;i++)
+ for (unsigned int i = 0; i<dks_len; i++)
{
struct TALER_DenominationKeyValidityPS *dk = &dks[i];
@@ -383,20 +387,20 @@ main (int argc,
if (NULL == session)
{
fprintf (stderr,
- "Failed to initialize database session\n");
+ "Failed to initialize database session\n");
TALER_AUDITORDB_plugin_unload (adb);
GNUNET_free (dks);
GNUNET_free (sigs);
GNUNET_free (eddsa_priv);
return 3;
}
- for (unsigned int i=0;i<dks_len;i++)
+ for (unsigned int i = 0; i<dks_len; i++)
{
const struct TALER_DenominationKeyValidityPS *dk = &dks[i];
qs = adb->insert_denomination_info (adb->cls,
- session,
- dk);
+ session,
+ dk);
if (0 > qs)
{
fprintf (stderr,
diff --git a/src/auditor/taler-auditor.c b/src/auditor/taler-auditor.c
index dbc337948..536a5cabe 100644
--- a/src/auditor/taler-auditor.c
+++ b/src/auditor/taler-auditor.c
@@ -342,12 +342,12 @@ static struct TALER_Amount total_refresh_hanging;
*/
static void
report (json_t *array,
- json_t *object)
+ json_t *object)
{
GNUNET_assert (NULL != object);
GNUNET_assert (0 ==
- json_array_append_new (array,
- object));
+ json_array_append_new (array,
+ object));
}
@@ -363,21 +363,25 @@ report (json_t *array,
* @param risk maximum risk that might have just become real (coins created by this @a dki)
*/
static void
-report_emergency_by_amount (const struct TALER_EXCHANGEDB_DenominationKeyInformationP *dki,
+report_emergency_by_amount (const struct
+ TALER_EXCHANGEDB_DenominationKeyInformationP *dki,
const struct TALER_Amount *risk)
{
report (report_emergencies,
- json_pack ("{s:o, s:o, s:s, s:s, s:o}",
- "denompub_hash",
- GNUNET_JSON_from_data_auto (&dki->properties.denom_hash),
- "denom_risk",
- TALER_JSON_from_amount (risk),
- "start",
- GNUNET_STRINGS_absolute_time_to_string (GNUNET_TIME_absolute_ntoh (dki->properties.start)),
- "deposit_end",
- GNUNET_STRINGS_absolute_time_to_string (GNUNET_TIME_absolute_ntoh (dki->properties.expire_deposit)),
- "value",
- TALER_JSON_from_amount_nbo (&dki->properties.value)));
+ json_pack ("{s:o, s:o, s:s, s:s, s:o}",
+ "denompub_hash",
+ GNUNET_JSON_from_data_auto (&dki->properties.denom_hash),
+ "denom_risk",
+ TALER_JSON_from_amount (risk),
+ "start",
+ GNUNET_STRINGS_absolute_time_to_string (
+ GNUNET_TIME_absolute_ntoh (dki->properties.start)),
+ "deposit_end",
+ GNUNET_STRINGS_absolute_time_to_string (
+ GNUNET_TIME_absolute_ntoh (
+ dki->properties.expire_deposit)),
+ "value",
+ TALER_JSON_from_amount_nbo (&dki->properties.value)));
GNUNET_assert (GNUNET_OK ==
TALER_amount_add (&reported_emergency_sum,
&reported_emergency_sum,
@@ -400,27 +404,31 @@ report_emergency_by_amount (const struct TALER_EXCHANGEDB_DenominationKeyInforma
* @param risk amount that is at risk
*/
static void
-report_emergency_by_count (const struct TALER_EXCHANGEDB_DenominationKeyInformationP *dki,
+report_emergency_by_count (const struct
+ TALER_EXCHANGEDB_DenominationKeyInformationP *dki,
uint64_t num_issued,
uint64_t num_known,
const struct TALER_Amount *risk)
{
report (report_emergencies,
- json_pack ("{s:o, s:I, s:I, s:o, s:s, s:s, s:o}",
- "denompub_hash",
- GNUNET_JSON_from_data_auto (&dki->properties.denom_hash),
- "num_issued",
- (json_int_t) num_issued,
- "num_known",
- (json_int_t) num_known,
- "denom_risk",
- TALER_JSON_from_amount (risk),
- "start",
- GNUNET_STRINGS_absolute_time_to_string (GNUNET_TIME_absolute_ntoh (dki->properties.start)),
- "deposit_end",
- GNUNET_STRINGS_absolute_time_to_string (GNUNET_TIME_absolute_ntoh (dki->properties.expire_deposit)),
- "value",
- TALER_JSON_from_amount_nbo (&dki->properties.value)));
+ json_pack ("{s:o, s:I, s:I, s:o, s:s, s:s, s:o}",
+ "denompub_hash",
+ GNUNET_JSON_from_data_auto (&dki->properties.denom_hash),
+ "num_issued",
+ (json_int_t) num_issued,
+ "num_known",
+ (json_int_t) num_known,
+ "denom_risk",
+ TALER_JSON_from_amount (risk),
+ "start",
+ GNUNET_STRINGS_absolute_time_to_string (
+ GNUNET_TIME_absolute_ntoh (dki->properties.start)),
+ "deposit_end",
+ GNUNET_STRINGS_absolute_time_to_string (
+ GNUNET_TIME_absolute_ntoh (
+ dki->properties.expire_deposit)),
+ "value",
+ TALER_JSON_from_amount_nbo (&dki->properties.value)));
GNUNET_assert (GNUNET_OK ==
TALER_amount_add (&reported_emergency_sum,
&reported_emergency_sum,
@@ -463,7 +471,7 @@ report_amount_arithmetic_inconsistency (const char *operation,
else
{
/* auditor < exchange */
- profitable = - profitable;
+ profitable = -profitable;
GNUNET_break (GNUNET_OK ==
TALER_amount_subtract (&delta,
auditor,
@@ -479,8 +487,8 @@ report_amount_arithmetic_inconsistency (const char *operation,
if (0 != profitable)
{
target = (1 == profitable)
- ? &total_arithmetic_delta_plus
- : &total_arithmetic_delta_minus;
+ ? &total_arithmetic_delta_plus
+ : &total_arithmetic_delta_minus;
GNUNET_break (GNUNET_OK ==
TALER_amount_add (target,
target,
@@ -504,7 +512,8 @@ report_amount_arithmetic_inconsistency (const char *operation,
*/
static void
report_coin_arithmetic_inconsistency (const char *operation,
- const struct TALER_CoinSpendPublicKeyP *coin_pub,
+ const struct
+ TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_Amount *exchange,
const struct TALER_Amount *auditor,
int profitable)
@@ -524,7 +533,7 @@ report_coin_arithmetic_inconsistency (const char *operation,
else
{
/* auditor < exchange */
- profitable = - profitable;
+ profitable = -profitable;
GNUNET_break (GNUNET_OK ==
TALER_amount_subtract (&delta,
auditor,
@@ -540,8 +549,8 @@ report_coin_arithmetic_inconsistency (const char *operation,
if (0 != profitable)
{
target = (1 == profitable)
- ? &total_coin_delta_plus
- : &total_coin_delta_minus;
+ ? &total_coin_delta_plus
+ : &total_coin_delta_minus;
GNUNET_break (GNUNET_OK ==
TALER_amount_add (target,
target,
@@ -563,10 +572,10 @@ report_row_inconsistency (const char *table,
const char *diagnostic)
{
report (report_row_inconsistencies,
- json_pack ("{s:s, s:I, s:s}",
- "table", table,
- "row", (json_int_t) rowid,
- "diagnostic", diagnostic));
+ json_pack ("{s:s, s:I, s:s}",
+ "table", table,
+ "row", (json_int_t) rowid,
+ "diagnostic", diagnostic));
}
@@ -588,7 +597,9 @@ static struct GNUNET_CONTAINER_MultiHashMap *denominations;
*/
static enum GNUNET_DB_QueryStatus
get_denomination_info_by_hash (const struct GNUNET_HashCode *dh,
- const struct TALER_EXCHANGEDB_DenominationKeyInformationP **dki)
+ const struct
+ TALER_EXCHANGEDB_DenominationKeyInformationP **
+ dki)
{
struct TALER_EXCHANGEDB_DenominationKeyInformationP *dkip;
enum GNUNET_DB_QueryStatus qs;
@@ -646,7 +657,8 @@ get_denomination_info_by_hash (const struct GNUNET_HashCode *dh,
*/
static enum GNUNET_DB_QueryStatus
get_denomination_info (const struct TALER_DenominationPublicKey *denom_pub,
- const struct TALER_EXCHANGEDB_DenominationKeyInformationP **dki,
+ const struct
+ TALER_EXCHANGEDB_DenominationKeyInformationP **dki,
struct GNUNET_HashCode *dh)
{
struct GNUNET_HashCode hc;
@@ -997,9 +1009,11 @@ handle_reserve_out (void *cls,
report (denomination_key_validity_withdraw_inconsistencies,
json_pack ("{s:I, s:s, s:o, s:o}",
"row", (json_int_t) rowid,
- "execution_date", GNUNET_STRINGS_absolute_time_to_string (execution_date),
+ "execution_date",
+ GNUNET_STRINGS_absolute_time_to_string (execution_date),
"reserve_pub", GNUNET_JSON_from_data_auto (reserve_pub),
- "denompub_h", GNUNET_JSON_from_data_auto (&wsrd.h_denomination_pub)));
+ "denompub_h", GNUNET_JSON_from_data_auto (
+ &wsrd.h_denomination_pub)));
}
/* check reserve_sig */
@@ -1106,7 +1120,8 @@ handle_payback_by_reserve (void *cls,
const struct TALER_CoinPublicInfo *coin,
const struct TALER_DenominationPublicKey *denom_pub,
const struct TALER_CoinSpendSignatureP *coin_sig,
- const struct TALER_DenominationBlindingKeyP *coin_blind)
+ const struct
+ TALER_DenominationBlindingKeyP *coin_blind)
{
struct ReserveContext *rc = cls;
struct GNUNET_HashCode key;
@@ -1138,7 +1153,8 @@ handle_payback_by_reserve (void *cls,
"operation", "payback",
"row", (json_int_t) rowid,
"loss", TALER_JSON_from_amount (amount),
- "key_pub", GNUNET_JSON_from_data_auto (&coin->coin_pub)));
+ "key_pub", GNUNET_JSON_from_data_auto (
+ &coin->coin_pub)));
GNUNET_break (GNUNET_OK ==
TALER_amount_add (&total_bad_sig_loss,
&total_bad_sig_loss,
@@ -1175,14 +1191,16 @@ handle_payback_by_reserve (void *cls,
/* verify msig */
struct TALER_MasterDenominationKeyRevocationPS kr;
- kr.purpose.purpose = htonl (TALER_SIGNATURE_MASTER_DENOMINATION_KEY_REVOKED);
+ kr.purpose.purpose = htonl (
+ TALER_SIGNATURE_MASTER_DENOMINATION_KEY_REVOKED);
kr.purpose.size = htonl (sizeof (kr));
kr.h_denom_pub = pr.h_denom_pub;
if (GNUNET_OK !=
- GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MASTER_DENOMINATION_KEY_REVOKED,
- &kr.purpose,
- &msig.eddsa_signature,
- &master_pub.eddsa_pub))
+ GNUNET_CRYPTO_eddsa_verify (
+ TALER_SIGNATURE_MASTER_DENOMINATION_KEY_REVOKED,
+ &kr.purpose,
+ &msig.eddsa_signature,
+ &master_pub.eddsa_pub))
{
rev = "master signature invalid";
}
@@ -1287,7 +1305,8 @@ handle_reserve_closed (void *cls,
const struct TALER_Amount *closing_fee,
const struct TALER_ReservePublicKeyP *reserve_pub,
const char *receiver_account,
- const struct TALER_WireTransferIdentifierRawP *transfer_details)
+ const struct
+ TALER_WireTransferIdentifierRawP *transfer_details)
{
struct ReserveContext *rc = cls;
struct GNUNET_HashCode key;
@@ -1468,7 +1487,8 @@ verify_reserve_balance (void *cls,
/* Check that reserve is being closed if it is past its expiration date */
if ( (CLOSING_GRACE_PERIOD.rel_value_us >
- GNUNET_TIME_absolute_get_duration (rs->a_expiration_date).rel_value_us) &&
+ GNUNET_TIME_absolute_get_duration (
+ rs->a_expiration_date).rel_value_us) &&
( (0 != balance.value) ||
(0 != balance.fraction) ) )
{
@@ -1483,7 +1503,8 @@ verify_reserve_balance (void *cls,
"balance",
TALER_JSON_from_amount (&balance),
"expiration_time",
- GNUNET_STRINGS_absolute_time_to_string (rs->a_expiration_date)));
+ GNUNET_STRINGS_absolute_time_to_string (
+ rs->a_expiration_date)));
}
/* Add withdraw fees we encountered to totals */
@@ -1578,7 +1599,7 @@ verify_reserve_balance (void *cls,
ret = GNUNET_SYSERR;
rc->qs = qs;
}
- cleanup:
+ cleanup:
GNUNET_assert (GNUNET_YES ==
GNUNET_CONTAINER_multihashmap_remove (rc->reserves,
key,
@@ -1616,12 +1637,13 @@ analyze_reserves (void *cls)
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qsp)
{
GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
- _("First analysis using this auditor, starting audit from scratch\n"));
+ _ (
+ "First analysis using this auditor, starting audit from scratch\n"));
}
else
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- _("Resuming reserve audit at %llu/%llu/%llu/%llu\n"),
+ _ ("Resuming reserve audit at %llu/%llu/%llu/%llu\n"),
(unsigned long long) ppr.last_reserve_in_serial_id,
(unsigned long long) ppr.last_reserve_out_serial_id,
(unsigned long long) ppr.last_reserve_payback_serial_id,
@@ -1675,7 +1697,8 @@ analyze_reserves (void *cls)
}
qs = edb->select_reserve_closed_above_serial_id (edb->cls,
esession,
- ppr.last_reserve_close_serial_id,
+ ppr.
+ last_reserve_close_serial_id,
&handle_reserve_closed,
&rc);
if (qs < 0)
@@ -1729,12 +1752,12 @@ analyze_reserves (void *cls)
if (0 >= qs)
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Failed to update auditor DB, not recording progress\n");
+ "Failed to update auditor DB, not recording progress\n");
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
return qs;
}
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- _("Concluded reserve audit step at %llu/%llu/%llu/%llu\n"),
+ _ ("Concluded reserve audit step at %llu/%llu/%llu/%llu\n"),
(unsigned long long) ppr.last_reserve_in_serial_id,
(unsigned long long) ppr.last_reserve_out_serial_id,
(unsigned long long) ppr.last_reserve_payback_serial_id,
@@ -1939,11 +1962,17 @@ struct WireCheckContext
* @return #GNUNET_OK on success, #GNUNET_SYSERR on error
*/
static int
-check_transaction_history_for_deposit (const struct TALER_CoinSpendPublicKeyP *coin_pub,
- const struct GNUNET_HashCode *h_contract_terms,
- const struct TALER_MerchantPublicKeyP *merchant_pub,
- const struct TALER_EXCHANGEDB_DenominationKeyInformationP *dki,
- const struct TALER_EXCHANGEDB_TransactionList *tl_head,
+check_transaction_history_for_deposit (const struct
+ TALER_CoinSpendPublicKeyP *coin_pub,
+ const struct
+ GNUNET_HashCode *h_contract_terms,
+ const struct
+ TALER_MerchantPublicKeyP *merchant_pub,
+ const struct
+ TALER_EXCHANGEDB_DenominationKeyInformationP
+ *dki,
+ const struct
+ TALER_EXCHANGEDB_TransactionList *tl_head,
struct TALER_Amount *merchant_gain)
{
struct TALER_Amount expenditures;
@@ -1987,7 +2016,8 @@ check_transaction_history_for_deposit (const struct TALER_CoinSpendPublicKeyP *c
const struct TALER_AmountNBO *fee_dki;
struct TALER_Amount tmp;
- switch (tl->type) {
+ switch (tl->type)
+ {
case TALER_EXCHANGEDB_TT_DEPOSIT:
amount_with_fee = &tl->details.deposit->amount_with_fee;
fee = &tl->details.deposit->deposit_fee;
@@ -2241,12 +2271,14 @@ check_transaction_history_for_deposit (const struct TALER_CoinSpendPublicKeyP *c
static void
wire_transfer_information_cb (void *cls,
uint64_t rowid,
- const struct TALER_MerchantPublicKeyP *merchant_pub,
+ const struct
+ TALER_MerchantPublicKeyP *merchant_pub,
const struct GNUNET_HashCode *h_wire,
const json_t *account_details,
struct GNUNET_TIME_Absolute exec_time,
const struct GNUNET_HashCode *h_contract_terms,
- const struct TALER_DenominationPublicKey *denom_pub,
+ const struct
+ TALER_DenominationPublicKey *denom_pub,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_Amount *coin_value,
const struct TALER_Amount *deposit_fee)
@@ -2343,7 +2375,8 @@ wire_transfer_information_cb (void *cls,
"operation", "wire",
"row", (json_int_t) rowid,
"loss", TALER_JSON_from_amount (coin_value),
- "key_pub", GNUNET_JSON_from_data_auto (&dki->properties.denom_hash)));
+ "key_pub", GNUNET_JSON_from_data_auto (
+ &dki->properties.denom_hash)));
GNUNET_break (GNUNET_OK ==
TALER_amount_add (&total_bad_sig_loss,
&total_bad_sig_loss,
@@ -2434,8 +2467,8 @@ wire_transfer_information_cb (void *cls,
/* Add coin's contribution to total aggregate value */
if (GNUNET_OK !=
TALER_amount_add (&wcc->total_deposits,
- &wcc->total_deposits,
- &coin_value_without_fee))
+ &wcc->total_deposits,
+ &coin_value_without_fee))
{
GNUNET_break (0);
wcc->qs = GNUNET_DB_STATUS_HARD_ERROR;
@@ -2542,7 +2575,8 @@ get_wire_fee (struct AggregationContext *ac,
json_pack ("{s:s, s:s, s:s}",
"type", type,
"diagnostic", "start date before previous end date",
- "time", GNUNET_STRINGS_absolute_time_to_string (wfi->start_date)));
+ "time", GNUNET_STRINGS_absolute_time_to_string (
+ wfi->start_date)));
}
if ( (NULL != wfi->next) &&
(wfi->next->start_date.abs_value_us >= wfi->end_date.abs_value_us) )
@@ -2551,7 +2585,8 @@ get_wire_fee (struct AggregationContext *ac,
json_pack ("{s:s, s:s, s:s}",
"type", type,
"diagnostic", "end date date after next start date",
- "time", GNUNET_STRINGS_absolute_time_to_string (wfi->end_date)));
+ "time", GNUNET_STRINGS_absolute_time_to_string (
+ wfi->end_date)));
}
return &wfi->wire_fee;
}
@@ -2572,11 +2607,11 @@ get_wire_fee (struct AggregationContext *ac,
static int
check_wire_out_cb
(void *cls,
- uint64_t rowid,
- struct GNUNET_TIME_Absolute date,
- const struct TALER_WireTransferIdentifierRawP *wtid,
- const json_t *wire,
- const struct TALER_Amount *amount)
+ uint64_t rowid,
+ struct GNUNET_TIME_Absolute date,
+ const struct TALER_WireTransferIdentifierRawP *wtid,
+ const json_t *wire,
+ const struct TALER_Amount *amount)
{
struct AggregationContext *ac = cls;
struct WireCheckContext wcc;
@@ -2659,10 +2694,10 @@ check_wire_out_cb
report_amount_arithmetic_inconsistency
("wire out (fee structure)",
- rowid,
- &wcc.total_deposits,
- wire_fee,
- -1);
+ rowid,
+ &wcc.total_deposits,
+ wire_fee,
+ -1);
GNUNET_free (method);
return GNUNET_OK;
@@ -2670,8 +2705,8 @@ check_wire_out_cb
/* Round down to amount supported by wire method */
plugin = get_wire_plugin
- (ac,
- TALER_WIRE_get_plugin_from_method (method));
+ (ac,
+ TALER_WIRE_get_plugin_from_method (method));
if (NULL == plugin)
{
GNUNET_break (0);
@@ -2786,12 +2821,13 @@ analyze_aggregations (void *cls)
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qsp)
{
GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
- _("First analysis using this auditor, starting audit from scratch\n"));
+ _ (
+ "First analysis using this auditor, starting audit from scratch\n"));
}
else
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- _("Resuming aggregation audit at %llu\n"),
+ _ ("Resuming aggregation audit at %llu\n"),
(unsigned long long) ppa.last_wire_out_serial_id);
}
@@ -2799,9 +2835,9 @@ analyze_aggregations (void *cls)
0,
sizeof (ac));
qsx = adb->get_wire_fee_summary (adb->cls,
- asession,
- &master_pub,
- &total_aggregation_fee_income);
+ asession,
+ &master_pub,
+ &total_aggregation_fee_income);
if (0 > qsx)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qsx);
@@ -2809,10 +2845,10 @@ analyze_aggregations (void *cls)
}
ac.qs = GNUNET_DB_STATUS_SUCCESS_ONE_RESULT;
qs = edb->select_wire_out_above_serial_id (edb->cls,
- esession,
- ppa.last_wire_out_serial_id,
- &check_wire_out_cb,
- &ac);
+ esession,
+ ppa.last_wire_out_serial_id,
+ &check_wire_out_cb,
+ &ac);
if (0 > qs)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
@@ -2867,12 +2903,12 @@ analyze_aggregations (void *cls)
if (0 >= qs)
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Failed to update auditor DB, not recording progress\n");
+ "Failed to update auditor DB, not recording progress\n");
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
return qs;
}
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- _("Concluded aggregation audit step at %llu\n"),
+ _ ("Concluded aggregation audit step at %llu\n"),
(unsigned long long) ppa.last_wire_out_serial_id);
return GNUNET_DB_STATUS_SUCCESS_ONE_RESULT;
@@ -3006,14 +3042,16 @@ init_denomination (const struct GNUNET_HashCode *denom_hash,
/* check revocation signature */
struct TALER_MasterDenominationKeyRevocationPS rm;
- rm.purpose.purpose = htonl (TALER_SIGNATURE_MASTER_DENOMINATION_KEY_REVOKED);
+ rm.purpose.purpose = htonl (
+ TALER_SIGNATURE_MASTER_DENOMINATION_KEY_REVOKED);
rm.purpose.size = htonl (sizeof (rm));
rm.h_denom_pub = *denom_hash;
if (GNUNET_OK !=
- GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MASTER_DENOMINATION_KEY_REVOKED,
- &rm.purpose,
- &msig.eddsa_signature,
- &master_pub.eddsa_pub))
+ GNUNET_CRYPTO_eddsa_verify (
+ TALER_SIGNATURE_MASTER_DENOMINATION_KEY_REVOKED,
+ &rm.purpose,
+ &msig.eddsa_signature,
+ &master_pub.eddsa_pub))
{
report_row_inconsistency ("denomination revocation table",
rowid,
@@ -3051,7 +3089,8 @@ init_denomination (const struct GNUNET_HashCode *denom_hash,
*/
static struct DenominationSummary *
get_denomination_summary (struct CoinContext *cc,
- const struct TALER_EXCHANGEDB_DenominationKeyInformationP *dki,
+ const struct
+ TALER_EXCHANGEDB_DenominationKeyInformationP *dki,
const struct GNUNET_HashCode *dh)
{
struct DenominationSummary *ds;
@@ -3112,8 +3151,8 @@ sync_denomination (void *cls,
outstanding coins as revenue; and reduce cc->risk exposure. */
if (ds->in_db)
qs = adb->del_denomination_balance (adb->cls,
- asession,
- denom_hash);
+ asession,
+ denom_hash);
else
qs = GNUNET_DB_STATUS_SUCCESS_ONE_RESULT;
if ( (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs) &&
@@ -3372,7 +3411,7 @@ reveal_data_cb (void *cls,
rctx->num_newcoins = num_newcoins;
rctx->new_dps = GNUNET_new_array (num_newcoins,
struct TALER_DenominationPublicKey);
- for (unsigned int i=0;i<num_newcoins;i++)
+ for (unsigned int i = 0; i<num_newcoins; i++)
rctx->new_dps[i].rsa_public_key
= GNUNET_CRYPTO_rsa_public_key_dup (rrcs[i].denom_pub.rsa_public_key);
}
@@ -3502,12 +3541,14 @@ refresh_session_cb (void *cls,
}
{
- const struct TALER_EXCHANGEDB_DenominationKeyInformationP *new_dkis[reveal_ctx.num_newcoins];
+ const struct
+ TALER_EXCHANGEDB_DenominationKeyInformationP *new_dkis[reveal_ctx.
+ num_newcoins];
/* Update outstanding amounts for all new coin's denominations, and check
that the resulting amounts are consistent with the value being refreshed. */
err = GNUNET_NO;
- for (unsigned int i=0;i<reveal_ctx.num_newcoins;i++)
+ for (unsigned int i = 0; i<reveal_ctx.num_newcoins; i++)
{
/* lookup new coin denomination key */
qs = get_denomination_info (&reveal_ctx.new_dps[i],
@@ -3519,7 +3560,8 @@ refresh_session_cb (void *cls,
cc->qs = qs;
err = GNUNET_YES;
}
- GNUNET_CRYPTO_rsa_public_key_free (reveal_ctx.new_dps[i].rsa_public_key);
+ GNUNET_CRYPTO_rsa_public_key_free (
+ reveal_ctx.new_dps[i].rsa_public_key);
reveal_ctx.new_dps[i].rsa_public_key = NULL;
}
GNUNET_free (reveal_ctx.new_dps);
@@ -3529,7 +3571,7 @@ refresh_session_cb (void *cls,
return GNUNET_SYSERR;
/* calculate total refresh cost */
- for (unsigned int i=0;i<reveal_ctx.num_newcoins;i++)
+ for (unsigned int i = 0; i<reveal_ctx.num_newcoins; i++)
{
/* update cost of refresh */
struct TALER_Amount fee;
@@ -3585,7 +3627,7 @@ refresh_session_cb (void *cls,
}
/* update outstanding denomination amounts */
- for (unsigned int i=0;i<reveal_ctx.num_newcoins;i++)
+ for (unsigned int i = 0; i<reveal_ctx.num_newcoins; i++)
{
struct DenominationSummary *dsi;
struct TALER_Amount value;
@@ -4066,7 +4108,8 @@ check_payback (struct CoinContext *cc,
"operation", "payback",
"row", (json_int_t) rowid,
"loss", TALER_JSON_from_amount (amount),
- "key_pub", GNUNET_JSON_from_data_auto (&pr.h_denom_pub)));
+ "key_pub", GNUNET_JSON_from_data_auto (
+ &pr.h_denom_pub)));
GNUNET_break (GNUNET_OK ==
TALER_amount_add (&total_bad_sig_loss,
&total_bad_sig_loss,
@@ -4098,7 +4141,8 @@ check_payback (struct CoinContext *cc,
"operation", "payback",
"row", (json_int_t) rowid,
"loss", TALER_JSON_from_amount (amount),
- "coin_pub", GNUNET_JSON_from_data_auto (&coin->coin_pub)));
+ "coin_pub", GNUNET_JSON_from_data_auto (
+ &coin->coin_pub)));
GNUNET_break (GNUNET_OK ==
TALER_amount_add (&total_bad_sig_loss,
&total_bad_sig_loss,
@@ -4116,7 +4160,8 @@ check_payback (struct CoinContext *cc,
"operation", "payback (denomination not revoked)",
"row", (json_int_t) rowid,
"loss", TALER_JSON_from_amount (amount),
- "coin_pub", GNUNET_JSON_from_data_auto (&coin->coin_pub)));
+ "coin_pub", GNUNET_JSON_from_data_auto (
+ &coin->coin_pub)));
}
GNUNET_break (GNUNET_OK ==
TALER_amount_add (&ds->denom_payback,
@@ -4231,12 +4276,13 @@ analyze_coins (void *cls)
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qsp)
{
GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
- _("First analysis using this auditor, starting audit from scratch\n"));
+ _ (
+ "First analysis using this auditor, starting audit from scratch\n"));
}
else
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- _("Resuming coin audit at %llu/%llu/%llu/%llu/%llu\n"),
+ _ ("Resuming coin audit at %llu/%llu/%llu/%llu/%llu\n"),
(unsigned long long) ppc.last_deposit_serial_id,
(unsigned long long) ppc.last_melt_serial_id,
(unsigned long long) ppc.last_refund_serial_id,
@@ -4267,7 +4313,8 @@ analyze_coins (void *cls)
if (0 >
(qs = edb->select_reserves_out_above_serial_id (edb->cls,
esession,
- ppc.last_withdraw_serial_id,
+ ppc.
+ last_withdraw_serial_id,
&withdraw_cb,
&cc)) )
{
@@ -4325,7 +4372,8 @@ analyze_coins (void *cls)
if (0 >
(qs = edb->select_payback_refresh_above_serial_id (edb->cls,
esession,
- ppc.last_payback_refresh_serial_id,
+ ppc.
+ last_payback_refresh_serial_id,
&payback_refresh_cb,
&cc)))
{
@@ -4383,12 +4431,12 @@ analyze_coins (void *cls)
if (0 >= qs)
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Failed to update auditor DB, not recording progress\n");
+ "Failed to update auditor DB, not recording progress\n");
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
return qs;
}
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- _("Concluded coin audit step at %llu/%llu/%llu/%llu/%llu\n"),
+ _ ("Concluded coin audit step at %llu/%llu/%llu/%llu/%llu\n"),
(unsigned long long) ppc.last_deposit_serial_id,
(unsigned long long) ppc.last_melt_serial_id,
(unsigned long long) ppc.last_refund_serial_id,
@@ -4528,12 +4576,13 @@ analyze_deposit_confirmations (void *cls)
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qsp)
{
GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
- _("First analysis using this auditor, starting audit from scratch\n"));
+ _ (
+ "First analysis using this auditor, starting audit from scratch\n"));
}
else
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- _("Resuming deposit confirmation audit at %llu\n"),
+ _ ("Resuming deposit confirmation audit at %llu\n"),
(unsigned long long) ppdc.last_deposit_confirmation_serial_id);
}
@@ -4579,7 +4628,7 @@ analyze_deposit_confirmations (void *cls)
if (0 >= qs)
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Failed to update auditor DB, not recording progress\n");
+ "Failed to update auditor DB, not recording progress\n");
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
return qs;
}
@@ -4587,7 +4636,7 @@ analyze_deposit_confirmations (void *cls)
total_missed_deposit_confirmations = dcc.missed_amount;
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- _("Concluded deposit confirmation audit step at %llu\n"),
+ _ ("Concluded deposit confirmation audit step at %llu\n"),
(unsigned long long) ppdc.last_deposit_confirmation_serial_id);
return qs;
}
@@ -4657,10 +4706,10 @@ transact (Analysis analysis,
else
{
qs = adb->commit (adb->cls,
- asession);
+ asession);
if (0 > qs)
{
- GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
+ GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Auditor DB commit failed!\n");
}
@@ -4781,7 +4830,8 @@ run (void *cls,
}
if (GNUNET_OK !=
GNUNET_CRYPTO_eddsa_public_key_from_string (master_public_key_str,
- strlen (master_public_key_str),
+ strlen (
+ master_public_key_str),
&master_pub.eddsa_pub))
{
fprintf (stderr,
@@ -4807,9 +4857,9 @@ run (void *cls,
}
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_time (cfg,
- "exchangedb",
- "IDLE_RESERVE_EXPIRATION_TIME",
- &idle_reserve_expiration_time))
+ "exchangedb",
+ "IDLE_RESERVE_EXPIRATION_TIME",
+ &idle_reserve_expiration_time))
{
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
"exchangedb",
@@ -4946,33 +4996,36 @@ run (void *cls,
TALER_amount_get_zero (currency,
&total_refresh_hanging));
GNUNET_assert (NULL !=
- (report_emergencies = json_array ()));
+ (report_emergencies = json_array ()));
GNUNET_assert (NULL !=
- (report_row_inconsistencies = json_array ()));
+ (report_row_inconsistencies = json_array ()));
GNUNET_assert (NULL !=
- (denomination_key_validity_withdraw_inconsistencies = json_array ()));
+ (denomination_key_validity_withdraw_inconsistencies =
+ json_array ()));
GNUNET_assert (NULL !=
- (report_reserve_balance_summary_wrong_inconsistencies = json_array ()));
+ (report_reserve_balance_summary_wrong_inconsistencies =
+ json_array ()));
GNUNET_assert (NULL !=
- (report_reserve_balance_insufficient_inconsistencies = json_array ()));
+ (report_reserve_balance_insufficient_inconsistencies =
+ json_array ()));
GNUNET_assert (NULL !=
- (report_reserve_not_closed_inconsistencies = json_array ()));
+ (report_reserve_not_closed_inconsistencies = json_array ()));
GNUNET_assert (NULL !=
- (report_wire_out_inconsistencies = json_array ()));
+ (report_wire_out_inconsistencies = json_array ()));
GNUNET_assert (NULL !=
- (report_deposit_confirmation_inconsistencies = json_array ()));
+ (report_deposit_confirmation_inconsistencies = json_array ()));
GNUNET_assert (NULL !=
- (report_coin_inconsistencies = json_array ()));
+ (report_coin_inconsistencies = json_array ()));
GNUNET_assert (NULL !=
- (report_aggregation_fee_balances = json_array ()));
+ (report_aggregation_fee_balances = json_array ()));
GNUNET_assert (NULL !=
- (report_amount_arithmetic_inconsistencies = json_array ()));
+ (report_amount_arithmetic_inconsistencies = json_array ()));
GNUNET_assert (NULL !=
- (report_bad_sig_losses = json_array ()));
+ (report_bad_sig_losses = json_array ()));
GNUNET_assert (NULL !=
- (report_refreshs_hanging = json_array ()));
+ (report_refreshs_hanging = json_array ()));
GNUNET_assert (NULL !=
- (report_fee_time_inconsistencies = json_array ()));
+ (report_fee_time_inconsistencies = json_array ()));
setup_sessions_and_run ();
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Audit complete\n");
@@ -5008,9 +5061,11 @@ run (void *cls,
"reserve_balance_summary_wrong_inconsistencies",
report_reserve_balance_summary_wrong_inconsistencies,
"total_balance_summary_delta_plus",
- TALER_JSON_from_amount (&total_balance_summary_delta_plus),
+ TALER_JSON_from_amount (
+ &total_balance_summary_delta_plus),
"total_balance_summary_delta_minus",
- TALER_JSON_from_amount (&total_balance_summary_delta_minus),
+ TALER_JSON_from_amount (
+ &total_balance_summary_delta_minus),
/* block */
"total_escrow_balance",
TALER_JSON_from_amount (&total_escrow_balance),
@@ -5035,7 +5090,8 @@ run (void *cls,
report_reserve_not_closed_inconsistencies,
/* block */
"total_balance_reserve_not_closed",
- TALER_JSON_from_amount (&total_balance_reserve_not_closed),
+ TALER_JSON_from_amount (
+ &total_balance_reserve_not_closed),
"wire_out_inconsistencies",
report_wire_out_inconsistencies,
"total_wire_out_delta_plus",
@@ -5079,14 +5135,15 @@ run (void *cls,
(json_int_t) number_missed_deposit_confirmations,
/* block */
"missing_deposit_confirmation_total",
- TALER_JSON_from_amount (&total_missed_deposit_confirmations),
+ TALER_JSON_from_amount (
+ &total_missed_deposit_confirmations),
"total_payback_loss",
TALER_JSON_from_amount (&total_payback_loss)
);
GNUNET_break (NULL != report);
json_dumpf (report,
- stdout,
- JSON_INDENT (2));
+ stdout,
+ JSON_INDENT (2));
json_decref (report);
}
diff --git a/src/auditor/taler-wire-auditor.c b/src/auditor/taler-wire-auditor.c
index f0b118539..a94cd5f68 100644
--- a/src/auditor/taler-wire-auditor.c
+++ b/src/auditor/taler-wire-auditor.c
@@ -90,7 +90,7 @@ struct WireAccount
* Number of bytes in #in_wire_off and #out_wire_off.
*/
size_t wire_off_size;
-
+
/**
* We should check for inbound transactions to this account.
*/
@@ -556,7 +556,7 @@ commit (enum GNUNET_DB_QueryStatus qs)
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
return qs;
}
- }
+ }
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qsx)
qs = adb->update_wire_auditor_progress (adb->cls,
asession,
@@ -652,7 +652,8 @@ wire_missing_cb (void *cls,
json_pack ("{s:I, s:o, s:s, s:s, s:o, s:O}",
"row", (json_int_t) rowid,
"amount", TALER_JSON_from_amount (amount),
- "deadline", GNUNET_STRINGS_absolute_time_to_string (deadline),
+ "deadline", GNUNET_STRINGS_absolute_time_to_string (
+ deadline),
"claimed_done", (done) ? "yes" : "no",
"coin_pub", GNUNET_JSON_from_data_auto (coin_pub),
"account", wire));
@@ -663,7 +664,7 @@ wire_missing_cb (void *cls,
/**
* Checks that all wire transfers that should have happened
* (based on deposits) have indeed happened.
- *
+ *
* FIXME: this check _might_ rather belong with the
* taler-auditor logic.
*/
@@ -672,7 +673,7 @@ check_for_required_transfers ()
{
struct GNUNET_TIME_Absolute next_timestamp;
enum GNUNET_DB_QueryStatus qs;
-
+
next_timestamp = GNUNET_TIME_absolute_get ();
(void) GNUNET_TIME_round_abs (&next_timestamp);
/* Subtract #GRACE_PERIOD, so we can be a bit behind in processing
@@ -761,7 +762,8 @@ wire_out_cb (void *cls,
"amount_wired", TALER_JSON_from_amount (&zero),
"amount_justified", TALER_JSON_from_amount (amount),
"wtid", GNUNET_JSON_from_data_auto (wtid),
- "timestamp", GNUNET_STRINGS_absolute_time_to_string (date),
+ "timestamp", GNUNET_STRINGS_absolute_time_to_string (
+ date),
"diagnostic", "wire transfer not made (yet?)"));
GNUNET_break (GNUNET_OK ==
TALER_amount_add (&total_bad_amount_out_minus,
@@ -782,10 +784,12 @@ wire_out_cb (void *cls,
report (report_wire_out_inconsistencies,
json_pack ("{s:I, s:o, s:o, s:o, s:s, s:s}",
"row", (json_int_t) rowid,
- "amount_wired", TALER_JSON_from_amount (&roi->details.amount),
+ "amount_wired", TALER_JSON_from_amount (
+ &roi->details.amount),
"amount_justified", TALER_JSON_from_amount (&zero),
"wtid", GNUNET_JSON_from_data_auto (wtid),
- "timestamp", GNUNET_STRINGS_absolute_time_to_string (date),
+ "timestamp", GNUNET_STRINGS_absolute_time_to_string (
+ date),
"diagnostic", "recevier account missmatch"));
GNUNET_break (GNUNET_OK ==
TALER_amount_add (&total_bad_amount_out_plus,
@@ -797,7 +801,8 @@ wire_out_cb (void *cls,
"amount_wired", TALER_JSON_from_amount (&zero),
"amount_justified", TALER_JSON_from_amount (amount),
"wtid", GNUNET_JSON_from_data_auto (wtid),
- "timestamp", GNUNET_STRINGS_absolute_time_to_string (date),
+ "timestamp", GNUNET_STRINGS_absolute_time_to_string (
+ date),
"diagnostic", "receiver account missmatch"));
GNUNET_break (GNUNET_OK ==
TALER_amount_add (&total_bad_amount_out_minus,
@@ -815,9 +820,11 @@ wire_out_cb (void *cls,
json_pack ("{s:I, s:o, s:o, s:o, s:s, s:s}",
"row", (json_int_t) rowid,
"amount_justified", TALER_JSON_from_amount (amount),
- "amount_wired", TALER_JSON_from_amount (&roi->details.amount),
+ "amount_wired", TALER_JSON_from_amount (
+ &roi->details.amount),
"wtid", GNUNET_JSON_from_data_auto (wtid),
- "timestamp", GNUNET_STRINGS_absolute_time_to_string (date),
+ "timestamp", GNUNET_STRINGS_absolute_time_to_string (
+ date),
"diagnostic", "wire amount does not match"));
if (0 < TALER_amount_cmp (amount,
&roi->details.amount))
@@ -859,7 +866,7 @@ wire_out_cb (void *cls,
"row", (json_int_t) rowid,
"diagnostic", "execution date missmatch"));
}
-cleanup:
+ cleanup:
GNUNET_assert (GNUNET_OK ==
GNUNET_CONTAINER_multihashmap_remove (out_map,
&key,
@@ -894,13 +901,16 @@ complain_out_not_found (void *cls,
report (report_wire_out_inconsistencies,
json_pack ("{s:I, s:o, s:o, s:o, s:s, s:s}",
"row", (json_int_t) 0,
- "amount_wired", TALER_JSON_from_amount (&roi->details.amount),
+ "amount_wired", TALER_JSON_from_amount (
+ &roi->details.amount),
"amount_justified", TALER_JSON_from_amount (&zero),
"wtid", (NULL == roi->details.wtid_s)
? GNUNET_JSON_from_data_auto (&roi->details.wtid)
: json_string (roi->details.wtid_s),
- "timestamp", GNUNET_STRINGS_absolute_time_to_string (roi->details.execution_date),
- "diagnostic", "justification for wire transfer not found"));
+ "timestamp", GNUNET_STRINGS_absolute_time_to_string (
+ roi->details.execution_date),
+ "diagnostic",
+ "justification for wire transfer not found"));
GNUNET_break (GNUNET_OK ==
TALER_amount_add (&total_bad_amount_out_plus,
&total_bad_amount_out_plus,
@@ -937,7 +947,8 @@ check_exchange_wire_out (struct WireAccount *wa)
qs = edb->select_wire_out_above_serial_id_by_account (edb->cls,
esession,
wa->section_name,
- wa->pp.last_wire_out_serial_id,
+ wa->pp.
+ last_wire_out_serial_id,
&wire_out_cb,
wa);
if (0 > qs)
@@ -1093,7 +1104,7 @@ process_debits (void *cls)
struct WireAccount *wa = cls;
struct TALER_WIRE_Plugin *wp;
- /* skip accounts where DEBIT is not enabled */
+ /* skip accounts where DEBIT is not enabled */
while ( (NULL != wa) &&
(GNUNET_NO == wa->watch_debit) )
wa = wa->next;
@@ -1193,8 +1204,8 @@ reserve_in_cb (void *cls,
TALER_B2S (reserve_pub));
rii = GNUNET_new (struct ReserveInInfo);
GNUNET_CRYPTO_hash (wire_reference,
- wire_reference_size,
- &rii->row_off_hash);
+ wire_reference_size,
+ &rii->row_off_hash);
rii->row_off_size = wire_reference_size;
rii->details.amount = *credit;
rii->details.execution_date = execution_date;
@@ -1216,7 +1227,8 @@ reserve_in_cb (void *cls,
json_pack ("{s:s, s:I, s:o, s:s}",
"table", "reserves_in",
"row", (json_int_t) rowid,
- "wire_offset_hash", GNUNET_JSON_from_data_auto (&rii->row_off_hash),
+ "wire_offset_hash", GNUNET_JSON_from_data_auto (
+ &rii->row_off_hash),
"diagnostic", "duplicate wire offset"));
GNUNET_free (rii->details.account_url);
GNUNET_free_non_null (rii->details.wtid_s); /* field not used (yet) */
@@ -1248,11 +1260,14 @@ complain_in_not_found (void *cls,
report (report_reserve_in_inconsistencies,
json_pack ("{s:I, s:o, s:o, s:o, s:s, s:s}",
"row", (json_int_t) rii->rowid,
- "amount_expected", TALER_JSON_from_amount (&rii->details.amount),
+ "amount_expected", TALER_JSON_from_amount (
+ &rii->details.amount),
"amount_wired", TALER_JSON_from_amount (&zero),
"wtid", GNUNET_JSON_from_data_auto (&rii->details.wtid),
- "timestamp", GNUNET_STRINGS_absolute_time_to_string (rii->details.execution_date),
- "diagnostic", "incoming wire transfer claimed by exchange not found"));
+ "timestamp", GNUNET_STRINGS_absolute_time_to_string (
+ rii->details.execution_date),
+ "diagnostic",
+ "incoming wire transfer claimed by exchange not found"));
GNUNET_break (GNUNET_OK ==
TALER_amount_add (&total_bad_amount_in_minus,
&total_bad_amount_in_minus,
@@ -1334,7 +1349,8 @@ history_credit_cb (void *cls,
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Failed to find wire transfer at `%s' in exchange database. Audit ends at this point in time.\n",
- GNUNET_STRINGS_absolute_time_to_string (details->execution_date));
+ GNUNET_STRINGS_absolute_time_to_string (
+ details->execution_date));
wa->hh = NULL;
process_credits (wa->next);
return GNUNET_SYSERR; /* not an error, just end of processing */
@@ -1376,10 +1392,12 @@ history_credit_cb (void *cls,
report (report_reserve_in_inconsistencies,
json_pack ("{s:I, s:o, s:o, s:o, s:s, s:s}",
"row", GNUNET_JSON_from_data (row_off, row_off_size),
- "amount_exchange_expected", TALER_JSON_from_amount (&rii->details.amount),
+ "amount_exchange_expected", TALER_JSON_from_amount (
+ &rii->details.amount),
"amount_wired", TALER_JSON_from_amount (&zero),
"wtid", GNUNET_JSON_from_data_auto (&rii->details.wtid),
- "timestamp", GNUNET_STRINGS_absolute_time_to_string (rii->details.execution_date),
+ "timestamp", GNUNET_STRINGS_absolute_time_to_string (
+ rii->details.execution_date),
"diagnostic", "wire subject does not match"));
GNUNET_break (GNUNET_OK ==
TALER_amount_add (&total_bad_amount_in_minus,
@@ -1388,10 +1406,13 @@ history_credit_cb (void *cls,
report (report_reserve_in_inconsistencies,
json_pack ("{s:I, s:o, s:o, s:o, s:s, s:s}",
"row", GNUNET_JSON_from_data (row_off, row_off_size),
- "amount_exchange_expected", TALER_JSON_from_amount (&zero),
- "amount_wired", TALER_JSON_from_amount (&details->amount),
+ "amount_exchange_expected", TALER_JSON_from_amount (
+ &zero),
+ "amount_wired", TALER_JSON_from_amount (
+ &details->amount),
"wtid", GNUNET_JSON_from_data_auto (&details->wtid),
- "timestamp", GNUNET_STRINGS_absolute_time_to_string (details->execution_date),
+ "timestamp", GNUNET_STRINGS_absolute_time_to_string (
+ details->execution_date),
"diagnostic", "wire subject does not match"));
GNUNET_break (GNUNET_OK ==
@@ -1406,10 +1427,13 @@ history_credit_cb (void *cls,
report (report_reserve_in_inconsistencies,
json_pack ("{s:I, s:o, s:o, s:o, s:s, s:s}",
"row", GNUNET_JSON_from_data (row_off, row_off_size),
- "amount_exchange_expected", TALER_JSON_from_amount (&rii->details.amount),
- "amount_wired", TALER_JSON_from_amount (&details->amount),
+ "amount_exchange_expected", TALER_JSON_from_amount (
+ &rii->details.amount),
+ "amount_wired", TALER_JSON_from_amount (
+ &details->amount),
"wtid", GNUNET_JSON_from_data_auto (&details->wtid),
- "timestamp", GNUNET_STRINGS_absolute_time_to_string (details->execution_date),
+ "timestamp", GNUNET_STRINGS_absolute_time_to_string (
+ details->execution_date),
"diagnostic", "wire amount does not match"));
if (0 < TALER_amount_cmp (&details->amount,
&rii->details.amount))
@@ -1449,7 +1473,8 @@ history_credit_cb (void *cls,
json_pack ("{s:s, s:o, s:o}",
"amount", TALER_JSON_from_amount (&rii->details.amount),
"row", GNUNET_JSON_from_data (row_off, row_off_size),
- "wtid", GNUNET_JSON_from_data_auto (&rii->details.wtid)));
+ "wtid", GNUNET_JSON_from_data_auto (
+ &rii->details.wtid)));
GNUNET_break (GNUNET_OK ==
TALER_amount_add (&total_missattribution_in,
&total_missattribution_in,
@@ -1464,7 +1489,7 @@ history_credit_cb (void *cls,
"row", GNUNET_JSON_from_data (row_off, row_off_size),
"diagnostic", "execution date missmatch"));
}
- cleanup:
+ cleanup:
GNUNET_assert (GNUNET_OK ==
free_rii (NULL,
&key,
@@ -1505,7 +1530,8 @@ process_credits (void *cls)
qs = edb->select_reserves_in_above_serial_id_by_account (edb->cls,
esession,
wa->section_name,
- wa->pp.last_reserve_in_serial_id,
+ wa->pp.
+ last_reserve_in_serial_id,
&reserve_in_cb,
wa);
if (0 > qs)
@@ -1542,7 +1568,7 @@ process_credits (void *cls)
/**
* Begin audit of CREDITs to the exchange.
- */
+ */
static void
begin_credit_audit ()
{
@@ -1555,7 +1581,7 @@ begin_credit_audit ()
/**
* Start the database transactions and begin the audit.
- */
+ */
static void
begin_transaction ()
{
@@ -1617,7 +1643,8 @@ begin_transaction ()
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qsx)
{
GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
- _("First analysis using this auditor, starting audit from scratch\n"));
+ _ (
+ "First analysis using this auditor, starting audit from scratch\n"));
}
else
{
@@ -1739,7 +1766,8 @@ run (void *cls,
}
if (GNUNET_OK !=
GNUNET_CRYPTO_eddsa_public_key_from_string (master_public_key_str,
- strlen (master_public_key_str),
+ strlen (
+ master_public_key_str),
&master_pub.eddsa_pub))
{
fprintf (stderr,
@@ -1821,19 +1849,19 @@ run (void *cls,
return;
}
GNUNET_assert (NULL !=
- (report_wire_out_inconsistencies = json_array ()));
+ (report_wire_out_inconsistencies = json_array ()));
GNUNET_assert (NULL !=
- (report_reserve_in_inconsistencies = json_array ()));
+ (report_reserve_in_inconsistencies = json_array ()));
GNUNET_assert (NULL !=
- (report_row_minor_inconsistencies = json_array ()));
+ (report_row_minor_inconsistencies = json_array ()));
GNUNET_assert (NULL !=
- (report_wire_format_inconsistencies = json_array ()));
+ (report_wire_format_inconsistencies = json_array ()));
GNUNET_assert (NULL !=
- (report_row_inconsistencies = json_array ()));
+ (report_row_inconsistencies = json_array ()));
GNUNET_assert (NULL !=
- (report_missattribution_in_inconsistencies = json_array ()));
+ (report_missattribution_in_inconsistencies = json_array ()));
GNUNET_assert (NULL !=
- (report_lags = json_array ()));
+ (report_lags = json_array ()));
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (currency,
&total_bad_amount_out_plus));