From 51e0612f8ba656248c4902edd601965fb36cbc49 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 17 Aug 2015 23:38:00 +0200 Subject: [PATCH] some DB logic fixes, so now more of tests pass --- src/mint-lib/test_mint_api.c | 7 ++----- src/mint/taler-mint-httpd_refresh.c | 3 --- src/mint/taler-mint-httpd_responses.c | 4 ++-- src/mintdb/plugin_mintdb_postgres.c | 10 ++-------- 4 files changed, 6 insertions(+), 18 deletions(-) diff --git a/src/mint-lib/test_mint_api.c b/src/mint-lib/test_mint_api.c index 69a50e036..9681cb9ba 100644 --- a/src/mint-lib/test_mint_api.c +++ b/src/mint-lib/test_mint_api.c @@ -1998,8 +1998,6 @@ run (void *cls, .details.deposit.contract = "{ \"items\"={ \"name\":\"ice cream\", \"value\":3 } }", .details.deposit.transaction_id = 2 }, -#if TEST_REFRESH - /* Test running a failing melt operation (same operation again must fail) */ { .oc = OC_REFRESH_MELT, .label = "refresh-melt-failing", @@ -2011,7 +2009,6 @@ run (void *cls, // (signature differs from coin that was deposited...) /* *************** end of /refresh testing ************** */ -#endif { .oc = OC_END } }; @@ -2030,7 +2027,7 @@ run (void *cls, GNUNET_assert (NULL != mint); shutdown_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply - (GNUNET_TIME_UNIT_SECONDS, 30), + (GNUNET_TIME_UNIT_SECONDS, 150), &do_shutdown, is); } @@ -2075,7 +2072,7 @@ main (int argc, fprintf (stderr, "."); sleep (1); } - while (0 != system ("wget -q -t 1 http://localhost:8081/agpl -o /dev/null -O /dev/null")); + while (0 != system ("wget -q -t 1 -T 1 http://127.0.0.1:8081/agpl -o /dev/null -O /dev/null")); fprintf (stderr, "\n"); result = GNUNET_SYSERR; GNUNET_SCHEDULER_run (&run, NULL); diff --git a/src/mint/taler-mint-httpd_refresh.c b/src/mint/taler-mint-httpd_refresh.c index f5bfb3c8b..b54b2010c 100644 --- a/src/mint/taler-mint-httpd_refresh.c +++ b/src/mint/taler-mint-httpd_refresh.c @@ -250,15 +250,12 @@ verify_coin_public_info (struct MHD_Connection *connection, return TMH_RESPONSE_reply_arg_unknown (connection, "denom_pub"); } - /* FIXME: need to check if denomination key is still - valid for issuing! (#3634) */ TALER_amount_ntoh (&fee_refresh, &dki->issue.properties.fee_refresh); melt_detail->melt_fee = fee_refresh; body.purpose.size = htonl (sizeof (struct TALER_RefreshMeltCoinAffirmationPS)); body.purpose.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_MELT); body.session_hash = *session_hash; - TALER_amount_hton (&body.amount_with_fee, &melt_detail->melt_amount_with_fee); TALER_amount_hton (&body.melt_fee, diff --git a/src/mint/taler-mint-httpd_responses.c b/src/mint/taler-mint-httpd_responses.c index 418bc1751..eb883b631 100644 --- a/src/mint/taler-mint-httpd_responses.c +++ b/src/mint/taler-mint-httpd_responses.c @@ -419,7 +419,7 @@ compile_transaction_history (const struct TALER_MINTDB_TransactionList *tl) /* internal sanity check before we hand out a bogus sig... */ if (GNUNET_OK != - GNUNET_CRYPTO_eddsa_verify (ntohl (dr.purpose.purpose), + GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_WALLET_COIN_DEPOSIT, &dr.purpose, &deposit->csig.eddsa_signature, &deposit->coin.coin_pub.eddsa_pub)) @@ -451,7 +451,7 @@ compile_transaction_history (const struct TALER_MINTDB_TransactionList *tl) /* internal sanity check before we hand out a bogus sig... */ if (GNUNET_OK != - GNUNET_CRYPTO_eddsa_verify (ntohl (ms.purpose.purpose), + GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_WALLET_COIN_MELT, &ms.purpose, &melt->coin_sig.eddsa_signature, &melt->coin.coin_pub.eddsa_pub)) diff --git a/src/mintdb/plugin_mintdb_postgres.c b/src/mintdb/plugin_mintdb_postgres.c index 35213d961..6e26c82e9 100644 --- a/src/mintdb/plugin_mintdb_postgres.c +++ b/src/mintdb/plugin_mintdb_postgres.c @@ -2181,9 +2181,6 @@ postgres_insert_refresh_melt (void *cls, } if (GNUNET_NO == ret) /* if not, insert it */ { - fprintf (stderr, - "Melting coin coin %s\n", - TALER_B2S (&melt->coin.coin_pub)); ret = insert_known_coin (cls, session, &melt->coin); @@ -3026,10 +3023,6 @@ postgres_get_transfer (void *cls, return GNUNET_SYSERR; } nrows = PQntuples (result); - fprintf (stderr, - "linkage for coin %s resulted in %d results\n", - TALER_B2S (coin_pub), - nrows); if (0 == nrows) { /* no matches found */ @@ -3192,7 +3185,7 @@ postgres_get_coin_transactions (void *cls, &melt->coin_sig), TALER_PQ_result_spec_amount ("amount_with_fee", &melt->amount_with_fee), - TALER_PQ_result_spec_amount ("amount_with_fee", + TALER_PQ_result_spec_amount ("melt_fee", &melt->melt_fee), TALER_PQ_result_spec_end }; @@ -3204,6 +3197,7 @@ postgres_get_coin_transactions (void *cls, PQclear (result); goto cleanup; } + melt->coin.coin_pub = *coin_pub; } tl = GNUNET_new (struct TALER_MINTDB_TransactionList); tl->next = head;