commit 09619ce12ab88c6e024f2d56951afb8005b76845
parent 5531fb6d4a63ec99c5ba585843f95ae881e79c9c
Author: Christian Grothoff <grothoff@gnunet.org>
Date: Mon, 11 Aug 2025 15:04:47 +0200
add FIXMEs
Diffstat:
1 file changed, 47 insertions(+), 23 deletions(-)
diff --git a/src/backend/taler-merchant-httpd_post-orders-ID-pay.c b/src/backend/taler-merchant-httpd_post-orders-ID-pay.c
@@ -1920,7 +1920,8 @@ signatures_to_json (size_t num_sig,
i);
return false;
}
- if (0 != json_array_append_new (j_signatures, sig_obj))
+ if (0 != json_array_append_new (j_signatures,
+ sig_obj))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to append blinded signature #%zu to JSON array",
@@ -2004,6 +2005,7 @@ phase_final_output_token_processing (struct PayContext *pc)
if (pc->donau_receipt.num_sigs > 1)
{
+ // FIXME: completely wrong use of grow ahead.
GNUNET_array_grow (pc->validate_tokens.output_tokens,
pc->validate_tokens.output_tokens_len,
ot_len_with_donau_sig);
@@ -3550,38 +3552,60 @@ phase_validate_tokens (struct PayContext *pc)
= &selected->inputs[i];
const struct TALER_MERCHANT_ContractTokenFamily *family;
- if (input->type != TALER_MERCHANT_CONTRACT_INPUT_TYPE_TOKEN)
+ switch (input->type)
{
- /* only validate inputs of type token (for now) */
- continue;
- }
-
- family = find_family (pc,
- input->details.token.token_family_slug);
- if (NULL == family)
- {
- /* this should never happen, since the choices and
- token families are validated on insert. */
+ case TALER_MERCHANT_CONTRACT_INPUT_TYPE_INVALID:
GNUNET_break (0);
pay_end (pc,
TALER_MHD_reply_with_error (
pc->connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE,
- "token family not found in order"));
+ MHD_HTTP_BAD_REQUEST,
+ TALER_EC_GENERIC_PARAMETER_MALFORMED,
+ "input token type not valid"));
return;
- }
- if (GNUNET_NO ==
- find_valid_input_tokens (pc,
- family,
- i,
- input->details.token.count))
- {
- /* Error is already scheduled from find_valid_input_token. */
+#if FUTURE
+ case TALER_MERCHANT_CONTRACT_INPUT_TYPE_COIN:
+ GNUNET_break (0);
+ pay_end (pc,
+ TALER_MHD_reply_with_error (
+ pc->connection,
+ MHD_HTTP_NOT_IMPLEMENTED,
+ /* FIXME: fix EC here... */
+ TALER_EC_GENERIC_PARAMETER_MALFORMED,
+ "token type not yet supported"));
return;
+#endif
+ case TALER_MERCHANT_CONTRACT_INPUT_TYPE_TOKEN:
+ family = find_family (pc,
+ input->details.token.token_family_slug);
+ if (NULL == family)
+ {
+ /* this should never happen, since the choices and
+ token families are validated on insert. */
+ GNUNET_break (0);
+ pay_end (pc,
+ TALER_MHD_reply_with_error (
+ pc->connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE,
+ "token family not found in order"));
+ return;
+ }
+ if (GNUNET_NO ==
+ find_valid_input_tokens (pc,
+ family,
+ i,
+ input->details.token.count))
+ {
+ /* Error is already scheduled from find_valid_input_token. */
+ return;
+ }
}
}
+ // FIXME: this is wrong, as it doesn't consider
+ // that some outputs in the outputs_len array
+ // have a count > 1!
GNUNET_array_grow (pc->validate_tokens.output_tokens,
pc->validate_tokens.output_tokens_len,
selected->outputs_len);