diff options
author | Christian Grothoff <christian@grothoff.org> | 2021-07-20 17:46:42 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2021-07-20 17:46:42 +0200 |
commit | 43dd7c8ae663fcb3db64fb7571c56144baa83a0e (patch) | |
tree | 740abce6ad63c1d7e47ec49c6d9408c2f3199220 /src | |
parent | 44f26ef64f0036474f4eed6974886ee4f41e28f0 (diff) | |
download | merchant-43dd7c8ae663fcb3db64fb7571c56144baa83a0e.tar.gz merchant-43dd7c8ae663fcb3db64fb7571c56144baa83a0e.tar.bz2 merchant-43dd7c8ae663fcb3db64fb7571c56144baa83a0e.zip |
die on bugs, do not commit
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/taler-merchant-httpd_private-post-instances.c | 1 | ||||
-rw-r--r-- | src/backenddb/merchant-0002.sql | 2 | ||||
-rw-r--r-- | src/backenddb/plugin_merchantdb_postgres.c | 25 | ||||
-rw-r--r-- | src/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 index 95f2ca37..f9df3d39 100644 --- 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 index 46428dd9..1cb1d7b2 100644 --- 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 index 2dc17b43..ed051053 100644 --- 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 index beeee462..f3989790 100644 --- 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 */ |