From 8dfb3b87b47ca2d25f6bdcbdfa2acc517fbe6ae2 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sat, 21 May 2016 19:22:03 +0200 Subject: testing refund, fixing bugs, refund test passes --- src/exchangedb/plugin_exchangedb_postgres.c | 43 ++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 4 deletions(-) (limited to 'src/exchangedb') diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c index f53b23104..e2b158c90 100644 --- a/src/exchangedb/plugin_exchangedb_postgres.c +++ b/src/exchangedb/plugin_exchangedb_postgres.c @@ -2260,13 +2260,18 @@ postgres_test_deposit_done (void *cls, PQclear (result); return GNUNET_SYSERR; } + if (1 != PQntuples (result)) + { + GNUNET_break (0); + PQclear (result); + return GNUNET_SYSERR; + } { - /* NOTE: maybe wrong type for a 'boolean' */ - uint32_t done = 0; + uint8_t done = 0; struct GNUNET_PQ_ResultSpec rs[] = { - GNUNET_PQ_result_spec_uint32 ("done", - &done), + GNUNET_PQ_result_spec_auto_from_type ("done", + &done), GNUNET_PQ_result_spec_end }; if (GNUNET_OK != @@ -3703,6 +3708,16 @@ postgres_get_coin_transactions (void *cls, tl->next = head; tl->type = TALER_EXCHANGEDB_TT_DEPOSIT; tl->details.deposit = deposit; + if (GNUNET_SYSERR == get_known_coin (cls, + session, + &deposit->coin.coin_pub, + &deposit->coin)) + { + GNUNET_break (0); + GNUNET_free (deposit); + PQclear (result); + goto cleanup; + } head = tl; continue; } @@ -3762,6 +3777,16 @@ postgres_get_coin_transactions (void *cls, tl->next = head; tl->type = TALER_EXCHANGEDB_TT_REFRESH_MELT; tl->details.melt = melt; + if (GNUNET_SYSERR == get_known_coin (cls, + session, + coin_pub, + &melt->coin)) + { + GNUNET_break (0); + GNUNET_free (melt); + PQclear (result); + goto cleanup; + } head = tl; continue; } @@ -3826,6 +3851,16 @@ postgres_get_coin_transactions (void *cls, tl->next = head; tl->type = TALER_EXCHANGEDB_TT_REFUND; tl->details.refund = refund; + if (GNUNET_SYSERR == get_known_coin (cls, + session, + coin_pub, + &refund->coin)) + { + GNUNET_break (0); + GNUNET_free (refund); + PQclear (result); + goto cleanup; + } head = tl; continue; } -- cgit v1.2.3