donau

Donation authority for GNU Taler (experimental)
Log | Files | Refs | Submodules | README | LICENSE

commit faaf0dc757e0cc5589b1bdb15d73e457af0a533e
parent 22a490d729b470c7f30236f80617b9103c656028
Author: Casaburi Johannes <johannes.casaburi@students.bfh.ch>
Date:   Fri, 29 Mar 2024 18:12:47 +0100

pg_iterate_donation_units adjustment

Diffstat:
Msrc/donau/donau-httpd_keys.c | 50+++++++++++++++-----------------------------------
Msrc/donaudb/pg_iterate_donation_units.c | 34+++++++++++-----------------------
2 files changed, 26 insertions(+), 58 deletions(-)

diff --git a/src/donau/donau-httpd_keys.c b/src/donau/donau-httpd_keys.c @@ -991,9 +991,11 @@ destroy_key_state (struct DH_KeyStateHandle *ksh, clear_response_cache (ksh); GNUNET_CONTAINER_multihashmap_iterate (ksh->donation_unit_map, - &clear_donation_unit_cb, ksh); + &clear_donation_unit_cb, + ksh); GNUNET_CONTAINER_multihashmap_destroy (ksh->donation_unit_map); - GNUNET_CONTAINER_multipeermap_iterate (ksh->signkey_map, &clear_signkey_cb, + GNUNET_CONTAINER_multipeermap_iterate (ksh->signkey_map, + &clear_signkey_cb, ksh); GNUNET_CONTAINER_multipeermap_destroy (ksh->signkey_map); @@ -1108,13 +1110,15 @@ helper_rsa_cb ( &hd->h_donation_unit_pub.hash, hd, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); + // GNUNET_assert ( // GNUNET_OK == // GNUNET_CONTAINER_multihashmap_put ( // hs->rsa_keys, - // &hd->h_details.h_rsa.hash, + // &hd->h_donation_unit_pub.h_rsa.hash, // hd, // GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); + key_generation++; DH_resume_keys_requests (false); } @@ -1214,13 +1218,15 @@ helper_cs_cb ( &hd->h_donation_unit_pub.hash, hd, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); + // GNUNET_assert ( // GNUNET_OK == // GNUNET_CONTAINER_multihashmap_put ( // hs->cs_keys, - // &hd->h_details.h_cs.hash, + // &hd->h_donation_unit_pub.h_cs.hash, // hd, // GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); + key_generation++; DH_resume_keys_requests (false); } @@ -1387,37 +1393,10 @@ donation_unit_info_cb ( { struct DH_KeyStateHandle *ksh = cls; struct DH_DonationUnitKey *dk; -// -// if (GNUNET_OK != -// TALER_donau_offline_donation_unit_validity_verify ( -// h_donation_unit_pub, -// meta->start, -// meta->expire_withdraw, -// meta->expire_deposit, -// meta->expire_legal, -// &meta->value, -// &meta->fees, -// &TEH_master_public_key, -// master_sig)) -// { -// GNUNET_log (GNUNET_ERROR_TYPE_ERROR, -// "Database has donation_unit with invalid signature. Skipping entry. Did the donau offline public key change?\n"); -// return; -// } - - GNUNET_assert (GNUNET_CRYPTO_BSA_INVALID != - donation_unit_pub->bsign_pub_key->cipher); - - // if (GNUNET_TIME_absolute_is_zero (meta->start.abs_time) || - // GNUNET_TIME_absolute_is_zero (meta->expire_withdraw.abs_time) || - // GNUNET_TIME_absolute_is_zero (meta->expire_deposit.abs_time) || - // GNUNET_TIME_absolute_is_zero (meta->expire_legal.abs_time) ) - // { - // GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - // "Database contains invalid donation_unit key %s\n", - // GNUNET_h2s (&h_donation_unit_pub->hash)); - // return; - // } + + // GNUNET_assert (GNUNET_CRYPTO_BSA_INVALID != + // donation_unit_pub->bsign_pub_key->cipher); + dk = GNUNET_new (struct DH_DonationUnitKey); DONAU_donation_unit_pub_deep_copy (&dk->donation_unit_pub, donation_unit_pub); @@ -1480,6 +1459,7 @@ build_key_state (struct HelperState *hs) enum GNUNET_DB_QueryStatus qs; ksh = GNUNET_new (struct DH_KeyStateHandle); + ksh->signature_expires = GNUNET_TIME_UNIT_FOREVER_TS; ksh->reload_time = GNUNET_TIME_timestamp_get (); /* We must use the key_generation from when we STARTED the process! */ diff --git a/src/donaudb/pg_iterate_donation_units.c b/src/donaudb/pg_iterate_donation_units.c @@ -46,11 +46,6 @@ struct IterateDonationUnitsContext */ struct PostgresClosure *pg; - /** - * Flag set to #GNUNET_OK as long as everything is fine. - */ - enum GNUNET_DB_QueryStatus qs; - }; /** @@ -93,18 +88,15 @@ iterate_donation_units_cb (void *cls, i)) { GNUNET_break (0); - ctx->qs = GNUNET_DB_STATUS_HARD_ERROR; return; } - ctx->qs = i + 1; - if (GNUNET_OK != - ctx->cb (ctx->cb_cls, - &h_donation_unit_pub, - &donation_unit_pub, - validity_year, - &value)) - break; + ctx->cb (ctx->cb_cls, + &h_donation_unit_pub, + &donation_unit_pub, + validity_year, + &value); + GNUNET_PQ_cleanup_result (rs); } } @@ -123,7 +115,6 @@ DH_PG_iterate_donation_units (void *cls, .cb_cls = cb_cls, .pg = pg }; - enum GNUNET_DB_QueryStatus qs; PREPARE (pg, "iterate_donation_units", @@ -133,12 +124,9 @@ DH_PG_iterate_donation_units (void *cls, ",validity_year" ",value" " FROM donation_units"); - qs = GNUNET_PQ_eval_prepared_multi_select (pg->conn, - "iterate_donation_units", - params, - &iterate_donation_units_cb, - &ctx); - if (qs <= 0) - return qs; - return ctx.qs; + return GNUNET_PQ_eval_prepared_multi_select (pg->conn, + "iterate_donation_units", + params, + &iterate_donation_units_cb, + &ctx); }