exchange

Base system with REST service to issue digital coins, run by the payment service provider
Log | Files | Refs | Submodules | README | LICENSE

commit 78dc0a850ada3ef207591c3301ef171e790893c4
parent 5d4fba082281c51d1972f1038f4f9fcd777d5bf7
Author: Özgür Kesim <oec@codeblau.de>
Date:   Tue, 27 Oct 2026 10:44:26 +0100

[exchange] rc_version replaces is_v27_refresh (#11862)

Diffstat:
Msrc/exchange/taler-exchange-httpd_post-melt.c | 20+++++++++++++-------
Msrc/exchange/taler-exchange-httpd_post-reveal-melt.c | 8++++----
Msrc/exchangedb/do_refresh.c | 8++++----
Msrc/exchangedb/get_refresh.c | 2--
Msrc/exchangedb/test_coin_history.c | 1-
Msrc/exchangedb/test_recoup_refresh.c | 1-
Msrc/exchangedb/test_refresh.c | 7-------
Msrc/include/exchangedb_lib.h | 18++++++------------
8 files changed, 27 insertions(+), 38 deletions(-)

diff --git a/src/exchange/taler-exchange-httpd_post-melt.c b/src/exchange/taler-exchange-httpd_post-melt.c @@ -203,13 +203,19 @@ struct MeltContext * one for each kappa value. * * MAYBE null. If the client has NOT provided the transfer_pubs in the request, - * @e refresh.is_v27_refresh will be true. + * @e no_transfer_pubs will be true. * * TODO: Once v27 clients are gone, this MUST NOT be nulls. */ struct TALER_TransferPublicKeyP *transfer_pubs[TALER_CNC_KAPPA]; /** + * True if the client did not provide @e transfer_pubs, that is, + * it uses v27 of the refresh protocol. + */ + bool no_transfer_pubs; + + /** * #TALER_CNC_KAPPA hashes of the batches of @e num_coins coins. */ struct TALER_KappaHashBlindedPlanchetsP kappa_planchets_h; @@ -356,7 +362,7 @@ clean_melt_rc (struct TEH_RequestContext *rc) TALER_blinded_planchet_free (&mc->request.planchets[k][i]); GNUNET_free (mc->request.planchets[k]); } - if (! mc->request.refresh.is_v27_refresh) + if (! mc->request.no_transfer_pubs) GNUNET_free (mc->request.transfer_pubs[k]); } free_refresh (&mc->request.refresh); @@ -405,7 +411,7 @@ phase_parse_request ( GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_array_const ("transfer_pubs", &j_transfer_pubs), - &mc->request.refresh.is_v27_refresh), + &mc->request.no_transfer_pubs), GNUNET_JSON_spec_array_const ("denoms_h", &j_denoms_h), GNUNET_JSON_spec_array_const ("coin_evs", @@ -463,7 +469,7 @@ phase_parse_request ( "coin_evs must be an array of length "TALER_CNC_KAPPA_STR); return; } - if (! mc->request.refresh.is_v27_refresh && + if (! mc->request.no_transfer_pubs && (TALER_CNC_KAPPA != json_array_size (j_transfer_pubs))) { GNUNET_break_op (0); @@ -603,7 +609,7 @@ phase_parse_request ( } /* Parse the transfer public keys, if applicable */ - if (! mc->request.refresh.is_v27_refresh) + if (! mc->request.no_transfer_pubs) { json_t *j_ktp; size_t kappa; @@ -942,7 +948,7 @@ phase_check_coin_signature ( mc->request.denoms_h, &k_bps_h.tuple[k]); - if (mc->request.refresh.is_v27_refresh) + if (mc->request.no_transfer_pubs) { mc->request.refresh.rc_version = TALER_REFRESH_COMMITMENT_VERSION_LEGACY_V27; @@ -1205,7 +1211,7 @@ phase_prepare_transaction ( mc->request.kappa_planchets_h.tuple[noreveal_idx]; /* If applicable, save the chosen transfer public keys */ - if (! mc->request.refresh.is_v27_refresh) + if (! mc->request.no_transfer_pubs) mc->request.refresh.transfer_pubs = mc->request.transfer_pubs[noreveal_idx]; diff --git a/src/exchange/taler-exchange-httpd_post-reveal-melt.c b/src/exchange/taler-exchange-httpd_post-reveal-melt.c @@ -366,7 +366,7 @@ verify_commitment ( * If the refresh was for v27, signatures must not be NULL, * otherwise the revealed batch seeds must not be NULL. */ - if (rf->is_v27_refresh) + if (TALER_REFRESH_COMMITMENT_VERSION_LEGACY_V27 == rf->rc_version) { if (NULL == signatures) { @@ -455,7 +455,7 @@ verify_commitment ( * over the refresh nonce. This proves the ownership * for the fresh coin. */ - if (rf->is_v27_refresh) + if (TALER_REFRESH_COMMITMENT_VERSION_LEGACY_V27 == rf->rc_version) { size_t sig_idx = 0; struct TALER_KappaPublicRefreshNoncesP kappa_nonces; @@ -544,7 +544,7 @@ verify_commitment ( * transfer public keys of the selected batch */ kappa_planchets_h.tuple[k] = rf->selected_h; - if (! rf->is_v27_refresh) + if (TALER_REFRESH_COMMITMENT_VERSION_LEGACY_V27 != rf->rc_version) kappa_transfer_pubs.batch[k] = rf->transfer_pubs; } else @@ -570,7 +570,7 @@ verify_commitment ( * Expand from the k-th signature all num_coin planchet secrets, * except for the noreveal_index. */ - if (rf->is_v27_refresh) + if (TALER_REFRESH_COMMITMENT_VERSION_LEGACY_V27 == rf->rc_version) { TALER_refresh_signature_to_secrets_v27 ( &(*signatures)[sig_idx++], diff --git a/src/exchangedb/do_refresh.c b/src/exchangedb/do_refresh.c @@ -41,7 +41,7 @@ TALER_EXCHANGEDB_do_refresh ( GNUNET_PQ_query_param_auto_from_type (&refresh->rc), GNUNET_PQ_query_param_timestamp (timestamp), GNUNET_PQ_query_param_auto_from_type (&refresh->refresh_seed), /* 3 */ - (refresh->is_v27_refresh) + (TALER_REFRESH_COMMITMENT_VERSION_LEGACY_V27 == refresh->rc_version) ? GNUNET_PQ_query_param_null () : GNUNET_PQ_query_param_array_auto_from_type (refresh->num_coins, refresh->transfer_pubs, @@ -100,9 +100,9 @@ TALER_EXCHANGEDB_do_refresh ( }; enum GNUNET_DB_QueryStatus qs; - GNUNET_assert (refresh->is_v27_refresh == - (TALER_REFRESH_COMMITMENT_VERSION_LEGACY_V27 == - refresh->rc_version)); + GNUNET_assert ((TALER_REFRESH_COMMITMENT_VERSION_LEGACY_V27 == + refresh->rc_version) == + (NULL == refresh->transfer_pubs)); PREPARE (pg, "do_refresh", "SELECT " diff --git a/src/exchangedb/get_refresh.c b/src/exchangedb/get_refresh.c @@ -183,7 +183,6 @@ TALER_EXCHANGEDB_get_refresh ( } if (no_transfer_pubs) { - refresh->is_v27_refresh = true; refresh->transfer_pubs = NULL; } else @@ -199,7 +198,6 @@ TALER_EXCHANGEDB_get_refresh ( GNUNET_PQ_cleanup_result (rs); return GNUNET_DB_STATUS_HARD_ERROR; } - refresh->is_v27_refresh = false; refresh->transfer_pubs = transfer_pubs; } /* A blinding seed may be present without any CS denomination diff --git a/src/exchangedb/test_coin_history.c b/src/exchangedb/test_coin_history.c @@ -513,7 +513,6 @@ check_other_spends (struct TALER_EXCHANGEDB_PostgresContext *pg) TDB_blinded_denom_sig (43 + i, &rf.denom_sigs[i]); rf.noreveal_index = 1; - rf.is_v27_refresh = true; rf.rc_version = TALER_REFRESH_COMMITMENT_VERSION_LEGACY_V27; rf.no_blinding_seed = true; qs = TALER_EXCHANGEDB_do_refresh (pg, diff --git a/src/exchangedb/test_recoup_refresh.c b/src/exchangedb/test_recoup_refresh.c @@ -101,7 +101,6 @@ melt (struct TALER_EXCHANGEDB_PostgresContext *pg, &denom_sig); rf.denom_sigs = &denom_sig; rf.noreveal_index = 0; - rf.is_v27_refresh = true; rf.rc_version = TALER_REFRESH_COMMITMENT_VERSION_LEGACY_V27; rf.no_blinding_seed = true; GNUNET_assert (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == diff --git a/src/exchangedb/test_refresh.c b/src/exchangedb/test_refresh.c @@ -90,7 +90,6 @@ make_refresh (uint32_t seed, &rf->denom_sigs[0]); rf->noreveal_index = 1; /* v27 refresh: the client provides no transfer public keys */ - rf->is_v27_refresh = true; rf->rc_version = TALER_REFRESH_COMMITMENT_VERSION_LEGACY_V27; rf->no_blinding_seed = ! with_seed; if (with_seed) @@ -362,8 +361,6 @@ check_refresh (struct TALER_EXCHANGEDB_PostgresContext *pg) free_refresh (&got); free_refresh (&rf); TDB_coin_free (&coin)); FAILIF_C (got.no_blinding_seed, free_refresh (&got); free_refresh (&rf); TDB_coin_free (&coin)); - FAILIF_C (! got.is_v27_refresh, - free_refresh (&got); free_refresh (&rf); TDB_coin_free (&coin)); FAILIF_C (TALER_REFRESH_COMMITMENT_VERSION_LEGACY_V27 != got.rc_version, free_refresh (&got); free_refresh (&rf); TDB_coin_free (&coin)); free_refresh (&got); @@ -745,7 +742,6 @@ check_rc_version (struct TALER_EXCHANGEDB_PostgresContext *pg) &coin, false, &rf); - rf.is_v27_refresh = false; rf.rc_version = versions[i]; rf.transfer_pubs = GNUNET_new_array (rf.num_coins, struct TALER_TransferPublicKeyP); @@ -770,8 +766,6 @@ check_rc_version (struct TALER_EXCHANGEDB_PostgresContext *pg) free_refresh (&rf); TDB_coin_free (&coin)); FAILIF_C (versions[i] != got.rc_version, free_refresh (&got); free_refresh (&rf); TDB_coin_free (&coin)); - FAILIF_C (got.is_v27_refresh, - free_refresh (&got); free_refresh (&rf); TDB_coin_free (&coin)); FAILIF_C ( (NULL == got.transfer_pubs) || (0 != GNUNET_memcmp (&got.transfer_pubs[0], &rf.transfer_pubs[0])), @@ -903,7 +897,6 @@ check_replication (struct TALER_EXCHANGEDB_PostgresContext *pg) false, &rf); TDB_coin_free (&coin); - rf.is_v27_refresh = false; rf.rc_version = TALER_REFRESH_COMMITMENT_VERSION_CURRENT; rf.transfer_pubs = GNUNET_new_array (rf.num_coins, struct TALER_TransferPublicKeyP); diff --git a/src/include/exchangedb_lib.h b/src/include/exchangedb_lib.h @@ -689,18 +689,11 @@ struct TALER_EXCHANGEDB_Refresh_vDOLDPLUS bool is_revealed; /** - * @since vDOLDPLUS - * Mark if we have a v27 Refresh object. - * That is, the @a refresh_seed refers to the vDOLDPLUS master_refresh_seed - * from the original request, AND the client has provided transfer public keys, - * see below, @a transfer_public_keys - */ - bool is_v27_refresh; - - /** * Version of the refresh commitment @e rc that the client used. - * #TALER_REFRESH_COMMITMENT_VERSION_LEGACY_V27 if and only if - * @e is_v27_refresh is true. + * For #TALER_REFRESH_COMMITMENT_VERSION_LEGACY_V27, the client did + * not provide transfer public keys and @e refresh_seed is the v27 + * refresh seed; for all later versions, @e refresh_seed is the + * vDOLDPLUS master refresh seed and @e transfer_pubs is set. */ enum TALER_RefreshCommitmentVersion rc_version; @@ -742,7 +735,8 @@ struct TALER_EXCHANGEDB_Refresh_vDOLDPLUS struct TALER_BlindedDenominationSignature *denom_sigs; /** - * If @a is_v27_refresh is false, the client performed a vDOLDPLUS refresh, + * If @a rc_version is not #TALER_REFRESH_COMMITMENT_VERSION_LEGACY_V27, + * the client performed a vDOLDPLUS refresh, * and has provided @a num_coins * kappa transfer public keys. * This is the chosen (at index @a noreveal_index) array of @a num_coins transfer public keys. */