commit e98d18e5469c5092a9f56abcaf5496c6fe1ee99d
parent 007dd603be64e30476da168b624739bef923e2e0
Author: Florian Dold <dold@taler.net>
Date: Tue, 17 Nov 2026 20:37:05 +0100
testing: check melt responses against the negotiated exchange version
Diffstat:
3 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/src/lib/test_melt.c b/src/lib/test_melt.c
@@ -21,6 +21,7 @@
#include "taler/taler_json_lib.h"
#include "taler/exchange/get-coins-COIN_PUB-history.h"
#include "taler/exchange/get-keys.h"
+#include "taler/exchange/post-melt.h"
static void
@@ -110,6 +111,13 @@ check_history_arrays (void)
int
main (void)
{
+ struct TALER_EXCHANGE_Keys keys = { .version = "44:0:0" };
+
+ GNUNET_assert (TALER_REFRESH_COMMITMENT_VERSION_LEGACY_VDOLDPLUS_BROKEN ==
+ TALER_EXCHANGE_refresh_commitment_version (&keys));
+ keys.version = "45:0:0";
+ GNUNET_assert (TALER_REFRESH_COMMITMENT_VERSION_CURRENT ==
+ TALER_EXCHANGE_refresh_commitment_version (&keys));
check_history_arrays ();
return 0;
}
diff --git a/src/testing/testing_api_cmd_coin_history.c b/src/testing/testing_api_cmd_coin_history.c
@@ -157,8 +157,8 @@ history_entry_cmp (
return 1;
/* presence of noreveal_index and transfer_pubs is checked,
and transfer_pubs are verified, in check_melt_entries() */
- if (h1->details.melt.noreveal_index !=
- h2->details.melt.noreveal_index)
+ if ( (! h2->details.melt.no_noreveal_index) &&
+ (h1->details.melt.noreveal_index != h2->details.melt.noreveal_index) )
return 1;
/* Note: most other fields are not initialized
in the trait as they are hard to extract from
@@ -364,6 +364,10 @@ check_melt_entries (
unsigned int hlen,
const struct TALER_EXCHANGE_CoinHistoryEntry rhist[static hlen])
{
+ const struct TALER_EXCHANGE_Keys *keys = TALER_TESTING_get_keys (ss->is);
+ unsigned int protocol;
+
+ GNUNET_assert (1 == sscanf (keys->version, "%u", &protocol));
for (unsigned int i = 0; i < hlen; i++)
{
const struct TALER_EXCHANGE_CoinHistoryEntry *rh = &rhist[i];
@@ -371,6 +375,10 @@ check_melt_entries (
if (TALER_EXCHANGE_CTT_MELT != rh->type)
continue;
+ if ( (protocol < 46) &&
+ rh->details.melt.no_noreveal_index &&
+ (NULL == rh->details.melt.transfer_pubs) )
+ continue;
if ( (rh->details.melt.no_noreveal_index) ||
(NULL == rh->details.melt.transfer_pubs) ||
(0 == n) )
diff --git a/src/testing/testing_api_cmd_refresh.c b/src/testing/testing_api_cmd_refresh.c
@@ -776,10 +776,7 @@ melt_cb (struct MeltState *ms,
ms->che.details.melt.rc = ms->rc;
ms->che.details.melt.noreveal_index = ms->noreveal_index;
ms->rc_version = mr->details.ok.rc_version;
- if (ms->rc_version !=
- (ms->legacy_commitment
- ? TALER_REFRESH_COMMITMENT_VERSION_LEGACY_VDOLDPLUS_BROKEN
- : TALER_REFRESH_COMMITMENT_VERSION_CURRENT))
+ if (ms->rc_version != ms->melt_input.rc_version)
{
GNUNET_break (0);
TALER_TESTING_interpreter_fail (ms->is);