merchant

Merchant backend to process payments, run by merchants
Log | Files | Refs | Submodules | README | LICENSE

commit 43dd7c8ae663fcb3db64fb7571c56144baa83a0e
parent 44f26ef64f0036474f4eed6974886ee4f41e28f0
Author: Christian Grothoff <christian@grothoff.org>
Date:   Tue, 20 Jul 2021 17:46:42 +0200

die on bugs, do not commit

Diffstat:
Msrc/backend/taler-merchant-httpd_private-post-instances.c | 1+
Msrc/backenddb/merchant-0002.sql | 2+-
Msrc/backenddb/plugin_merchantdb_postgres.c | 25+++++--------------------
Msrc/include/taler_merchantdb_plugin.h | 6+++---
4 files changed, 10 insertions(+), 24 deletions(-)

diff --git a/src/backend/taler-merchant-httpd_private-post-instances.c b/src/backend/taler-merchant-httpd_private-post-instances.c @@ -310,6 +310,7 @@ TMH_private_post_instances (const struct TMH_RequestHandler *rh, "id"); } + /* Check currency of client matches our own currency */ if ( (0 != strcasecmp (is.default_max_deposit_fee.currency, TMH_currency)) || (0 != strcasecmp (is.default_max_wire_fee.currency, diff --git a/src/backenddb/merchant-0002.sql b/src/backenddb/merchant-0002.sql @@ -18,7 +18,7 @@ BEGIN; -- Check patch versioning is in place. -SELECT _v.register_patch('merchant-0002', NULL, NULL); +SELECT _v.register_patch('merchant-0002', ARRAY['merchant-0001'], NULL); -- need serial IDs on various tables for exchange-auditor replication diff --git a/src/backenddb/plugin_merchantdb_postgres.c b/src/backenddb/plugin_merchantdb_postgres.c @@ -155,7 +155,7 @@ postgres_create_tables (void *cls) /** * Do a pre-flight check that we are not in an uncommitted transaction. - * If we are, try to commit the previous transaction and output a warning. + * If we are, die. * Does not return anything, as we will continue regardless of the outcome. * * @param cls the `struct PostgresClosure` with the plugin-specific state @@ -164,28 +164,13 @@ static void postgres_preflight (void *cls) { struct PostgresClosure *pg = cls; - struct GNUNET_PQ_ExecuteStatement es[] = { - GNUNET_PQ_make_execute ("COMMIT"), - GNUNET_PQ_EXECUTE_STATEMENT_END - }; if (NULL == pg->transaction_name) return; /* all good */ - if (GNUNET_OK == - GNUNET_PQ_exec_statements (pg->conn, - es)) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "BUG: Preflight check committed transaction `%s'!\n", - pg->transaction_name); - } - else - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "BUG: Preflight check failed to commit transaction `%s'!\n", - pg->transaction_name); - } - pg->transaction_name = NULL; + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "BUG: Preflight check detected running transaction `%s'!\n", + pg->transaction_name); + GNUNET_assert (0); } diff --git a/src/include/taler_merchantdb_plugin.h b/src/include/taler_merchantdb_plugin.h @@ -717,9 +717,9 @@ struct TALER_MERCHANTDB_Plugin (*create_tables) (void *cls); /** - * Do a pre-flight check that we are not in an uncommitted transaction. - * If we are, try to commit the previous transaction and output a warning. - * Does not return anything, as we will continue regardless of the outcome. + * Do a pre-flight check that we are not in an uncommitted transaction. If + * we are, die. Does not return anything, as we will continue regardless of + * the outcome. * * @param cls the `struct PostgresClosure` with the plugin-specific state */