implement postges_get_old_coin_by_h_blind for #5777
This commit is contained in:
parent
334498a298
commit
7d43ad56d3
@ -247,13 +247,10 @@ payback_transaction (void *cls,
|
||||
reserve / account the money should go */
|
||||
if (pc->refreshed)
|
||||
{
|
||||
GNUNET_assert (0); // FIXME #5777: not implemented in DB!
|
||||
#if 0
|
||||
qs = TEH_plugin->get_old_coin_by_h_blind (TEH_plugin->cls,
|
||||
session,
|
||||
&pc->h_blind,
|
||||
&pc->target.old_coin_pub);
|
||||
#endif
|
||||
if (0 > qs)
|
||||
{
|
||||
if (GNUNET_DB_STATUS_HARD_ERROR == qs)
|
||||
|
@ -1761,6 +1761,17 @@ postgres_prepare (PGconn *db_conn)
|
||||
" LIMIT 1"
|
||||
" FOR UPDATE;",
|
||||
1),
|
||||
/* Used in #postgres_get_old_coin_by_h_blind() */
|
||||
GNUNET_PQ_make_prepare ("old_coin_by_h_blind",
|
||||
"SELECT"
|
||||
" rcom.old_coin_pub"
|
||||
" FROM refresh_revealed_coins"
|
||||
" JOIN refresh_commitments rcom"
|
||||
" USING (rc)"
|
||||
" WHERE coin_ev=$1"
|
||||
" LIMIT 1"
|
||||
" FOR UPDATE;",
|
||||
1),
|
||||
/* used in #postgres_commit */
|
||||
GNUNET_PQ_make_prepare ("do_commit",
|
||||
"COMMIT",
|
||||
@ -7162,6 +7173,39 @@ postgres_get_reserve_by_h_blind (void *cls,
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Obtain information about which old coin a coin was refreshed
|
||||
* given the hash of the blinded (fresh) coin.
|
||||
*
|
||||
* @param cls closure
|
||||
* @param session a session
|
||||
* @param h_blind_ev hash of the blinded coin
|
||||
* @param[out] reserve_pub set to information about the reserve (on success only)
|
||||
* @return transaction status code
|
||||
*/
|
||||
static enum GNUNET_DB_QueryStatus
|
||||
postgres_get_old_coin_by_h_blind (void *cls,
|
||||
struct TALER_EXCHANGEDB_Session *session,
|
||||
const struct GNUNET_HashCode *h_blind_ev,
|
||||
struct TALER_CoinSpendPublicKeyP *old_coin_pub)
|
||||
{
|
||||
struct GNUNET_PQ_QueryParam params[] = {
|
||||
GNUNET_PQ_query_param_auto_from_type (h_blind_ev),
|
||||
GNUNET_PQ_query_param_end
|
||||
};
|
||||
struct GNUNET_PQ_ResultSpec rs[] = {
|
||||
GNUNET_PQ_result_spec_auto_from_type ("old_coin_pub",
|
||||
old_coin_pub),
|
||||
GNUNET_PQ_result_spec_end
|
||||
};
|
||||
|
||||
return GNUNET_PQ_eval_prepared_singleton_select (session->conn,
|
||||
"old_coin_by_h_blind",
|
||||
params,
|
||||
rs);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Store information that a denomination key was revoked
|
||||
* in the database.
|
||||
@ -7764,6 +7808,8 @@ libtaler_plugin_exchangedb_postgres_init (void *cls)
|
||||
= &postgres_insert_payback_refresh_request;
|
||||
plugin->get_reserve_by_h_blind
|
||||
= &postgres_get_reserve_by_h_blind;
|
||||
plugin->get_old_coin_by_h_blind
|
||||
= &postgres_get_old_coin_by_h_blind;
|
||||
plugin->insert_denomination_revocation
|
||||
= &postgres_insert_denomination_revocation;
|
||||
plugin->get_denomination_revocation
|
||||
|
@ -2429,6 +2429,23 @@ struct TALER_EXCHANGEDB_Plugin
|
||||
struct TALER_ReservePublicKeyP *reserve_pub);
|
||||
|
||||
|
||||
/**
|
||||
* Obtain information about which old coin a coin was refreshed
|
||||
* given the hash of the blinded (fresh) coin.
|
||||
*
|
||||
* @param cls closure
|
||||
* @param session a session
|
||||
* @param h_blind_ev hash of the blinded coin
|
||||
* @param[out] old_coin_pub set to information about the old coin (on success only)
|
||||
* @return transaction status code
|
||||
*/
|
||||
enum GNUNET_DB_QueryStatus
|
||||
(*get_old_coin_by_h_blind)(void *cls,
|
||||
struct TALER_EXCHANGEDB_Session *session,
|
||||
const struct GNUNET_HashCode *h_blind_ev,
|
||||
struct TALER_CoinSpendPublicKeyP *old_coin_pub);
|
||||
|
||||
|
||||
/**
|
||||
* Store information that a denomination key was revoked
|
||||
* in the database.
|
||||
|
Loading…
Reference in New Issue
Block a user