diff options
author | Sree Harsha Totakura <sreeharsha@totakura.in> | 2015-04-09 21:57:43 +0200 |
---|---|---|
committer | Sree Harsha Totakura <sreeharsha@totakura.in> | 2015-04-09 21:57:43 +0200 |
commit | 05f0aca9761302deb3f575de6d70c83947e93ae3 (patch) | |
tree | edbec7386717f261b7aa8d7ce569ac9f7949603a /src | |
parent | 0619d6d34527f14fcb70df4466d7b5feb0ceaeba (diff) |
httpd db: insert new session into the DB before it is referenced
Diffstat (limited to 'src')
-rw-r--r-- | src/mint/taler-mint-httpd_db.c | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/src/mint/taler-mint-httpd_db.c b/src/mint/taler-mint-httpd_db.c index 87ccf83db..df97db4f4 100644 --- a/src/mint/taler-mint-httpd_db.c +++ b/src/mint/taler-mint-httpd_db.c @@ -649,6 +649,23 @@ TMH_DB_execute_refresh_melt (struct MHD_Connection *connection, return TMH_RESPONSE_reply_internal_db_error (connection); } + /* store 'global' session data */ + refresh_session.num_oldcoins = coin_count; + refresh_session.num_newcoins = num_new_denoms; + refresh_session.noreveal_index + = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_STRONG, + TALER_CNC_KAPPA); + if (GNUNET_OK != + (res = TMH_plugin->create_refresh_session (TMH_plugin->cls, + session, + session_hash, + &refresh_session))) + { + TMH_plugin->rollback (TMH_plugin->cls, + session); + return TMH_RESPONSE_reply_internal_db_error (connection); + } + /* Melt old coins and check that they had enough residual value */ key_state = TMH_KS_acquire (); for (i=0;i<coin_count;i++) @@ -713,26 +730,6 @@ TMH_DB_execute_refresh_melt (struct MHD_Connection *connection, } } - - /* store 'global' session data */ - refresh_session.num_oldcoins = coin_count; - refresh_session.num_newcoins = num_new_denoms; - refresh_session.noreveal_index - = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_STRONG, - TALER_CNC_KAPPA); - if (GNUNET_OK != - (res = TMH_plugin->create_refresh_session (TMH_plugin->cls, - session, - session_hash, - &refresh_session))) - { - TMH_plugin->rollback (TMH_plugin->cls, - session); - return TMH_RESPONSE_reply_internal_db_error (connection); - } - - - if (GNUNET_OK != TMH_plugin->commit (TMH_plugin->cls, session)) |