summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-06-05 15:48:00 +0200
committerChristian Grothoff <christian@grothoff.org>2015-06-05 15:48:00 +0200
commit55568e682bc4a4634c30cf2d6895f79d211b2fe9 (patch)
tree5f5a28f6e32d39a94bc8ac297dfa3400c0bfb5f9
parent56ca616eb3611dcfb4876281d65c462593aa4dc9 (diff)
downloadexchange-55568e682bc4a4634c30cf2d6895f79d211b2fe9.tar.gz
exchange-55568e682bc4a4634c30cf2d6895f79d211b2fe9.tar.bz2
exchange-55568e682bc4a4634c30cf2d6895f79d211b2fe9.zip
notes about 3828/3812
-rw-r--r--src/include/taler_mintdb_plugin.h5
-rw-r--r--src/mintdb/plugin_mintdb_postgres.c38
2 files changed, 29 insertions, 14 deletions
diff --git a/src/include/taler_mintdb_plugin.h b/src/include/taler_mintdb_plugin.h
index 71cc81a58..f6fa27dbb 100644
--- a/src/include/taler_mintdb_plugin.h
+++ b/src/include/taler_mintdb_plugin.h
@@ -340,6 +340,11 @@ struct TALER_MINTDB_RefreshMelt
struct TALER_Amount amount_with_fee;
/** FIXME: This can be retrieved from the Denomination? Do we need this?
+ * (Yes, it can be derived from coin's denomination, but the extra
+ * lookup/indirection also costs and is inconvenient. And when
+ * checking signatures and balances, do we really always want this
+ * extra step of going to the denominations? (#3828)
+ *
* Melting fee charged by the mint. This must match the Mint's
* denomination key's melting fee. If the client puts in an invalid
* melting fee (too high or too low) that does not match the Mint's
diff --git a/src/mintdb/plugin_mintdb_postgres.c b/src/mintdb/plugin_mintdb_postgres.c
index ed4583953..710241d7a 100644
--- a/src/mintdb/plugin_mintdb_postgres.c
+++ b/src/mintdb/plugin_mintdb_postgres.c
@@ -1910,6 +1910,7 @@ postgres_insert_refresh_melt (void *cls,
TALER_PQ_query_param_auto_from_type (&oldcoin_index_nbo),
TALER_PQ_query_param_auto_from_type (&melt->coin_sig),
TALER_PQ_query_param_amount (&melt->amount_with_fee),
+ /* FIXME: melt_fee not stored, #3828 */
TALER_PQ_query_param_end
};
int ret;
@@ -1920,17 +1921,23 @@ postgres_insert_refresh_melt (void *cls,
&melt->coin.coin_pub,
NULL);
if (GNUNET_SYSERR == ret)
+ {
+ GNUNET_break (0);
return GNUNET_SYSERR;
+ }
if (GNUNET_NO == ret) /* if not, insert it */
{
ret = postgres_insert_known_coin (cls,
session,
&melt->coin);
if (ret == GNUNET_SYSERR)
+ {
+ GNUNET_break (0);
return GNUNET_SYSERR;
+ }
}
/* insert the melt */
- oldcoin_index_nbo = htons (oldcoin_index);
+ oldcoin_index_nbo = htons (oldcoin_index); /* 3827 */
result = TALER_PQ_exec_prepared (session->conn,
"insert_refresh_melt",
params);
@@ -1985,7 +1992,7 @@ postgres_get_refresh_melt (void *cls,
PQclear (result);
return GNUNET_SYSERR;
}
- nrows = PQntuples (result);
+ nrows = PQntuples (result);
if (0 == nrows)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -1994,18 +2001,22 @@ postgres_get_refresh_melt (void *cls,
return GNUNET_NO;
}
GNUNET_assert (1 == nrows); /* due to primary key constraint */
- struct TALER_PQ_ResultSpec rs[] = {
- TALER_PQ_result_spec_auto_from_type ("coin_pub", &coin.coin_pub),
- TALER_PQ_result_spec_auto_from_type ("coin_sig", &coin_sig),
- TALER_PQ_result_spec_amount ("amount_with_fee", &amount_with_fee),
- TALER_PQ_result_spec_end
- };
- if (GNUNET_OK != TALER_PQ_extract_result (result, rs, 0))
{
+ struct TALER_PQ_ResultSpec rs[] = {
+ TALER_PQ_result_spec_auto_from_type ("coin_pub", &coin.coin_pub),
+ TALER_PQ_result_spec_auto_from_type ("coin_sig", &coin_sig),
+ TALER_PQ_result_spec_amount ("amount_with_fee", &amount_with_fee),
+ /* 'melt_fee' not initialized (#3828) */
+ TALER_PQ_result_spec_end
+ };
+ if (GNUNET_OK != TALER_PQ_extract_result (result, rs, 0))
+ {
+ GNUNET_break (0);
+ PQclear (result);
+ return GNUNET_SYSERR;
+ }
PQclear (result);
- return GNUNET_SYSERR;
}
- PQclear (result);
/* fetch the coin info and denomination info */
if (GNUNET_OK != postgres_get_known_coin (cls,
session,
@@ -2016,10 +2027,9 @@ postgres_get_refresh_melt (void *cls,
return GNUNET_OK;
melt->coin = coin;
melt->coin_sig = coin_sig;
- if (session_hash != &melt->session_hash)
- melt->session_hash = *session_hash;
+ melt->session_hash = *session_hash;
melt->amount_with_fee = amount_with_fee;
- /* FIXME: melt->melt_fee = ??, #3812 */
+ /* FIXME: melt->melt_fee = ??, #3812 / #3828 */
return GNUNET_OK;
}