diff options
| author | Christian Grothoff <christian@grothoff.org> | 2018-10-19 11:01:40 +0200 | 
|---|---|---|
| committer | Christian Grothoff <christian@grothoff.org> | 2018-10-19 11:01:49 +0200 | 
| commit | fb952babf67c41dedf3fac6b9d89eccf7fc10b2e (patch) | |
| tree | 2194d42b483b70cb01acc7a36e6e6b9821720376 /src/exchange | |
| parent | 9114794bee49af5d7c38d7f69a31808e4dedb6b1 (diff) | |
reduce redundant data fetch (#5444)
Diffstat (limited to 'src/exchange')
| -rw-r--r-- | src/exchange/taler-exchange-httpd_db.c | 3 | ||||
| -rw-r--r-- | src/exchange/taler-exchange-httpd_keystate.c | 2 | ||||
| -rw-r--r-- | src/exchange/taler-exchange-httpd_refresh_melt.c | 16 | 
3 files changed, 11 insertions, 10 deletions
diff --git a/src/exchange/taler-exchange-httpd_db.c b/src/exchange/taler-exchange-httpd_db.c index 34993150..579f0620 100644 --- a/src/exchange/taler-exchange-httpd_db.c +++ b/src/exchange/taler-exchange-httpd_db.c @@ -172,13 +172,12 @@ TEH_DB_calculate_transaction_list_totals (struct TALER_EXCHANGEDB_TransactionLis  					  struct TALER_Amount *ret)  {    struct TALER_Amount spent = *off; -  struct TALER_EXCHANGEDB_TransactionList *pos;    struct TALER_Amount refunded;    GNUNET_assert (GNUNET_OK ==                   TALER_amount_get_zero (spent.currency,                                          &refunded)); -  for (pos = tl; NULL != pos; pos = pos->next) +  for (struct TALER_EXCHANGEDB_TransactionList *pos = tl; NULL != pos; pos = pos->next)    {      switch (pos->type)      { diff --git a/src/exchange/taler-exchange-httpd_keystate.c b/src/exchange/taler-exchange-httpd_keystate.c index 2e1a85f8..413b9d1b 100644 --- a/src/exchange/taler-exchange-httpd_keystate.c +++ b/src/exchange/taler-exchange-httpd_keystate.c @@ -2107,7 +2107,7 @@ TEH_KS_handler_keys (struct TEH_RequestHandler *rh,                   sizeof (struct KeysResponseData),                   &krd_search_comparator); -  GNUNET_log (GNUNET_ERROR_TYPE_WARNING, +  GNUNET_log (GNUNET_ERROR_TYPE_INFO,                "Filtering /keys by cherry pick date %s found entry %u/%u\n",                GNUNET_STRINGS_absolute_time_to_string (last_issue_date),                (unsigned int) (krd - key_state->krd_array), diff --git a/src/exchange/taler-exchange-httpd_refresh_melt.c b/src/exchange/taler-exchange-httpd_refresh_melt.c index a844d3a4..476188de 100644 --- a/src/exchange/taler-exchange-httpd_refresh_melt.c +++ b/src/exchange/taler-exchange-httpd_refresh_melt.c @@ -252,20 +252,22 @@ refresh_melt_transaction (void *cls,    struct RefreshMeltContext *rmc = cls;    struct TALER_EXCHANGEDB_RefreshMelt rm;    enum GNUNET_DB_QueryStatus qs; +  uint32_t noreveal_index;    /* Check if we already created such a session */ -  qs = TEH_plugin->get_melt (TEH_plugin->cls, -                             session, -                             &rmc->refresh_session.rc, -                             &rm); +  qs = TEH_plugin->get_melt_index (TEH_plugin->cls, +                                   session, +                                   &rmc->refresh_session.rc, +                                   &noreveal_index);    if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs)    {      TALER_LOG_DEBUG ("Found already-melted coin\n");      *mhd_ret = reply_refresh_melt_success (connection,  					   &rmc->refresh_session.rc, -					   rm.session.noreveal_index); -    /* FIXME: is it normal to return "hard error" upon -     * _finding_ some data into the database?  */ +					   noreveal_index); +    /* Note: we return "hard error" to ensure the wrapper +       does not retry the transaction, and to also not generate +       a "fresh" response (as we would on "success") */      return GNUNET_DB_STATUS_HARD_ERROR;    }    if (0 > qs)  | 
