summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-06-12 11:57:10 +0200
committerChristian Grothoff <christian@grothoff.org>2015-06-12 11:57:10 +0200
commitcf8d6711e8e8557f32129ce60ff897c035b63769 (patch)
tree566b9c76e3a890011c4d918a9bafb536642e308a /src
parentc80435c815e902f6df8826b99809b24abeef95d3 (diff)
downloadexchange-cf8d6711e8e8557f32129ce60ff897c035b63769.tar.gz
exchange-cf8d6711e8e8557f32129ce60ff897c035b63769.tar.bz2
exchange-cf8d6711e8e8557f32129ce60ff897c035b63769.zip
implementing #3819
Diffstat (limited to 'src')
-rw-r--r--src/mintdb/plugin_mintdb_postgres.c31
-rw-r--r--src/mintdb/test_mintdb.c6
2 files changed, 23 insertions, 14 deletions
diff --git a/src/mintdb/plugin_mintdb_postgres.c b/src/mintdb/plugin_mintdb_postgres.c
index 311c2d100..00c515e1f 100644
--- a/src/mintdb/plugin_mintdb_postgres.c
+++ b/src/mintdb/plugin_mintdb_postgres.c
@@ -797,13 +797,13 @@ postgres_prepare (PGconn *db_conn)
during /deposit processing. Used in #postgres_have_deposit(). */
PREPARE ("get_deposit",
"SELECT"
- " amount_with_fee_val" /* Note: not actually used (yet), #3819 */
- ",amount_with_fee_frac" /* Note: not actually used (yet), #3819 */
- ",amount_with_fee_curr" /* Note: not actually used (yet), #3819 */
- ",timestamp" /* Note: not actually used (yet), #3819 */
- ",refund_deadline" /* Note: not actually used (yet), #3819 */
- ",h_contract" /* Note: not actually used (yet), #3819 */
- ",h_wire" /* Note: not actually used (yet), #3819 */
+ " amount_with_fee_val"
+ ",amount_with_fee_frac"
+ ",amount_with_fee_curr"
+ ",timestamp"
+ ",refund_deadline"
+ ",h_contract"
+ ",h_wire"
" FROM deposits"
" WHERE ("
" (coin_pub=$1) AND"
@@ -1791,7 +1791,7 @@ postgres_have_deposit (void *cls,
/* Now we check that the other information in @a deposit
also matches, and if not report inconsistencies. */
{
- struct TALER_MINTDB_Deposit deposit2 = *deposit;
+ struct TALER_MINTDB_Deposit deposit2;
struct TALER_PQ_ResultSpec rs[] = {
TALER_PQ_result_spec_amount ("amount_with_fee",
&deposit2.amount_with_fee),
@@ -1812,9 +1812,18 @@ postgres_have_deposit (void *cls,
PQclear (result);
return GNUNET_SYSERR;
}
- if (0 != memcmp (&deposit2,
- deposit,
- sizeof (struct TALER_MINTDB_Deposit)))
+ if ( (0 != TALER_amount_cmp (&deposit->amount_with_fee,
+ &deposit2.amount_with_fee)) ||
+ (deposit->timestamp.abs_value_us !=
+ deposit2.timestamp.abs_value_us) ||
+ (deposit->refund_deadline.abs_value_us !=
+ deposit2.refund_deadline.abs_value_us) ||
+ (0 != memcmp (&deposit->h_contract,
+ &deposit2.h_contract,
+ sizeof (struct GNUNET_HashCode))) ||
+ (0 != memcmp (&deposit->h_wire,
+ &deposit2.h_wire,
+ sizeof (struct GNUNET_HashCode))) )
{
/* Inconsistencies detected! Bug in merchant! (We might want to
expand the API with a 'get_deposit' function to return the
diff --git a/src/mintdb/test_mintdb.c b/src/mintdb/test_mintdb.c
index a6add0286..ad632ee3f 100644
--- a/src/mintdb/test_mintdb.c
+++ b/src/mintdb/test_mintdb.c
@@ -239,9 +239,9 @@ run (void *cls,
goto drop;
}
RND_BLK (&reserve_pub);
- amount.value = 1;
- amount.fraction = 1;
- strcpy (amount.currency, CURRENCY);
+ GNUNET_assert (GNUNET_OK ==
+ TALER_string_to_amount (CURRENCY ":1.000001",
+ &amount));
result = 4;
just = json_loads ("{ \"justification\":\"1\" }", 0, NULL);
FAILIF (GNUNET_OK !=