commit a456a67060231b368ee58329bdbb19cb3b6564be
parent 64e9b0cb6bc3e66dffbcba99d9a97ddb530d48e8
Author: Matyja Lukas Adam <lukas.matyja@students.bfh.ch>
Date: Thu, 16 May 2024 01:52:21 +0200
[testing] working cs issue receipts test
Diffstat:
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/src/testing/testing_api_cmd_issue_receipts.c b/src/testing/testing_api_cmd_issue_receipts.c
@@ -137,9 +137,9 @@ struct CSR_Data
struct StatusState *ss;
/**
- * array position in batch issue receipt request (first position is zero)
+ * array position in batch issue receipt request (first position is one)
*/
- size_t position;
+ unsigned int position;
};
@@ -225,7 +225,11 @@ cs_stage_two_callback (
const struct DONAU_CsRBatchIssueResponse *csrresp)
{
struct CSR_Data *csr_data = cls;
- csr_data->csr_handle = NULL;
+ /* ignore multiple callbacks from the same csr request by checking
+ if the corresponding blinded message is already initialized */
+ if (NULL != &csr_data->ss->bkps[csr_data->position].blinded_udi.blinded_message->cipher) {
+ return;
+ }
if (csrresp->hr.http_status != MHD_HTTP_CREATED)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -242,7 +246,7 @@ cs_stage_two_callback (
struct DONAU_DonationUnitPublicKey *cs_pk =
&csr_data->ss->keys->donation_unit_keys[csr_data->position].key;
- struct DONAU_BatchIssueValues *alg_values = {0};
+ struct DONAU_BatchIssueValues *alg_values = GNUNET_new (struct DONAU_BatchIssueValues);
struct DONAU_BudiMasterSecretP ps;
struct DONAU_BlindedUniqueDonorIdentifier *blinded_udi =
&csr_data->ss->bkps[csr_data->position].blinded_udi;
@@ -254,6 +258,8 @@ cs_stage_two_callback (
GNUNET_assert (GNUNET_CRYPTO_BSA_CS == cs_pk->bsign_pub_key->cipher);
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "position value: %d\n", csr_data->position);
DONAU_donation_unit_ewv_copy (alg_values,
&csrresp->details.ok.
alg_values);
@@ -277,7 +283,7 @@ cs_stage_two_callback (
csr_data->ss->cs_pending--;
if (0 == csr_data->ss->cs_pending)
phase_two (csr_data->ss);
- GNUNET_free (csr_data);
+ //GNUNET_free (csr_data);
}
@@ -347,7 +353,7 @@ status_run (void *cls,
ss->receipts =
GNUNET_new_array (ss->num_bkp, struct DONAU_DonationReceipt);
ss->alg_values =
- GNUNET_new_array (ss->num_bkp, const struct DONAU_BatchIssueValues*);
+ GNUNET_new_array (ss->num_bkp, const struct DONAU_BatchIssueValues *);
ss->h_udis =
GNUNET_new_array (ss->num_bkp, struct DONAU_UniqueDonorIdentifierHashP);
for (size_t cnt = 0; cnt < ss->num_bkp; cnt++)