minor code clean up, renaming for consistency
This commit is contained in:
parent
a3013d9e3d
commit
6cc516427b
@ -2297,7 +2297,7 @@ check_transaction_history_for_deposit (const struct
|
|||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case TALER_EXCHANGEDB_TT_REFRESH_MELT:
|
case TALER_EXCHANGEDB_TT_MELT:
|
||||||
amount_with_fee = &tl->details.melt->amount_with_fee;
|
amount_with_fee = &tl->details.melt->amount_with_fee;
|
||||||
fee = &tl->details.melt->melt_fee;
|
fee = &tl->details.melt->melt_fee;
|
||||||
fee_dki = &issue->fee_refresh;
|
fee_dki = &issue->fee_refresh;
|
||||||
|
@ -202,7 +202,7 @@ refund_transaction (void *cls,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case TALER_EXCHANGEDB_TT_REFRESH_MELT:
|
case TALER_EXCHANGEDB_TT_MELT:
|
||||||
/* Melts cannot be refunded, ignore here */
|
/* Melts cannot be refunded, ignore here */
|
||||||
break;
|
break;
|
||||||
case TALER_EXCHANGEDB_TT_REFUND:
|
case TALER_EXCHANGEDB_TT_REFUND:
|
||||||
|
@ -125,10 +125,10 @@ TEH_RESPONSE_compile_transaction_history (const struct
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TALER_EXCHANGEDB_TT_REFRESH_MELT:
|
case TALER_EXCHANGEDB_TT_MELT:
|
||||||
{
|
{
|
||||||
struct TALER_RefreshMeltCoinAffirmationPS ms;
|
struct TALER_RefreshMeltCoinAffirmationPS ms;
|
||||||
const struct TALER_EXCHANGEDB_RefreshMeltListEntry *melt =
|
const struct TALER_EXCHANGEDB_MeltListEntry *melt =
|
||||||
pos->details.melt;
|
pos->details.melt;
|
||||||
|
|
||||||
ms.purpose.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_MELT);
|
ms.purpose.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_MELT);
|
||||||
|
@ -63,7 +63,7 @@ TALER_EXCHANGEDB_calculate_transaction_list_totals (struct
|
|||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case TALER_EXCHANGEDB_TT_REFRESH_MELT:
|
case TALER_EXCHANGEDB_TT_MELT:
|
||||||
/* spent += pos->amount_with_fee */
|
/* spent += pos->amount_with_fee */
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
TALER_amount_add (&spent,
|
TALER_amount_add (&spent,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
This file is part of TALER
|
This file is part of TALER
|
||||||
Copyright (C) 2015, 2016 Taler Systems SA
|
Copyright (C) 2015, 2016, 2020 Taler Systems SA
|
||||||
|
|
||||||
TALER is free software; you can redistribute it and/or modify it under the
|
TALER is free software; you can redistribute it and/or modify it under the
|
||||||
terms of the GNU General Public License as published by the Free Software
|
terms of the GNU General Public License as published by the Free Software
|
||||||
@ -30,42 +30,56 @@ static void
|
|||||||
common_free_reserve_history (void *cls,
|
common_free_reserve_history (void *cls,
|
||||||
struct TALER_EXCHANGEDB_ReserveHistory *rh)
|
struct TALER_EXCHANGEDB_ReserveHistory *rh)
|
||||||
{
|
{
|
||||||
struct TALER_EXCHANGEDB_BankTransfer *bt;
|
|
||||||
struct TALER_EXCHANGEDB_CollectableBlindcoin *cbc;
|
|
||||||
struct TALER_EXCHANGEDB_Recoup *recoup;
|
|
||||||
struct TALER_EXCHANGEDB_ReserveHistory *backref;
|
|
||||||
struct TALER_EXCHANGEDB_ClosingTransfer *closing;
|
|
||||||
|
|
||||||
(void) cls;
|
(void) cls;
|
||||||
while (NULL != rh)
|
while (NULL != rh)
|
||||||
{
|
{
|
||||||
switch (rh->type)
|
switch (rh->type)
|
||||||
{
|
{
|
||||||
case TALER_EXCHANGEDB_RO_BANK_TO_EXCHANGE:
|
case TALER_EXCHANGEDB_RO_BANK_TO_EXCHANGE:
|
||||||
bt = rh->details.bank;
|
{
|
||||||
GNUNET_free_non_null (bt->sender_account_details);
|
struct TALER_EXCHANGEDB_BankTransfer *bt;
|
||||||
GNUNET_free_non_null (bt->wire_reference);
|
|
||||||
GNUNET_free (bt);
|
bt = rh->details.bank;
|
||||||
break;
|
GNUNET_free_non_null (bt->sender_account_details);
|
||||||
|
GNUNET_free_non_null (bt->wire_reference);
|
||||||
|
GNUNET_free (bt);
|
||||||
|
break;
|
||||||
|
}
|
||||||
case TALER_EXCHANGEDB_RO_WITHDRAW_COIN:
|
case TALER_EXCHANGEDB_RO_WITHDRAW_COIN:
|
||||||
cbc = rh->details.withdraw;
|
{
|
||||||
GNUNET_CRYPTO_rsa_signature_free (cbc->sig.rsa_signature);
|
struct TALER_EXCHANGEDB_CollectableBlindcoin *cbc;
|
||||||
GNUNET_free (cbc);
|
|
||||||
break;
|
cbc = rh->details.withdraw;
|
||||||
|
GNUNET_CRYPTO_rsa_signature_free (cbc->sig.rsa_signature);
|
||||||
|
GNUNET_free (cbc);
|
||||||
|
break;
|
||||||
|
}
|
||||||
case TALER_EXCHANGEDB_RO_RECOUP_COIN:
|
case TALER_EXCHANGEDB_RO_RECOUP_COIN:
|
||||||
recoup = rh->details.recoup;
|
{
|
||||||
GNUNET_CRYPTO_rsa_signature_free (recoup->coin.denom_sig.rsa_signature);
|
struct TALER_EXCHANGEDB_Recoup *recoup;
|
||||||
GNUNET_free (recoup);
|
|
||||||
break;
|
recoup = rh->details.recoup;
|
||||||
|
GNUNET_CRYPTO_rsa_signature_free (recoup->coin.denom_sig.rsa_signature);
|
||||||
|
GNUNET_free (recoup);
|
||||||
|
break;
|
||||||
|
}
|
||||||
case TALER_EXCHANGEDB_RO_EXCHANGE_TO_BANK:
|
case TALER_EXCHANGEDB_RO_EXCHANGE_TO_BANK:
|
||||||
closing = rh->details.closing;
|
{
|
||||||
GNUNET_free_non_null (closing->receiver_account_details);
|
struct TALER_EXCHANGEDB_ClosingTransfer *closing;
|
||||||
GNUNET_free (closing);
|
|
||||||
break;
|
closing = rh->details.closing;
|
||||||
|
GNUNET_free_non_null (closing->receiver_account_details);
|
||||||
|
GNUNET_free (closing);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
struct TALER_EXCHANGEDB_ReserveHistory *next;
|
||||||
|
|
||||||
|
next = rh->next;
|
||||||
|
GNUNET_free (rh);
|
||||||
|
rh = next;
|
||||||
}
|
}
|
||||||
backref = rh;
|
|
||||||
rh = rh->next;
|
|
||||||
GNUNET_free (backref);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,50 +88,64 @@ common_free_reserve_history (void *cls,
|
|||||||
* Free linked list of transactions.
|
* Free linked list of transactions.
|
||||||
*
|
*
|
||||||
* @param cls the @e cls of this struct with the plugin-specific state (unused)
|
* @param cls the @e cls of this struct with the plugin-specific state (unused)
|
||||||
* @param list list to free
|
* @param tl list to free
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
common_free_coin_transaction_list (void *cls,
|
common_free_coin_transaction_list (void *cls,
|
||||||
struct TALER_EXCHANGEDB_TransactionList *list)
|
struct TALER_EXCHANGEDB_TransactionList *tl)
|
||||||
{
|
{
|
||||||
struct TALER_EXCHANGEDB_TransactionList *next;
|
|
||||||
|
|
||||||
(void) cls;
|
(void) cls;
|
||||||
while (NULL != list)
|
while (NULL != tl)
|
||||||
{
|
{
|
||||||
next = list->next;
|
switch (tl->type)
|
||||||
|
|
||||||
switch (list->type)
|
|
||||||
{
|
{
|
||||||
case TALER_EXCHANGEDB_TT_DEPOSIT:
|
case TALER_EXCHANGEDB_TT_DEPOSIT:
|
||||||
if (NULL != list->details.deposit->receiver_wire_account)
|
{
|
||||||
json_decref (list->details.deposit->receiver_wire_account);
|
struct TALER_EXCHANGEDB_DepositListEntry *deposit;
|
||||||
GNUNET_free (list->details.deposit);
|
|
||||||
break;
|
deposit = tl->details.deposit;
|
||||||
case TALER_EXCHANGEDB_TT_REFRESH_MELT:
|
if (NULL != deposit->receiver_wire_account)
|
||||||
GNUNET_free (list->details.melt);
|
json_decref (deposit->receiver_wire_account);
|
||||||
|
GNUNET_free (deposit);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case TALER_EXCHANGEDB_TT_MELT:
|
||||||
|
GNUNET_free (tl->details.melt);
|
||||||
break;
|
break;
|
||||||
case TALER_EXCHANGEDB_TT_OLD_COIN_RECOUP:
|
case TALER_EXCHANGEDB_TT_OLD_COIN_RECOUP:
|
||||||
if (NULL != list->details.recoup_refresh->coin.denom_sig.rsa_signature)
|
{
|
||||||
GNUNET_CRYPTO_rsa_signature_free (
|
struct TALER_EXCHANGEDB_RecoupRefreshListEntry *rr;
|
||||||
list->details.recoup_refresh->coin.denom_sig.rsa_signature);
|
|
||||||
GNUNET_free (list->details.old_coin_recoup);
|
rr = tl->details.old_coin_recoup;
|
||||||
break;
|
if (NULL != rr->coin.denom_sig.rsa_signature)
|
||||||
|
GNUNET_CRYPTO_rsa_signature_free (rr->coin.denom_sig.rsa_signature);
|
||||||
|
GNUNET_free (rr);
|
||||||
|
break;
|
||||||
|
}
|
||||||
case TALER_EXCHANGEDB_TT_REFUND:
|
case TALER_EXCHANGEDB_TT_REFUND:
|
||||||
GNUNET_free (list->details.refund);
|
GNUNET_free (tl->details.refund);
|
||||||
break;
|
break;
|
||||||
case TALER_EXCHANGEDB_TT_RECOUP:
|
case TALER_EXCHANGEDB_TT_RECOUP:
|
||||||
GNUNET_free (list->details.recoup);
|
GNUNET_free (tl->details.recoup);
|
||||||
break;
|
break;
|
||||||
case TALER_EXCHANGEDB_TT_RECOUP_REFRESH:
|
case TALER_EXCHANGEDB_TT_RECOUP_REFRESH:
|
||||||
if (NULL != list->details.recoup_refresh->coin.denom_sig.rsa_signature)
|
{
|
||||||
GNUNET_CRYPTO_rsa_signature_free (
|
struct TALER_EXCHANGEDB_RecoupRefreshListEntry *rr;
|
||||||
list->details.recoup_refresh->coin.denom_sig.rsa_signature);
|
|
||||||
GNUNET_free (list->details.recoup_refresh);
|
rr = tl->recoup_refresh;
|
||||||
break;
|
if (NULL != rr->coin.denom_sig.rsa_signature)
|
||||||
|
GNUNET_CRYPTO_rsa_signature_free (rr->coin.denom_sig.rsa_signature);
|
||||||
|
GNUNET_free (rr);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
struct TALER_EXCHANGEDB_TransactionList *next;
|
||||||
|
|
||||||
|
next = tl->next;
|
||||||
|
GNUNET_free (list);
|
||||||
|
tl = next;
|
||||||
}
|
}
|
||||||
GNUNET_free (list);
|
|
||||||
list = next;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4085,11 +4085,11 @@ add_coin_melt (void *cls,
|
|||||||
|
|
||||||
for (unsigned int i = 0; i<num_results; i++)
|
for (unsigned int i = 0; i<num_results; i++)
|
||||||
{
|
{
|
||||||
struct TALER_EXCHANGEDB_RefreshMeltListEntry *melt;
|
struct TALER_EXCHANGEDB_MeltListEntry *melt;
|
||||||
struct TALER_EXCHANGEDB_TransactionList *tl;
|
struct TALER_EXCHANGEDB_TransactionList *tl;
|
||||||
uint64_t serial_id;
|
uint64_t serial_id;
|
||||||
|
|
||||||
melt = GNUNET_new (struct TALER_EXCHANGEDB_RefreshMeltListEntry);
|
melt = GNUNET_new (struct TALER_EXCHANGEDB_MeltListEntry);
|
||||||
{
|
{
|
||||||
struct GNUNET_PQ_ResultSpec rs[] = {
|
struct GNUNET_PQ_ResultSpec rs[] = {
|
||||||
GNUNET_PQ_result_spec_auto_from_type ("rc",
|
GNUNET_PQ_result_spec_auto_from_type ("rc",
|
||||||
@ -4119,7 +4119,7 @@ add_coin_melt (void *cls,
|
|||||||
}
|
}
|
||||||
tl = GNUNET_new (struct TALER_EXCHANGEDB_TransactionList);
|
tl = GNUNET_new (struct TALER_EXCHANGEDB_TransactionList);
|
||||||
tl->next = chc->head;
|
tl->next = chc->head;
|
||||||
tl->type = TALER_EXCHANGEDB_TT_REFRESH_MELT;
|
tl->type = TALER_EXCHANGEDB_TT_MELT;
|
||||||
tl->details.melt = melt;
|
tl->details.melt = melt;
|
||||||
tl->serial_id = serial_id;
|
tl->serial_id = serial_id;
|
||||||
chc->head = tl;
|
chc->head = tl;
|
||||||
@ -4426,7 +4426,7 @@ postgres_get_coin_transactions (void *cls,
|
|||||||
/** #TALER_EXCHANGEDB_TT_DEPOSIT */
|
/** #TALER_EXCHANGEDB_TT_DEPOSIT */
|
||||||
{ "get_deposit_with_coin_pub",
|
{ "get_deposit_with_coin_pub",
|
||||||
&add_coin_deposit },
|
&add_coin_deposit },
|
||||||
/** #TALER_EXCHANGEDB_TT_REFRESH_MELT */
|
/** #TALER_EXCHANGEDB_TT_MELT */
|
||||||
{ "get_refresh_session_by_coin",
|
{ "get_refresh_session_by_coin",
|
||||||
&add_coin_melt },
|
&add_coin_melt },
|
||||||
/** #TALER_EXCHANGEDB_TT_REFUND */
|
/** #TALER_EXCHANGEDB_TT_REFUND */
|
||||||
@ -4438,7 +4438,7 @@ postgres_get_coin_transactions (void *cls,
|
|||||||
/** #TALER_EXCHANGEDB_TT_DEPOSIT */
|
/** #TALER_EXCHANGEDB_TT_DEPOSIT */
|
||||||
{ "get_deposit_with_coin_pub",
|
{ "get_deposit_with_coin_pub",
|
||||||
&add_coin_deposit },
|
&add_coin_deposit },
|
||||||
/** #TALER_EXCHANGEDB_TT_REFRESH_MELT */
|
/** #TALER_EXCHANGEDB_TT_MELT */
|
||||||
{ "get_refresh_session_by_coin",
|
{ "get_refresh_session_by_coin",
|
||||||
&add_coin_melt },
|
&add_coin_melt },
|
||||||
/** #TALER_EXCHANGEDB_TT_REFUND */
|
/** #TALER_EXCHANGEDB_TT_REFUND */
|
||||||
|
@ -2067,7 +2067,7 @@ run (void *cls)
|
|||||||
}
|
}
|
||||||
#if 0
|
#if 0
|
||||||
/* this coin pub was actually never melted... */
|
/* this coin pub was actually never melted... */
|
||||||
case TALER_EXCHANGEDB_TT_REFRESH_MELT:
|
case TALER_EXCHANGEDB_TT_MELT:
|
||||||
FAILIF (0 != memcmp (&melt,
|
FAILIF (0 != memcmp (&melt,
|
||||||
&tlp->details.melt,
|
&tlp->details.melt,
|
||||||
sizeof (struct TALER_EXCHANGEDB_RefreshMelt)));
|
sizeof (struct TALER_EXCHANGEDB_RefreshMelt)));
|
||||||
|
@ -766,9 +766,9 @@ struct TALER_EXCHANGEDB_RefreshSession
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Information about a /refresh/melt operation in a coin transaction history.
|
* Information about a /coins/$COIN_PUB/melt operation in a coin transaction history.
|
||||||
*/
|
*/
|
||||||
struct TALER_EXCHANGEDB_RefreshMeltListEntry
|
struct TALER_EXCHANGEDB_MeltListEntry
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -867,7 +867,7 @@ enum TALER_EXCHANGEDB_TransactionType
|
|||||||
/**
|
/**
|
||||||
* /refresh/melt operation.
|
* /refresh/melt operation.
|
||||||
*/
|
*/
|
||||||
TALER_EXCHANGEDB_TT_REFRESH_MELT = 1,
|
TALER_EXCHANGEDB_TT_MELT = 1,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* /refund operation.
|
* /refund operation.
|
||||||
@ -927,9 +927,9 @@ struct TALER_EXCHANGEDB_TransactionList
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Details if transaction was a /refresh/melt operation.
|
* Details if transaction was a /refresh/melt operation.
|
||||||
* (#TALER_EXCHANGEDB_TT_REFRESH_MELT)
|
* (#TALER_EXCHANGEDB_TT_MELT)
|
||||||
*/
|
*/
|
||||||
struct TALER_EXCHANGEDB_RefreshMeltListEntry *melt;
|
struct TALER_EXCHANGEDB_MeltListEntry *melt;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Details if transaction was a /refund operation.
|
* Details if transaction was a /refund operation.
|
||||||
|
Loading…
Reference in New Issue
Block a user