From 28a10c22a6a3d3883ad04cef5504905b3381c06f Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 23 Jun 2015 19:47:13 +0200 Subject: [PATCH] fix remaining open issues to resolve #3772/3773 --- src/mint-lib/mint_api_withdraw.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/src/mint-lib/mint_api_withdraw.c b/src/mint-lib/mint_api_withdraw.c index fdcd5a391..b877cf4d3 100644 --- a/src/mint-lib/mint_api_withdraw.c +++ b/src/mint-lib/mint_api_withdraw.c @@ -120,6 +120,8 @@ parse_reserve_history (json_t *history, unsigned int history_length, struct TALER_MINT_ReserveHistory *rhistory) { + struct GNUNET_HashCode uuid[history_length]; + unsigned int uuid_off; struct TALER_Amount total_in; struct TALER_Amount total_out; size_t off; @@ -128,6 +130,7 @@ parse_reserve_history (json_t *history, &total_in); TALER_amount_get_zero (currency, &total_out); + uuid_off = 0; for (off=0;offeddsa_pub), MAJ_spec_end }; + unsigned int i; rhistory[off].type = TALER_MINT_RTT_WITHDRAWAL; if (GNUNET_OK != @@ -222,9 +226,27 @@ parse_reserve_history (json_t *history, } rhistory[off].details.out_authorization_sig = json_object_get (transaction, "signature"); + /* Check check that the same withdraw transaction + isn't listed twice by the mint. We use the + "uuid" array to remember the hashes of all + purposes, and compare the hashes to find + duplicates. */ + GNUNET_CRYPTO_hash (withdraw_purpose, + ntohl (withdraw_purpose->purpose.size), + &uuid[uuid_off]); + for (i=0;i