summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <grothoff@gnunet.org>2021-05-29 10:06:58 +0200
committerChristian Grothoff <grothoff@gnunet.org>2021-05-29 10:06:58 +0200
commit35b232642bc831e8c9759f7ae6180bb2deabed7e (patch)
treee8d5ea2ae3104ab1caa0d2e104e91a55dd1359d8
parent060816eafd6756575e94982e224ac47c8c6e69a6 (diff)
downloadexchange-35b232642bc831e8c9759f7ae6180bb2deabed7e.tar.gz
exchange-35b232642bc831e8c9759f7ae6180bb2deabed7e.tar.bz2
exchange-35b232642bc831e8c9759f7ae6180bb2deabed7e.zip
-fix cherry picking, need MAX heap to build correct replies for all cpds
-rw-r--r--src/exchange/taler-exchange-httpd_keys.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/exchange/taler-exchange-httpd_keys.c b/src/exchange/taler-exchange-httpd_keys.c
index 07c73193..980ed272 100644
--- a/src/exchange/taler-exchange-httpd_keys.c
+++ b/src/exchange/taler-exchange-httpd_keys.c
@@ -1491,7 +1491,7 @@ finish_keys_response (struct TEH_KeyStateHandle *ksh)
&sctx);
recoup = json_array ();
GNUNET_assert (NULL != recoup);
- heap = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN);
+ heap = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MAX);
{
struct DenomKeyCtx dkc = {
.recoup = recoup,
@@ -1513,6 +1513,7 @@ finish_keys_response (struct TEH_KeyStateHandle *ksh)
{
struct TEH_DenominationKey *dk;
+ /* heap = min heap, sorted by start time */
while (NULL != (dk = GNUNET_CONTAINER_heap_remove_root (heap)))
{
if ( (last_cpd.abs_value_us != dk->meta.start.abs_value_us) &&
@@ -1755,7 +1756,7 @@ get_key_state (bool management_only)
}
if (old_ksh->key_generation < key_generation)
{
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Rebuilding /keys, generation upgrade from %llu to %llu\n",
(unsigned long long) old_ksh->key_generation,
(unsigned long long) key_generation);
@@ -1980,9 +1981,9 @@ krd_search_comparator (const void *key,
const struct KeysResponseData *krd = value;
if (kd->abs_value_us > krd->cherry_pick_date.abs_value_us)
- return 1;
- if (kd->abs_value_us < krd->cherry_pick_date.abs_value_us)
return -1;
+ if (kd->abs_value_us < krd->cherry_pick_date.abs_value_us)
+ return 1;
return 0;
}
@@ -2051,7 +2052,7 @@ TEH_keys_get_handler (const struct TEH_RequestHandler *rh,
if ( (NULL == krd) &&
(ksh->krd_array_length > 0) )
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Client provided invalid cherry picking timestamp %s, returning full response\n",
GNUNET_STRINGS_absolute_time_to_string (last_issue_date));
krd = &ksh->krd_array[ksh->krd_array_length - 1];