summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/include/taler_mintdb_plugin.h111
-rw-r--r--src/mint/taler-mint-httpd_db.c83
-rw-r--r--src/mint/taler-mint-httpd_db.h8
-rw-r--r--src/mint/taler-mint-httpd_deposit.c4
-rw-r--r--src/mint/taler-mint-httpd_refresh.c22
-rw-r--r--src/mint/taler-mint-httpd_responses.c48
-rw-r--r--src/mint/taler-mint-httpd_responses.h16
-rw-r--r--src/mintdb/plugin_mintdb_common.c26
-rw-r--r--src/mintdb/plugin_mintdb_postgres.c70
-rw-r--r--src/mintdb/test_mintdb.c24
-rw-r--r--src/mintdb/test_mintdb_deposits.c6
11 files changed, 214 insertions, 204 deletions
diff --git a/src/include/taler_mintdb_plugin.h b/src/include/taler_mintdb_plugin.h
index e6f87c4aa..956487b2f 100644
--- a/src/include/taler_mintdb_plugin.h
+++ b/src/include/taler_mintdb_plugin.h
@@ -29,7 +29,7 @@
/**
* Information we keep on bank transfer(s) that established a reserve.
*/
-struct BankTransfer
+struct TALER_MINTDB_BankTransfer
{
/**
@@ -53,7 +53,7 @@ struct BankTransfer
/**
* A summary of a Reserve
*/
-struct Reserve
+struct TALER_MINTDB_Reserve
{
/**
* The reserve's public key. This uniquely identifies the reserve
@@ -77,7 +77,7 @@ struct Reserve
* the /withdraw operation if needed, and to have proof
* that a reserve was drained by this amount.
*/
-struct CollectableBlindcoin
+struct TALER_MINTDB_CollectableBlindcoin
{
/**
@@ -116,17 +116,17 @@ struct CollectableBlindcoin
/**
* Types of operations on a reserved.
*/
-enum TALER_MINT_DB_ReserveOperation
+enum TALER_MINTDB_ReserveOperation
{
/**
* Money was deposited into the reserve via a bank transfer.
*/
- TALER_MINT_DB_RO_BANK_TO_MINT = 0,
+ TALER_MINTDB_RO_BANK_TO_MINT = 0,
/**
* A Coin was withdrawn from the reserve using /withdraw.
*/
- TALER_MINT_DB_RO_WITHDRAW_COIN = 1
+ TALER_MINTDB_RO_WITHDRAW_COIN = 1
};
@@ -136,18 +136,18 @@ enum TALER_MINT_DB_ReserveOperation
* established the reserve and all /withdraw operations we have done
* since).
*/
-struct ReserveHistory
+struct TALER_MINTDB_ReserveHistory
{
/**
* Next entry in the reserve history.
*/
- struct ReserveHistory *next;
+ struct TALER_MINTDB_ReserveHistory *next;
/**
* Type of the event, determins @e details.
*/
- enum TALER_MINT_DB_ReserveOperation type;
+ enum TALER_MINTDB_ReserveOperation type;
/**
* Details of the operation, depending on @e type.
@@ -158,12 +158,12 @@ struct ReserveHistory
/**
* Details about a bank transfer to the mint.
*/
- struct BankTransfer *bank;
+ struct TALER_MINTDB_BankTransfer *bank;
/**
* Details about a /withdraw operation.
*/
- struct CollectableBlindcoin *withdraw;
+ struct TALER_MINTDB_CollectableBlindcoin *withdraw;
} details;
@@ -173,7 +173,7 @@ struct ReserveHistory
/**
* Specification for a /deposit operation.
*/
-struct Deposit
+struct TALER_MINTDB_Deposit
{
/**
* Information about the coin that is being deposited.
@@ -225,6 +225,11 @@ struct Deposit
*/
struct TALER_Amount amount_with_fee;
+ /**
+ * Depositing fee.
+ */
+ struct TALER_Amount deposit_fee;
+
};
@@ -233,7 +238,7 @@ struct Deposit
* dimensions of the operation, security parameters and
* client signatures from "/refresh/melt" and "/refresh/commit".
*/
-struct RefreshSession
+struct TALER_MINTDB_RefreshSession
{
/**
@@ -258,7 +263,7 @@ struct RefreshSession
/**
* Specification for coin in a /refresh/melt operation.
*/
-struct RefreshMelt
+struct TALER_MINTDB_RefreshMelt
{
/**
* Information about the coin that is being melted.
@@ -289,12 +294,12 @@ struct RefreshMelt
/**
- * We have as many `struct RefreshCommitCoin` as there are new
+ * We have as many `struct TALER_MINTDB_RefreshCommitCoin` as there are new
* coins being created by the refresh (for each of the #TALER_CNC_KAPPA
* sets). These are the coins we ask the mint to sign if the
* respective set is selected.
*/
-struct RefreshCommitCoin
+struct TALER_MINTDB_RefreshCommitCoin
{
/**
@@ -322,9 +327,9 @@ GNUNET_NETWORK_STRUCT_BEGIN
* For each (old) coin being melted, we have a `struct
* RefreshCommitLink` that allows the user to find the shared secret
* to decrypt the respective refresh links for the new coins in the
- * `struct RefreshCommitCoin`.
+ * `struct TALER_MINTDB_RefreshCommitCoin`.
*/
-struct RefreshCommitLink
+struct TALER_MINTDB_RefreshCommitLinkP
{
/**
* Transfer public key, used to decrypt the @e shared_secret_enc
@@ -346,12 +351,12 @@ GNUNET_NETWORK_STRUCT_END
/**
* Linked list of refresh information linked to a coin.
*/
-struct LinkDataList
+struct TALER_MINTDB_LinkDataList
{
/**
* Information is stored in a NULL-terminated linked list.
*/
- struct LinkDataList *next;
+ struct TALER_MINTDB_LinkDataList *next;
/**
* Link data, used to recover the private key of the coin
@@ -374,7 +379,7 @@ struct LinkDataList
/**
* Specification for a /lock operation.
*/
-struct Lock
+struct TALER_MINTDB_LockOperation
{
/**
* Information about the coin that is being locked.
@@ -399,40 +404,40 @@ struct Lock
* Enumeration to classify the different types of transactions
* that can be done with a coin.
*/
-enum TALER_MINT_DB_TransactionType
+enum TALER_MINTDB_TransactionType
{
/**
* /deposit operation.
*/
- TALER_MINT_DB_TT_DEPOSIT = 0,
+ TALER_MINTDB_TT_DEPOSIT = 0,
/**
* /refresh/melt operation.
*/
- TALER_MINT_DB_TT_REFRESH_MELT = 1,
+ TALER_MINTDB_TT_REFRESH_MELT = 1,
/**
* /lock operation.
*/
- TALER_MINT_DB_TT_LOCK = 2
+ TALER_MINTDB_TT_LOCK = 2
};
/**
* List of transactions we performed for a particular coin.
*/
-struct TALER_MINT_DB_TransactionList
+struct TALER_MINTDB_TransactionList
{
/**
* Next pointer in the NULL-terminated linked list.
*/
- struct TALER_MINT_DB_TransactionList *next;
+ struct TALER_MINTDB_TransactionList *next;
/**
* Type of the transaction, determines what is stored in @e details.
*/
- enum TALER_MINT_DB_TransactionType type;
+ enum TALER_MINTDB_TransactionType type;
/**
* Details about the transaction, depending on @e type.
@@ -443,17 +448,17 @@ struct TALER_MINT_DB_TransactionList
/**
* Details if transaction was a /deposit operation.
*/
- struct Deposit *deposit;
+ struct TALER_MINTDB_Deposit *deposit;
/**
* Details if transaction was a /refresh/melt operation.
*/
- struct RefreshMelt *melt;
+ struct TALER_MINTDB_RefreshMelt *melt;
/**
* Details if transaction was a /lock operation.
*/
- struct Lock *lock;
+ struct TALER_MINTDB_LockOperation *lock;
} details;
@@ -569,7 +574,7 @@ struct TALER_MINTDB_Plugin
int
(*reserve_get) (void *cls,
struct TALER_MINTDB_Session *db,
- struct Reserve *reserve);
+ struct TALER_MINTDB_Reserve *reserve);
/* FIXME: add functions to add bank transfers to our DB
(and to test if we already did add one) (#3633/#3717) */
@@ -591,7 +596,7 @@ struct TALER_MINTDB_Plugin
int
(*reserves_in_insert) (void *cls,
struct TALER_MINTDB_Session *db,
- struct Reserve *reserve,
+ struct TALER_MINTDB_Reserve *reserve,
const struct TALER_Amount *balance,
const struct GNUNET_TIME_Absolute expiry);
@@ -613,7 +618,7 @@ struct TALER_MINTDB_Plugin
(*get_collectable_blindcoin) (void *cls,
struct TALER_MINTDB_Session *sesssion,
const struct GNUNET_HashCode *h_blind,
- struct CollectableBlindcoin *collectable);
+ struct TALER_MINTDB_CollectableBlindcoin *collectable);
/**
@@ -636,7 +641,7 @@ struct TALER_MINTDB_Plugin
struct TALER_MINTDB_Session *sesssion,
const struct GNUNET_HashCode *h_blind,
struct TALER_Amount withdraw,
- const struct CollectableBlindcoin *collectable);
+ const struct TALER_MINTDB_CollectableBlindcoin *collectable);
/**
@@ -648,7 +653,7 @@ struct TALER_MINTDB_Plugin
* @param reserve_pub public key of the reserve
* @return known transaction history (NULL if reserve is unknown)
*/
- struct ReserveHistory *
+ struct TALER_MINTDB_ReserveHistory *
(*get_reserve_history) (void *cls,
struct TALER_MINTDB_Session *sesssion,
const struct TALER_ReservePublicKeyP *reserve_pub);
@@ -662,7 +667,7 @@ struct TALER_MINTDB_Plugin
*/
void
(*free_reserve_history) (void *cls,
- struct ReserveHistory *rh);
+ struct TALER_MINTDB_ReserveHistory *rh);
/**
@@ -678,7 +683,7 @@ struct TALER_MINTDB_Plugin
int
(*have_deposit) (void *cls,
struct TALER_MINTDB_Session *sesssion,
- const struct Deposit *deposit);
+ const struct TALER_MINTDB_Deposit *deposit);
/**
@@ -693,7 +698,7 @@ struct TALER_MINTDB_Plugin
int
(*insert_deposit) (void *cls,
struct TALER_MINTDB_Session *sesssion,
- const struct Deposit *deposit);
+ const struct TALER_MINTDB_Deposit *deposit);
/**
@@ -711,7 +716,7 @@ struct TALER_MINTDB_Plugin
(*get_refresh_session) (void *cls,
struct TALER_MINTDB_Session *sesssion,
const struct GNUNET_HashCode *session_hash,
- struct RefreshSession *refresh_session);
+ struct TALER_MINTDB_RefreshSession *refresh_session);
/**
@@ -728,7 +733,7 @@ struct TALER_MINTDB_Plugin
(*create_refresh_session) (void *cls,
struct TALER_MINTDB_Session *sesssion,
const struct GNUNET_HashCode *session_hash,
- const struct RefreshSession *refresh_session);
+ const struct TALER_MINTDB_RefreshSession *refresh_session);
/**
@@ -746,7 +751,7 @@ struct TALER_MINTDB_Plugin
(*insert_refresh_melt) (void *cls,
struct TALER_MINTDB_Session *sesssion,
uint16_t oldcoin_index,
- const struct RefreshMelt *melt);
+ const struct TALER_MINTDB_RefreshMelt *melt);
/**
@@ -765,7 +770,7 @@ struct TALER_MINTDB_Plugin
struct TALER_MINTDB_Session *sesssion,
const struct GNUNET_HashCode *session_hash,
uint16_t oldcoin_index,
- struct RefreshMelt *melt);
+ struct TALER_MINTDB_RefreshMelt *melt);
/**
@@ -827,7 +832,7 @@ struct TALER_MINTDB_Plugin
const struct GNUNET_HashCode *session_hash,
unsigned int i,
unsigned int num_newcoins,
- const struct RefreshCommitCoin *commit_coins);
+ const struct TALER_MINTDB_RefreshCommitCoin *commit_coins);
/**
@@ -850,7 +855,7 @@ struct TALER_MINTDB_Plugin
const struct GNUNET_HashCode *session_hash,
unsigned int i,
unsigned int num_coins,
- struct RefreshCommitCoin *commit_coins);
+ struct TALER_MINTDB_RefreshCommitCoin *commit_coins);
/**
@@ -871,7 +876,7 @@ struct TALER_MINTDB_Plugin
const struct GNUNET_HashCode *session_hash,
unsigned int i,
unsigned int num_links,
- const struct RefreshCommitLink *commit_links);
+ const struct TALER_MINTDB_RefreshCommitLinkP *commit_links);
/**
* Obtain the commited (encrypted) refresh link data
@@ -893,7 +898,7 @@ struct TALER_MINTDB_Plugin
const struct GNUNET_HashCode *session_hash,
unsigned int i,
unsigned int num_links,
- struct RefreshCommitLink *links);
+ struct TALER_MINTDB_RefreshCommitLinkP *links);
/**
@@ -926,7 +931,7 @@ struct TALER_MINTDB_Plugin
* @param coin_pub public key to use to retrieve linkage data
* @return all known link data for the coin
*/
- struct LinkDataList *
+ struct TALER_MINTDB_LinkDataList *
(*get_link_data_list) (void *cls,
struct TALER_MINTDB_Session *sesssion,
const union TALER_CoinSpendPublicKeyP *coin_pub);
@@ -940,7 +945,7 @@ struct TALER_MINTDB_Plugin
*/
void
(*free_link_data_list) (void *cls,
- struct LinkDataList *ldl);
+ struct TALER_MINTDB_LinkDataList *ldl);
/**
@@ -980,7 +985,7 @@ struct TALER_MINTDB_Plugin
int
(*have_lock) (void *cls,
struct TALER_MINTDB_Session *sesssion,
- const struct Lock *lock);
+ const struct TALER_MINTDB_LockOperation *lock);
/**
@@ -995,7 +1000,7 @@ struct TALER_MINTDB_Plugin
int
(*insert_lock) (void *cls,
struct TALER_MINTDB_Session *sesssion,
- const struct Lock *lock);
+ const struct TALER_MINTDB_LockOperation *lock);
/**
@@ -1007,7 +1012,7 @@ struct TALER_MINTDB_Plugin
* @param coin_pub coin to investigate
* @return list of transactions, NULL if coin is fresh
*/
- struct TALER_MINT_DB_TransactionList *
+ struct TALER_MINTDB_TransactionList *
(*get_coin_transactions) (void *cls,
struct TALER_MINTDB_Session *sesssion,
const union TALER_CoinSpendPublicKeyP *coin_pub);
@@ -1021,7 +1026,7 @@ struct TALER_MINTDB_Plugin
*/
void
(*free_coin_transaction_list) (void *cls,
- struct TALER_MINT_DB_TransactionList *list);
+ struct TALER_MINTDB_TransactionList *list);
};
diff --git a/src/mint/taler-mint-httpd_db.c b/src/mint/taler-mint-httpd_db.c
index f1253bd51..6a06d1fe7 100644
--- a/src/mint/taler-mint-httpd_db.c
+++ b/src/mint/taler-mint-httpd_db.c
@@ -40,18 +40,18 @@
* @return #GNUNET_OK on success, #GNUNET_SYSERR on errors
*/
static int
-calculate_transaction_list_totals (struct TALER_MINT_DB_TransactionList *tl,
+calculate_transaction_list_totals (struct TALER_MINTDB_TransactionList *tl,
const struct TALER_Amount *off,
struct TALER_Amount *ret)
{
struct TALER_Amount spent = *off;
- struct TALER_MINT_DB_TransactionList *pos;
+ struct TALER_MINTDB_TransactionList *pos;
for (pos = tl; NULL != pos; pos = pos->next)
{
switch (pos->type)
{
- case TALER_MINT_DB_TT_DEPOSIT:
+ case TALER_MINTDB_TT_DEPOSIT:
if (GNUNET_OK !=
TALER_amount_add (&spent,
&spent,
@@ -61,7 +61,7 @@ calculate_transaction_list_totals (struct TALER_MINT_DB_TransactionList *tl,
return GNUNET_SYSERR;
}
break;
- case TALER_MINT_DB_TT_REFRESH_MELT:
+ case TALER_MINTDB_TT_REFRESH_MELT:
if (GNUNET_OK !=
TALER_amount_add (&spent,
&spent,
@@ -71,7 +71,7 @@ calculate_transaction_list_totals (struct TALER_MINT_DB_TransactionList *tl,
return GNUNET_SYSERR;
}
break;
- case TALER_MINT_DB_TT_LOCK:
+ case TALER_MINTDB_TT_LOCK:
/* should check if lock is still active,
and if it is for THIS operation; if
lock is inactive, delete it; if lock
@@ -99,34 +99,39 @@ calculate_transaction_list_totals (struct TALER_MINT_DB_TransactionList *tl,
*/
int
TMH_DB_execute_deposit (struct MHD_Connection *connection,
- const struct Deposit *deposit)
+ const struct TALER_MINTDB_Deposit *deposit)
{
struct TALER_MINTDB_Session *session;
- struct TALER_MINT_DB_TransactionList *tl;
+ struct TALER_MINTDB_TransactionList *tl;
struct TALER_Amount spent;
struct TALER_Amount value;
+ struct TALER_Amount amount_without_fee;
struct TMH_KS_StateHandle *mks;
struct TALER_MINTDB_DenominationKeyIssueInformation *dki;
int ret;
if (NULL == (session = TMH_plugin->get_session (TMH_plugin->cls,
- GNUNET_NO)))
+ GNUNET_NO)))
{
GNUNET_break (0);
return TMH_RESPONSE_reply_internal_db_error (connection);
}
if (GNUNET_YES ==
TMH_plugin->have_deposit (TMH_plugin->cls,
- session,
- deposit))
+ session,
+ deposit))
{
+ GNUNET_assert (GNUNET_OK ==
+ TALER_amount_subtract (&amount_without_fee,
+ &deposit->amount_with_fee,
+ &deposit->deposit_fee));
return TMH_RESPONSE_reply_deposit_success (connection,
- &deposit->coin.coin_pub,
- &deposit->h_wire,
- &deposit->h_contract,
- deposit->transaction_id,
- &deposit->merchant_pub,
- &deposit->amount_with_fee);
+ &deposit->coin.coin_pub,
+ &deposit->h_wire,
+ &deposit->h_contract,
+ deposit->transaction_id,
+ &deposit->merchant_pub,
+ &amount_without_fee);
}
mks = TMH_KS_acquire ();
dki = TMH_KS_denomination_key_lookup (mks,
@@ -214,7 +219,7 @@ TMH_DB_execute_withdraw_status (struct MHD_Connection *connection,
const struct TALER_ReservePublicKeyP *reserve_pub)
{
struct TALER_MINTDB_Session *session;
- struct ReserveHistory *rh;
+ struct TALER_MINTDB_ReserveHistory *rh;
int res;
if (NULL == (session = TMH_plugin->get_session (TMH_plugin->cls,
@@ -262,10 +267,10 @@ TMH_DB_execute_withdraw_sign (struct MHD_Connection *connection,
const struct TALER_ReserveSignatureP *signature)
{
struct TALER_MINTDB_Session *session;
- struct ReserveHistory *rh;
- const struct ReserveHistory *pos;
+ struct TALER_MINTDB_ReserveHistory *rh;
+ const struct TALER_MINTDB_ReserveHistory *pos;
struct TMH_KS_StateHandle *key_state;
- struct CollectableBlindcoin collectable;
+ struct TALER_MINTDB_CollectableBlindcoin collectable;
struct TALER_MINTDB_DenominationKeyIssueInformation *dki;
struct TALER_MINTDB_DenominationKeyIssueInformation *tdki;
struct GNUNET_CRYPTO_rsa_Signature *sig;
@@ -369,7 +374,7 @@ TMH_DB_execute_withdraw_sign (struct MHD_Connection *connection,
{
switch (pos->type)
{
- case TALER_MINT_DB_RO_BANK_TO_MINT:
+ case TALER_MINTDB_RO_BANK_TO_MINT:
if (0 == (res & 1))
deposit_total = pos->details.bank->amount;
else
@@ -385,7 +390,7 @@ TMH_DB_execute_withdraw_sign (struct MHD_Connection *connection,
}
res |= 1;
break;
- case TALER_MINT_DB_RO_WITHDRAW_COIN:
+ case TALER_MINTDB_RO_WITHDRAW_COIN:
tdki = TMH_KS_denomination_key_lookup (key_state,
&pos->details.withdraw->denom_pub);
TALER_amount_ntoh (&value,
@@ -499,11 +504,11 @@ refresh_accept_melts (struct MHD_Connection *connection,
uint16_t oldcoin_index)
{
struct TALER_DenominationKeyValidityPS *dki;
- struct TALER_MINT_DB_TransactionList *tl;
+ struct TALER_MINTDB_TransactionList *tl;
struct TALER_Amount coin_value;
struct TALER_Amount coin_residual;
struct TALER_Amount spent;
- struct RefreshMelt melt;
+ struct TALER_MINTDB_RefreshMelt melt;
int res;
dki = &TMH_KS_denomination_key_lookup (key_state,
@@ -608,11 +613,11 @@ TMH_DB_execute_refresh_melt (struct MHD_Connection *connection,
unsigned int coin_count,
const struct TALER_CoinPublicInfo *coin_public_infos,
const struct TMH_DB_MeltDetails *coin_melt_details,
- struct RefreshCommitCoin *const* commit_coin,
- struct RefreshCommitLink *const* commit_link)
+ struct TALER_MINTDB_RefreshCommitCoin *const* commit_coin,
+ struct TALER_MINTDB_RefreshCommitLinkP *const* commit_link)
{
struct TMH_KS_StateHandle *key_state;
- struct RefreshSession refresh_session;
+ struct TALER_MINTDB_RefreshSession refresh_session;
struct TALER_MINTDB_Session *session;
int res;
unsigned int i;
@@ -774,7 +779,7 @@ check_commitment (struct MHD_Connection *connection,
unsigned int off,
unsigned int num_oldcoins,
const struct TALER_TransferPrivateKeyP *transfer_privs,
- const struct RefreshMelt *melts,
+ const struct TALER_MINTDB_RefreshMelt *melts,
unsigned int num_newcoins,
const struct TALER_DenominationPublicKey *denom_pubs)
{
@@ -783,11 +788,11 @@ check_commitment (struct MHD_Connection *connection,
int secret_initialized = GNUNET_NO;
struct GNUNET_CRYPTO_EcdhePublicKey coin_ecdhe;
struct GNUNET_CRYPTO_EcdhePrivateKey transfer_ecdhe;
- struct RefreshCommitLink *commit_links;
- struct RefreshCommitCoin *commit_coins;
+ struct TALER_MINTDB_RefreshCommitLinkP *commit_links;
+ struct TALER_MINTDB_RefreshCommitCoin *commit_coins;
commit_links = GNUNET_malloc (num_oldcoins *
- sizeof (struct RefreshCommitLink));
+ sizeof (struct TALER_MINTDB_RefreshCommitLinkP));
if (GNUNET_OK !=
TMH_plugin->get_refresh_commit_links (TMH_plugin->cls,
session,
@@ -885,7 +890,7 @@ check_commitment (struct MHD_Connection *connection,
/* Check that the commitments for all new coins were correct */
commit_coins = GNUNET_malloc (num_newcoins *
- sizeof (struct RefreshCommitCoin));
+ sizeof (struct TALER_MINTDB_RefreshCommitCoin));
if (GNUNET_OK !=
TMH_plugin->get_refresh_commit_coins (TMH_plugin->cls,
@@ -984,7 +989,7 @@ refresh_mint_coin (struct MHD_Connection *connection,
const struct GNUNET_HashCode *session_hash,
struct TMH_KS_StateHandle *key_state,
const struct TALER_DenominationPublicKey *denom_pub,
- const struct RefreshCommitCoin *commit_coin,
+ const struct TALER_MINTDB_RefreshCommitCoin *commit_coin,
unsigned int coin_off)
{
struct TALER_MINTDB_DenominationKeyIssueInformation *dki;
@@ -1044,12 +1049,12 @@ TMH_DB_execute_refresh_reveal (struct MHD_Connection *connection,
{
int res;
struct TALER_MINTDB_Session *session;
- struct RefreshSession refresh_session;
+ struct TALER_MINTDB_RefreshSession refresh_session;
struct TMH_KS_StateHandle *key_state;
- struct RefreshMelt *melts;
+ struct TALER_MINTDB_RefreshMelt *melts;
struct TALER_DenominationPublicKey *denom_pubs;
struct TALER_DenominationSignature *ev_sigs;
- struct RefreshCommitCoin *commit_coins;
+ struct TALER_MINTDB_RefreshCommitCoin *commit_coins;
unsigned int i;
unsigned int j;
unsigned int off;
@@ -1077,7 +1082,7 @@ TMH_DB_execute_refresh_reveal (struct MHD_Connection *connection,
}
melts = GNUNET_malloc (refresh_session.num_oldcoins *
- sizeof (struct RefreshMelt));
+ sizeof (struct TALER_MINTDB_RefreshMelt));
for (j=0;j<refresh_session.num_oldcoins;j++)
{
if (GNUNET_OK !=
@@ -1147,7 +1152,7 @@ TMH_DB_execute_refresh_reveal (struct MHD_Connection *connection,
}
commit_coins = GNUNET_malloc (refresh_session.num_newcoins *
- sizeof (struct RefreshCommitCoin));
+ sizeof (struct TALER_MINTDB_RefreshCommitCoin));
if (GNUNET_OK !=
TMH_plugin->get_refresh_commit_coins (TMH_plugin->cls,
session,
@@ -1232,7 +1237,7 @@ TMH_DB_execute_refresh_link (struct MHD_Connection *connection,
struct TALER_MINTDB_Session *session;
struct TALER_TransferPublicKeyP transfer_pub;
struct TALER_EncryptedLinkSecretP shared_secret_enc;
- struct LinkDataList *ldl;
+ struct TALER_MINTDB_LinkDataList *ldl;
if (NULL == (session = TMH_plugin->get_session (TMH_plugin->cls,
GNUNET_NO)))
diff --git a/src/mint/taler-mint-httpd_db.h b/src/mint/taler-mint-httpd_db.h
index 8d51463d8..f92a999f0 100644
--- a/src/mint/taler-mint-httpd_db.h
+++ b/src/mint/taler-mint-httpd_db.h
@@ -39,7 +39,7 @@
*/
int
TMH_DB_execute_deposit (struct MHD_Connection *connection,
- const struct Deposit *deposit);
+ const struct TALER_MINTDB_Deposit *deposit);
/**
@@ -85,7 +85,7 @@ struct TMH_DB_MeltDetails
{
/**
* Signature allowing the melt (using
- * a `struct RefreshMeltConfirmSignRequestBody`) to sign over.
+ * a `struct TALER_MINTDB_RefreshMeltConfirmSignRequestBody`) to sign over.
*/
struct TALER_CoinSpendSignatureP melt_sig;
@@ -127,8 +127,8 @@ TMH_DB_execute_refresh_melt (struct MHD_Connection *connection,
unsigned int coin_count,
const struct TALER_CoinPublicInfo *coin_public_infos,
const struct TMH_DB_MeltDetails *coin_melt_details,
- struct RefreshCommitCoin *const* commit_coin,
- struct RefreshCommitLink *const* commit_link);
+ struct TALER_MINTDB_RefreshCommitCoin *const* commit_coin,
+ struct TALER_MINTDB_RefreshCommitLinkP *const* commit_link);
/**
diff --git a/src/mint/taler-mint-httpd_deposit.c b/src/mint/taler-mint-httpd_deposit.c
index 09e101f60..cdf6d6a98 100644
--- a/src/mint/taler-mint-httpd_deposit.c
+++ b/src/mint/taler-mint-httpd_deposit.c
@@ -53,7 +53,7 @@
*/
static int
verify_and_execute_deposit (struct MHD_Connection *connection,
- const struct Deposit *deposit)
+ const struct TALER_MINTDB_Deposit *deposit)
{
struct TMH_KS_StateHandle *key_state;
struct TALER_DepositRequestPS dr;
@@ -133,7 +133,7 @@ parse_and_handle_deposit_request (struct MHD_Connection *connection,
json_t *wire)
{
int res;
- struct Deposit deposit;
+ struct TALER_MINTDB_Deposit deposit;
char *wire_enc;
size_t len;
struct TMH_PARSE_FieldSpecification spec[] = {
diff --git a/src/mint/taler-mint-httpd_refresh.c b/src/mint/taler-mint-httpd_refresh.c
index 53671dfab..dd625a6af 100644
--- a/src/mint/taler-mint-httpd_refresh.c
+++ b/src/mint/taler-mint-httpd_refresh.c
@@ -62,8 +62,8 @@ handle_refresh_melt_binary (struct MHD_Connection *connection,
struct TALER_CoinPublicInfo *coin_public_infos,
const struct TMH_DB_MeltDetails *coin_melt_details,
const struct GNUNET_HashCode *session_hash,
- struct RefreshCommitCoin *const* commit_coin,
- struct RefreshCommitLink *const* commit_link)
+ struct TALER_MINTDB_RefreshCommitCoin *const* commit_coin,
+ struct TALER_MINTDB_RefreshCommitLinkP *const* commit_link)
{
unsigned int i;
@@ -300,7 +300,7 @@ verify_coin_public_info (struct MHD_Connection *connection,
* @param num_new_coins size of 2nd dimension
*/
static void
-free_commit_coins (struct RefreshCommitCoin **commit_coin,
+free_commit_coins (struct TALER_MINTDB_RefreshCommitCoin **commit_coin,
unsigned int kappa,
unsigned int num_new_coins)
{
@@ -329,7 +329,7 @@ free_commit_coins (struct RefreshCommitCoin **commit_coin,
* @param num_old_coins size of 2nd dimension
*/
static void
-free_commit_links (struct RefreshCommitLink **commit_link,
+free_commit_links (struct TALER_MINTDB_RefreshCommitLinkP **commit_link,
unsigned int kappa,
unsigned int num_old_coins)
{
@@ -388,8 +388,8 @@ handle_refresh_melt_json (struct MHD_Connection *connection,
unsigned int coin_count;
struct GNUNET_HashCode session_hash;
struct GNUNET_HashContext *hash_context;
- struct RefreshCommitCoin *commit_coin[TALER_CNC_KAPPA];
- struct RefreshCommitLink *commit_link[TALER_CNC_KAPPA];
+ struct TALER_MINTDB_RefreshCommitCoin *commit_coin[TALER_CNC_KAPPA];
+ struct TALER_MINTDB_RefreshCommitLinkP *commit_link[TALER_CNC_KAPPA];
/* For the signature check, we hash most of the inputs together
(except for the signatures on the coins). */
@@ -492,12 +492,12 @@ handle_refresh_melt_json (struct MHD_Connection *connection,
for (i = 0; i < TALER_CNC_KAPPA; i++)
{
commit_coin[i] = GNUNET_malloc (num_newcoins *
- sizeof (struct RefreshCommitCoin));
+ sizeof (struct TALER_MINTDB_RefreshCommitCoin));
for (j = 0; j < num_newcoins; j++)
{
char *link_enc;
size_t link_enc_size;
- struct RefreshCommitCoin *rcc = &commit_coin[i][j];
+ struct TALER_MINTDB_RefreshCommitCoin *rcc = &commit_coin[i][j];
res = TMH_PARSE_navigate_json (connection,
coin_evs,
@@ -545,10 +545,10 @@ handle_refresh_melt_json (struct MHD_Connection *connection,
for (i = 0; i < TALER_CNC_KAPPA; i++)
{
commit_link[i] = GNUNET_malloc (num_oldcoins *
- sizeof (struct RefreshCommitLink));
+ sizeof (struct TALER_MINTDB_RefreshCommitLinkP));
for (j = 0; j < num_oldcoins; j++)
{
- struct RefreshCommitLink *rcl = &commit_link[i][j];
+ struct TALER_MINTDB_RefreshCommitLinkP *rcl = &commit_link[i][j];
res = TMH_PARSE_navigate_json (connection,
transfer_pubs,
@@ -593,7 +593,7 @@ handle_refresh_melt_json (struct MHD_Connection *connection,
GNUNET_CRYPTO_hash_context_read (hash_context,
rcl,
- sizeof (struct RefreshCommitLink));
+ sizeof (struct TALER_MINTDB_RefreshCommitLinkP));
}
}
diff --git a/src/mint/taler-mint-httpd_responses.c b/src/mint/taler-mint-httpd_responses.c
index c9ca51413..700090dba 100644
--- a/src/mint/taler-mint-httpd_responses.c
+++ b/src/mint/taler-mint-httpd_responses.c
@@ -277,7 +277,7 @@ TMH_RESPONSE_reply_invalid_json (struct MHD_Connection *connection)
* @param h_contract hash of contract details
* @param transaction_id transaction ID
* @param merchant merchant public key
- * @param amount fraction of coin value to deposit
+ * @param amount_without_fee fraction of coin value to deposit, without the fee
* @return MHD result code
*/
int
@@ -287,7 +287,7 @@ TMH_RESPONSE_reply_deposit_success (struct MHD_Connection *connection,
const struct GNUNET_HashCode *h_contract,
uint64_t transaction_id,
const struct TALER_MerchantPublicKeyP *merchant,
- const struct TALER_Amount *amount)
+ const struct TALER_Amount *amount_without_fee)
{
struct TALER_DepositConfirmationPS dc;
struct TALER_MintSignatureP sig;
@@ -299,8 +299,8 @@ TMH_RESPONSE_reply_deposit_success (struct MHD_Connection *connection,
dc.h_contract = *h_contract;
dc.h_wire = *h_wire;
dc.transaction_id = GNUNET_htonll (transaction_id);
- TALER_amount_hton (&dc.amount_with_fee,
- amount);
+ TALER_amount_hton (&dc.amount_without_fee,
+ amount_without_fee);
dc.coin_pub = *coin_pub;
dc.merchant = *merchant;
TMH_KS_sign (&dc.purpose,
@@ -324,23 +324,23 @@ TMH_RESPONSE_reply_deposit_success (struct MHD_Connection *connection,
* @return json representation of the @a rh
*/
static json_t *
-compile_transaction_history (const struct TALER_MINT_DB_TransactionList *tl)
+compile_transaction_history (const struct TALER_MINTDB_TransactionList *tl)
{
json_t *transaction;
const char *type;
struct TALER_Amount value;
json_t *history;
- const struct TALER_MINT_DB_TransactionList *pos;
+ const struct TALER_MINTDB_TransactionList *pos;
history = json_array ();
for (pos = tl; NULL != pos; pos = pos->next)
{
switch (pos->type)
{
- case TALER_MINT_DB_TT_DEPOSIT:
+ case TALER_MINTDB_TT_DEPOSIT:
{
struct TALER_DepositRequestPS dr;
- const struct Deposit *deposit = pos->details.deposit;
+ const struct TALER_MINTDB_Deposit *deposit = pos->details.deposit;
type = "deposit";
value = deposit->amount_with_fee;
@@ -356,10 +356,10 @@ compile_transaction_history (const struct TALER_MINT_DB_TransactionList *tl)
&deposit->csig.ecdsa_signature);
break;
}
- case TALER_MINT_DB_TT_REFRESH_MELT:
+ case TALER_MINTDB_TT_REFRESH_MELT:
{
struct TALER_RefreshMeltCoinAffirmationPS ms;
- const struct RefreshMelt *melt = pos->details.melt;
+ const struct TALER_MINTDB_RefreshMelt *melt = pos->details.melt;
type = "melt";
value = melt->amount_with_fee;
@@ -373,7 +373,7 @@ compile_transaction_history (const struct TALER_MINT_DB_TransactionList *tl)
&melt->coin_sig.ecdsa_signature);
}
break;
- case TALER_MINT_DB_TT_LOCK:
+ case TALER_MINTDB_TT_LOCK:
{
type = "lock";
value = pos->details.lock->amount;
@@ -405,7 +405,7 @@ compile_transaction_history (const struct TALER_MINT_DB_TransactionList *tl)
*/
int
TMH_RESPONSE_reply_deposit_insufficient_funds (struct MHD_Connection *connection,
- const struct TALER_MINT_DB_TransactionList *tl)
+ const struct TALER_MINTDB_TransactionList *tl)
{
json_t *history;
@@ -427,7 +427,7 @@ TMH_RESPONSE_reply_deposit_insufficient_funds (struct MHD_Connection *connection
* @return json representation of the @a rh, NULL on error
*/
static json_t *
-compile_reserve_history (const struct ReserveHistory *rh,
+compile_reserve_history (const struct TALER_MINTDB_ReserveHistory *rh,
struct TALER_Amount *balance)
{
struct TALER_Amount deposit_total;
@@ -436,7 +436,7 @@ compile_reserve_history (const struct ReserveHistory *rh,
json_t *json_history;
json_t *transaction;
int ret;
- const struct ReserveHistory *pos;
+ const struct TALER_MINTDB_ReserveHistory *pos;
struct TALER_MINTDB_DenominationKeyIssueInformation *dki;
struct TMH_KS_StateHandle *key_state;
struct TALER_WithdrawRequestPS wr;
@@ -447,7 +447,7 @@ compile_reserve_history (const struct ReserveHistory *rh,
{
switch (pos->type)
{
- case TALER_MINT_DB_RO_BANK_TO_MINT:
+ case TALER_MINTDB_RO_BANK_TO_MINT:
if (0 == ret)
deposit_total = pos->details.bank->amount;
else
@@ -466,7 +466,7 @@ compile_reserve_history (const struct ReserveHistory *rh,
"wire", pos->details.bank->wire,
"amount", TALER_json_from_amount (&pos->details.bank->amount)));
break;
- case TALER_MINT_DB_RO_WITHDRAW_COIN:
+ case TALER_MINTDB_RO_WITHDRAW_COIN:
break;
}
}
@@ -477,9 +477,9 @@ compile_reserve_history (const struct ReserveHistory *rh,
{
switch (pos->type)
{
- case TALER_MINT_DB_RO_BANK_TO_MINT:
+ case TALER_MINTDB_RO_BANK_TO_MINT:
break;
- case TALER_MINT_DB_RO_WITHDRAW_COIN:
+ case TALER_MINTDB_RO_WITHDRAW_COIN:
dki = TMH_KS_denomination_key_lookup (key_state,
&pos->details.withdraw->denom_pub);
@@ -541,7 +541,7 @@ compile_reserve_history (const struct ReserveHistory *rh,
*/
int
TMH_RESPONSE_reply_withdraw_status_success (struct MHD_Connection *connection,
- const struct ReserveHistory *rh)
+ const struct TALER_MINTDB_ReserveHistory *rh)
{
json_t *json_balance;
json_t *json_history;
@@ -576,7 +576,7 @@ TMH_RESPONSE_reply_withdraw_status_success (struct MHD_Connection *connection,
*/
int
TMH_RESPONSE_reply_withdraw_sign_insufficient_funds (struct MHD_Connection *connection,
- const struct ReserveHistory *rh)
+ const struct TALER_MINTDB_ReserveHistory *rh)
{
json_t *json_balance;
json_t *json_history;
@@ -610,7 +610,7 @@ TMH_RESPONSE_reply_withdraw_sign_insufficient_funds (struct MHD_Connection *conn
*/
int
TMH_RESPONSE_reply_withdraw_sign_success (struct MHD_Connection *connection,
- const struct CollectableBlindcoin *collectable)
+ const struct TALER_MINTDB_CollectableBlindcoin *collectable)
{
json_t *sig_json;
int ret;
@@ -644,7 +644,7 @@ int
TMH_RESPONSE_reply_refresh_melt_insufficient_funds (struct MHD_Connection *connection,
const union TALER_CoinSpendPublicKeyP *coin_pub,
struct TALER_Amount coin_value,
- struct TALER_MINT_DB_TransactionList *tl,
+ struct TALER_MINTDB_TransactionList *tl,
struct TALER_Amount requested,
struct TALER_Amount residual)
{
@@ -781,9 +781,9 @@ int
TMH_RESPONSE_reply_refresh_link_success (struct MHD_Connection *connection,
const struct TALER_TransferPublicKeyP *transfer_pub,
const struct TALER_EncryptedLinkSecretP *shared_secret_enc,
- const struct LinkDataList *ldl)
+ const struct TALER_MINTDB_LinkDataList *ldl)
{
- const struct LinkDataList *pos;
+ const struct TALER_MINTDB_LinkDataList *pos;
json_t *root;
json_t *list;
int res;
diff --git a/src/mint/taler-mint-httpd_responses.h b/src/mint/taler-mint-httpd_responses.h
index c3a8daa70..3cee66a08 100644
--- a/src/mint/taler-mint-httpd_responses.h
+++ b/src/mint/taler-mint-httpd_responses.h
@@ -180,7 +180,7 @@ TMH_RESPONSE_reply_invalid_json (struct MHD_Connection *connection);
* @param h_contract hash of contract details
* @param transaction_id transaction ID
* @param merchant merchant public key
- * @param amount fraction of coin value to deposit
+ * @param amount_without_fee fraction of coin value to deposit (without fee)
* @return MHD result code
*/
int
@@ -190,7 +190,7 @@ TMH_RESPONSE_reply_deposit_success (struct MHD_Connection *connection,
const struct GNUNET_HashCode *h_contract,
uint64_t transaction_id,
const struct TALER_MerchantPublicKeyP *merchant,
- const struct TALER_Amount *amount);
+ const struct TALER_Amount *amount_without_fee);
/**
@@ -204,7 +204,7 @@ TMH_RESPONSE_reply_deposit_success (struct MHD_Connection *connection,
*/
int
TMH_RESPONSE_reply_deposit_insufficient_funds (struct MHD_Connection *connection,
- const struct TALER_MINT_DB_TransactionList *tl);
+ const struct TALER_MINTDB_TransactionList *tl);
/**
@@ -216,7 +216,7 @@ TMH_RESPONSE_reply_deposit_insufficient_funds (struct MHD_Connection *connection
*/
int
TMH_RESPONSE_reply_withdraw_status_success (struct MHD_Connection *connection,
- const struct ReserveHistory *rh);
+ const struct TALER_MINTDB_ReserveHistory *rh);
/**
@@ -230,7 +230,7 @@ TMH_RESPONSE_reply_withdraw_status_success (struct MHD_Connection *connection,
*/
int
TMH_RESPONSE_reply_withdraw_sign_insufficient_funds (struct MHD_Connection *connection,
- const struct ReserveHistory *rh);
+ const struct TALER_MINTDB_ReserveHistory *rh);
/**
@@ -242,7 +242,7 @@ TMH_RESPONSE_reply_withdraw_sign_insufficient_funds (struct MHD_Connection *conn
*/
int
TMH_RESPONSE_reply_withdraw_sign_success (struct MHD_Connection *connection,
- const struct CollectableBlindcoin *collectable);
+ const struct TALER_MINTDB_CollectableBlindcoin *collectable);
/**
@@ -278,7 +278,7 @@ int
TMH_RESPONSE_reply_refresh_melt_insufficient_funds (struct MHD_Connection *connection,
const union TALER_CoinSpendPublicKeyP *coin_pub,
struct TALER_Amount coin_value,
- struct TALER_MINT_DB_TransactionList *tl,
+ struct TALER_MINTDB_TransactionList *tl,
struct TALER_Amount requested,
struct TALER_Amount residual);
@@ -334,7 +334,7 @@ int
TMH_RESPONSE_reply_refresh_link_success (struct MHD_Connection *connection,
const struct TALER_TransferPublicKeyP *transfer_pub,
const struct TALER_EncryptedLinkSecretP *shared_secret_enc,
- const struct LinkDataList *ldl);
+ const struct TALER_MINTDB_LinkDataList *ldl);
#endif
diff --git a/src/mintdb/plugin_mintdb_common.c b/src/mintdb/plugin_mintdb_common.c
index a95cf4be2..b8f86da0f 100644
--- a/src/mintdb/plugin_mintdb_common.c
+++ b/src/mintdb/plugin_mintdb_common.c
@@ -28,23 +28,23 @@
*/
static void
common_free_reserve_history (void *cls,
- struct ReserveHistory *rh)
+ struct TALER_MINTDB_ReserveHistory *rh)
{
- struct BankTransfer *bt;
- struct CollectableBlindcoin *cbc;
- struct ReserveHistory *backref;
+ struct TALER_MINTDB_BankTransfer *bt;
+ struct TALER_MINTDB_CollectableBlindcoin *cbc;
+ struct TALER_MINTDB_ReserveHistory *backref;
while (NULL != rh)
{
switch(rh->type)
{
- case TALER_MINT_DB_RO_BANK_TO_MINT:
+ case TALER_MINTDB_RO_BANK_TO_MINT:
bt = rh->details.bank;
if (NULL != bt->wire)
json_decref (bt->wire);
GNUNET_free (bt);
break;
- case TALER_MINT_DB_RO_WITHDRAW_COIN:
+ case TALER_MINTDB_RO_WITHDRAW_COIN:
cbc = rh->details.withdraw;
GNUNET_CRYPTO_rsa_signature_free (cbc->sig.rsa_signature);
GNUNET_CRYPTO_rsa_public_key_free (cbc->denom_pub.rsa_public_key);
@@ -66,9 +66,9 @@ common_free_reserve_history (void *cls,
*/
static void
common_free_link_data_list (void *cls,
- struct LinkDataList *ldl)
+ struct TALER_MINTDB_LinkDataList *ldl)
{
- struct LinkDataList *next;
+ struct TALER_MINTDB_LinkDataList *next;
while (NULL != ldl)
{
@@ -88,9 +88,9 @@ common_free_link_data_list (void *cls,
*/
static void
common_free_coin_transaction_list (void *cls,
- struct TALER_MINT_DB_TransactionList *list)
+ struct TALER_MINTDB_TransactionList *list)
{
- struct TALER_MINT_DB_TransactionList *next;
+ struct TALER_MINTDB_TransactionList *next;
while (NULL != list)
{
@@ -98,14 +98,14 @@ common_free_coin_transaction_list (void *cls,
switch (list->type)
{
- case TALER_MINT_DB_TT_DEPOSIT:
+ case TALER_MINTDB_TT_DEPOSIT:
json_decref (list->details.deposit->wire);
GNUNET_free (list->details.deposit);
break;
- case TALER_MINT_DB_TT_REFRESH_MELT:
+ case TALER_MINTDB_TT_REFRESH_MELT:
GNUNET_free (list->details.melt);
break;
- case TALER_MINT_DB_TT_LOCK:
+ case TALER_MINTDB_TT_LOCK:
GNUNET_free (list->details.lock);
/* FIXME: look at this again once locking is implemented (#3625) */
break;
diff --git a/src/mintdb/plugin_mintdb_postgres.c b/src/mintdb/plugin_mintdb_postgres.c
index fa2c19db0..0cf8e51e9 100644
--- a/src/mintdb/plugin_mintdb_postgres.c
+++ b/src/mintdb/plugin_mintdb_postgres.c
@@ -753,7 +753,7 @@ postgres_commit (void *cls,
static int
postgres_reserve_get (void *cls,
struct TALER_MINTDB_Session *session,
- struct Reserve *reserve)
+ struct TALER_MINTDB_Reserve *reserve)
{
PGresult *result;
uint64_t expiration_date_nbo;
@@ -809,7 +809,7 @@ postgres_reserve_get (void *cls,
static int
postgres_reserves_update (void *cls,
struct TALER_MINTDB_Session *session,
- struct Reserve *reserve)
+ struct TALER_MINTDB_Reserve *reserve)
{
PGresult *result;
struct TALER_AmountNBO balance_nbo;
@@ -858,7 +858,7 @@ postgres_reserves_update (void *cls,
static int
postgres_reserves_in_insert (void *cls,
struct TALER_MINTDB_Session *session,
- struct Reserve *reserve,
+ struct TALER_MINTDB_Reserve *reserve,
const struct TALER_Amount *balance,
const struct GNUNET_TIME_Absolute expiry)
{
@@ -946,7 +946,7 @@ postgres_reserves_in_insert (void *cls,
return GNUNET_OK;
}
/* Update reserve */
- struct Reserve updated_reserve;
+ struct TALER_MINTDB_Reserve updated_reserve;
updated_reserve.pub = reserve->pub;
if (GNUNET_OK !=
@@ -993,7 +993,7 @@ static int
postgres_get_collectable_blindcoin (void *cls,
struct TALER_MINTDB_Session *session,
const struct GNUNET_HashCode *h_blind,
- struct CollectableBlindcoin *collectable)
+ struct TALER_MINTDB_CollectableBlindcoin *collectable)
{
PGresult *result;
struct TALER_PQ_QueryParam params[] = {
@@ -1086,10 +1086,10 @@ postgres_insert_collectable_blindcoin (void *cls,
struct TALER_MINTDB_Session *session,
const struct GNUNET_HashCode *h_blind,
struct TALER_Amount withdraw,
- const struct CollectableBlindcoin *collectable)
+ const struct TALER_MINTDB_CollectableBlindcoin *collectable)
{
PGresult *result;
- struct Reserve reserve;
+ struct TALER_MINTDB_Reserve reserve;
char *denom_pub_enc = NULL;
char *denom_sig_enc = NULL;
size_t denom_pub_enc_size;
@@ -1163,14 +1163,14 @@ postgres_insert_collectable_blindcoin (void *cls,
* @param reserve_pub public key of the reserve
* @return known transaction history (NULL if reserve is unknown)
*/
-static struct ReserveHistory *
+static struct TALER_MINTDB_ReserveHistory *
postgres_get_reserve_history (void *cls,
struct TALER_MINTDB_Session *session,
const struct TALER_ReservePublicKeyP *reserve_pub)
{
PGresult *result;
- struct ReserveHistory *rh;
- struct ReserveHistory *rh_head;
+ struct TALER_MINTDB_ReserveHistory *rh;
+ struct TALER_MINTDB_ReserveHistory *rh_head;
int rows;
int ret;
@@ -1179,7 +1179,7 @@ postgres_get_reserve_history (void *cls,
rh_head = NULL;
ret = GNUNET_SYSERR;
{
- struct BankTransfer *bt;
+ struct TALER_MINTDB_BankTransfer *bt;
struct TALER_PQ_QueryParam params[] = {
TALER_PQ_QUERY_PARAM_PTR (reserve_pub),
TALER_PQ_QUERY_PARAM_END
@@ -1201,7 +1201,7 @@ postgres_get_reserve_history (void *cls,
}
while (0 < rows)
{
- bt = GNUNET_new (struct BankTransfer);
+ bt = GNUNET_new (struct TALER_MINTDB_BankTransfer);
if (GNUNET_OK != TALER_PQ_extract_amount (result,
--rows,
"balance_value",
@@ -1216,15 +1216,15 @@ postgres_get_reserve_history (void *cls,
bt->reserve_pub = *reserve_pub;
if (NULL != rh_head)
{
- rh_head->next = GNUNET_new (struct ReserveHistory);
+ rh_head->next = GNUNET_new (struct TALER_MINTDB_ReserveHistory);
rh_head = rh_head->next;
}
else
{
- rh_head = GNUNET_new (struct ReserveHistory);
+ rh_head = GNUNET_new (struct TALER_MINTDB_ReserveHistory);
rh = rh_head;
}
- rh_head->type = TALER_MINT_DB_RO_BANK_TO_MINT;
+ rh_head->type = TALER_MINTDB_RO_BANK_TO_MINT;
rh_head->details.bank = bt;
}
}
@@ -1233,7 +1233,7 @@ postgres_get_reserve_history (void *cls,
{
struct GNUNET_HashCode blind_ev;
struct TALER_ReserveSignatureP reserve_sig;
- struct CollectableBlindcoin *cbc;
+ struct TALER_MINTDB_CollectableBlindcoin *cbc;
char *denom_pub_enc;
char *denom_sig_enc;
size_t denom_pub_enc_size;
@@ -1273,7 +1273,7 @@ postgres_get_reserve_history (void *cls,
GNUNET_break (0);
goto cleanup;
}
- cbc = GNUNET_new (struct CollectableBlindcoin);
+ cbc = GNUNET_new (struct TALER_MINTDB_CollectableBlindcoin);
cbc->sig.rsa_signature
= GNUNET_CRYPTO_rsa_signature_decode (denom_sig_enc,
denom_sig_enc_size);
@@ -1298,9 +1298,9 @@ postgres_get_reserve_history (void *cls,
(void) memcpy (&cbc->h_coin_envelope, &blind_ev, sizeof (blind_ev));
(void) memcpy (&cbc->reserve_pub, reserve_pub, sizeof (cbc->reserve_pub));
(void) memcpy (&cbc->reserve_sig, &reserve_sig, sizeof (cbc->reserve_sig));
- rh_head->next = GNUNET_new (struct ReserveHistory);
+ rh_head->next = GNUNET_new (struct TALER_MINTDB_ReserveHistory);
rh_head = rh_head->next;
- rh_head->type = TALER_MINT_DB_RO_WITHDRAW_COIN;
+ rh_head->type = TALER_MINTDB_RO_WITHDRAW_COIN;
rh_head->details.withdraw = cbc;
}
}
@@ -1331,7 +1331,7 @@ postgres_get_reserve_history (void *cls,
static int
postgres_have_deposit (void *cls,
struct TALER_MINTDB_Session *session,
- const struct Deposit *deposit)
+ const struct TALER_MINTDB_Deposit *deposit)
{
struct TALER_PQ_QueryParam params[] = {
TALER_PQ_QUERY_PARAM_PTR (&deposit->coin.coin_pub),
@@ -1378,7 +1378,7 @@ postgres_have_deposit (void *cls,
static int
postgres_insert_deposit (void *cls,
struct TALER_MINTDB_Session *session,
- const struct Deposit *deposit)
+ const struct TALER_MINTDB_Deposit *deposit)
{
char *denom_pub_enc;
char *denom_sig_enc;
@@ -1448,7 +1448,7 @@ static int
postgres_get_refresh_session (void *cls,
struct TALER_MINTDB_Session *session,
const struct GNUNET_HashCode *session_hash,
- struct RefreshSession *refresh_session)
+ struct TALER_MINTDB_RefreshSession *refresh_session)
{
// FIXME: check logic!
int res;
@@ -1481,7 +1481,7 @@ postgres_get_refresh_session (void *cls,
if (NULL == refresh_session)
return GNUNET_YES;
- memset (session, 0, sizeof (struct RefreshSession));
+ memset (session, 0, sizeof (struct TALER_MINTDB_RefreshSession));
struct TALER_PQ_ResultSpec rs[] = {
TALER_PQ_RESULT_SPEC("num_oldcoins", &refresh_session->num_oldcoins),
@@ -1522,7 +1522,7 @@ static int
postgres_create_refresh_session (void *cls,
struct TALER_MINTDB_Session *session,
const struct GNUNET_HashCode *session_hash,
- const struct RefreshSession *refresh_session)
+ const struct TALER_MINTDB_RefreshSession *refresh_session)
{
// FIXME: actually store session data!
uint16_t noreveal_index;
@@ -1566,7 +1566,7 @@ static int
postgres_insert_refresh_melt (void *cls,
struct TALER_MINTDB_Session *session,
uint16_t oldcoin_index,
- const struct RefreshMelt *melt)
+ const struct TALER_MINTDB_RefreshMelt *melt)
{
// FIXME: check logic!
uint16_t oldcoin_index_nbo = htons (oldcoin_index);
@@ -1616,7 +1616,7 @@ postgres_get_refresh_melt (void *cls,
struct TALER_MINTDB_Session *session,
const struct GNUNET_HashCode *session_hash,
uint16_t oldcoin_index,
- struct RefreshMelt *melt)
+ struct TALER_MINTDB_RefreshMelt *melt)
{
// FIXME: check logic!
GNUNET_break (0);
@@ -1766,7 +1766,7 @@ postgres_insert_refresh_commit_coins (void *cls,
const struct GNUNET_HashCode *session_hash,
unsigned int i,
unsigned int num_newcoins,
- const struct RefreshCommitCoin *commit_coins)
+ const struct TALER_MINTDB_RefreshCommitCoin *commit_coins)
{
// FIXME: check logic! -- was written for single commit_coin!
uint16_t cnc_index_nbo = htons (i);
@@ -1824,7 +1824,7 @@ postgres_get_refresh_commit_coins (void *cls,
const struct GNUNET_HashCode *session_hash,
unsigned int cnc_index,
unsigned int newcoin_index,
- struct RefreshCommitCoin *cc)
+ struct TALER_MINTDB_RefreshCommitCoin *cc)
{
// FIXME: check logic!
uint16_t cnc_index_nbo = htons (cnc_index);
@@ -1903,7 +1903,7 @@ postgres_insert_refresh_commit_links (void *cls,
const struct GNUNET_HashCode *session_hash,
unsigned int i,
unsigned int j,
- const struct RefreshCommitLink *commit_link)
+ const struct TALER_MINTDB_RefreshCommitLinkP *commit_link)
{
// FIXME: check logic!
uint16_t cnc_index_nbo = htons (i);
@@ -1958,7 +1958,7 @@ postgres_get_refresh_commit_links (void *cls,
const struct GNUNET_HashCode *session_hash,
unsigned int i,
unsigned int num_links,
- struct RefreshCommitLink *links)
+ struct TALER_MINTDB_RefreshCommitLinkP *links)
{
// FIXME: check logic: was written for a single link!
uint16_t cnc_index_nbo = htons (i);
@@ -2064,14 +2064,14 @@ postgres_insert_refresh_collectable (void *cls,
* @param coin_pub public key to use to retrieve linkage data
* @return all known link data for the coin
*/
-static struct LinkDataList *
+static struct TALER_MINTDB_LinkDataList *
postgres_get_link_data_list (void *cls,
struct TALER_MINTDB_Session *session,
const union TALER_CoinSpendPublicKeyP *coin_pub)
{
// FIXME: check logic!
- struct LinkDataList *ldl;
- struct LinkDataList *pos;
+ struct TALER_MINTDB_LinkDataList *ldl;
+ struct TALER_MINTDB_LinkDataList *pos;
struct TALER_PQ_QueryParam params[] = {
TALER_PQ_QUERY_PARAM_PTR(coin_pub),
TALER_PQ_QUERY_PARAM_END
@@ -2163,7 +2163,7 @@ postgres_get_link_data_list (void *cls,
ldl);
return NULL;
}
- pos = GNUNET_new (struct LinkDataList);
+ pos = GNUNET_new (struct TALER_MINTDB_LinkDataList);
pos->next = ldl;
pos->link_data_enc = link_enc;
pos->denom_pub.rsa_public_key = denom_pub;
@@ -2253,7 +2253,7 @@ postgres_get_transfer (void *cls,
* @param coin_pub coin to investigate
* @return list of transactions, NULL if coin is fresh
*/
-static struct TALER_MINT_DB_TransactionList *
+static struct TALER_MINTDB_TransactionList *
postgres_get_coin_transactions (void *cls,
struct TALER_MINTDB_Session *session,
const union TALER_CoinSpendPublicKeyP *coin_pub)
diff --git a/src/mintdb/test_mintdb.c b/src/mintdb/test_mintdb.c
index b98a09cd5..99eb9b78c 100644
--- a/src/mintdb/test_mintdb.c
+++ b/src/mintdb/test_mintdb.c
@@ -63,7 +63,7 @@ check_reserve (struct TALER_MINTDB_Session *session,
const char *currency,
uint64_t expiry)
{
- struct Reserve reserve;
+ struct TALER_MINTDB_Reserve reserve;
reserve.pub = *pub;
@@ -127,19 +127,19 @@ run (void *cls,
{
struct TALER_MINTDB_Session *session;
struct TALER_ReservePublicKeyP reserve_pub;
- struct Reserve reserve;
+ struct TALER_MINTDB_Reserve reserve;
struct GNUNET_TIME_Absolute expiry;
struct TALER_Amount amount;
struct DenomKeyPair *dkp;
struct GNUNET_HashCode h_blind;
- struct CollectableBlindcoin cbc;
- struct CollectableBlindcoin cbc2;
- struct ReserveHistory *rh;
- struct ReserveHistory *rh_head;
- struct BankTransfer *bt;
- struct CollectableBlindcoin *withdraw;
- struct Deposit deposit;
- struct Deposit deposit2;
+ struct TALER_MINTDB_CollectableBlindcoin cbc;
+ struct TALER_MINTDB_CollectableBlindcoin cbc2;
+ struct TALER_MINTDB_ReserveHistory *rh;
+ struct TALER_MINTDB_ReserveHistory *rh_head;
+ struct TALER_MINTDB_BankTransfer *bt;
+ struct TALER_MINTDB_CollectableBlindcoin *withdraw;
+ struct TALER_MINTDB_Deposit deposit;
+ struct TALER_MINTDB_Deposit deposit2;
struct json_t *wire;
const char * const json_wire_str =
"{ \"type\":\"SEPA\", \
@@ -262,7 +262,7 @@ run (void *cls,
{
switch (rh_head->type)
{
- case TALER_MINT_DB_RO_BANK_TO_MINT:
+ case TALER_MINTDB_RO_BANK_TO_MINT:
bt = rh_head->details.bank;
FAILIF (0 != memcmp (&bt->reserve_pub,
&reserve_pub,
@@ -272,7 +272,7 @@ run (void *cls,
FAILIF (0 != strcmp (CURRENCY, bt->amount.currency));
FAILIF (NULL != bt->wire); /* FIXME: write wire details to db */
break;
- case TALER_MINT_DB_RO_WITHDRAW_COIN:
+ case TALER_MINTDB_RO_WITHDRAW_COIN:
withdraw = rh_head->details.withdraw;
FAILIF (0 != memcmp (&withdraw->reserve_pub,
&reserve_pub,
diff --git a/src/mintdb/test_mintdb_deposits.c b/src/mintdb/test_mintdb_deposits.c
index 766bedd70..171fa2c69 100644
--- a/src/mintdb/test_mintdb_deposits.c
+++ b/src/mintdb/test_mintdb_deposits.c
@@ -78,7 +78,7 @@ run (void *cls,
"\"NAME\":\"GNUNET E.V\","
"\"BIC\":\"GENODEF1SRL\""
"}";
- struct Deposit *deposit;
+ struct TALER_MINTDB_Deposit *deposit;
uint64_t transaction_id;
struct TALER_MINTDB_Session *session;
@@ -90,11 +90,11 @@ run (void *cls,
session = plugin->get_session (plugin->cls,
! persistent);
EXITIF (NULL == session);
- deposit = GNUNET_malloc (sizeof (struct Deposit) + sizeof (wire));
+ deposit = GNUNET_malloc (sizeof (struct TALER_MINTDB_Deposit) + sizeof (wire));
/* Makeup a random coin public key */
GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
deposit,
- sizeof (struct Deposit));
+ sizeof (struct TALER_MINTDB_Deposit));
/* Makeup a random 64bit transaction ID */
transaction_id = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK,
UINT64_MAX);