[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-exchange] branch master updated: add invariant checks for #6214
From: |
gnunet |
Subject: |
[taler-exchange] branch master updated: add invariant checks for #6214 |
Date: |
Thu, 23 Apr 2020 11:55:14 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository exchange.
The following commit(s) were added to refs/heads/master by this push:
new 727eccbe add invariant checks for #6214
727eccbe is described below
commit 727eccbe644aede46ef5eafc11964992960457e0
Author: Christian Grothoff <address@hidden>
AuthorDate: Thu Apr 23 11:55:10 2020 +0200
add invariant checks for #6214
---
src/exchangedb/exchangedb_transactions.c | 11 +++++++----
src/exchangedb/plugin_exchangedb_postgres.c | 7 +++++++
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/src/exchangedb/exchangedb_transactions.c
b/src/exchangedb/exchangedb_transactions.c
index 7fe65d52..93e4104e 100644
--- a/src/exchangedb/exchangedb_transactions.c
+++ b/src/exchangedb/exchangedb_transactions.c
@@ -41,12 +41,14 @@ TALER_EXCHANGEDB_calculate_transaction_list_totals (
struct TALER_Amount spent = *off;
struct TALER_Amount refunded;
struct TALER_Amount deposit_fee;
- int have_refund;
+ bool have_refund;
+ bool have_deposit;
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (spent.currency,
&refunded));
- have_refund = GNUNET_NO;
+ have_refund = false;
+ have_deposit = false;
for (struct TALER_EXCHANGEDB_TransactionList *pos = tl;
NULL != pos;
pos = pos->next)
@@ -55,6 +57,7 @@ TALER_EXCHANGEDB_calculate_transaction_list_totals (
{
case TALER_EXCHANGEDB_TT_DEPOSIT:
/* spent += pos->amount_with_fee */
+ have_deposit = true;
if (0 >
TALER_amount_add (&spent,
&spent,
@@ -94,7 +97,7 @@ TALER_EXCHANGEDB_calculate_transaction_list_totals (
GNUNET_break (0);
return GNUNET_SYSERR;
}
- have_refund = GNUNET_YES;
+ have_refund = true;
break;
case TALER_EXCHANGEDB_TT_OLD_COIN_RECOUP:
/* refunded += pos->value */
@@ -152,7 +155,7 @@ TALER_EXCHANGEDB_calculate_transaction_list_totals (
GNUNET_break (0);
return GNUNET_SYSERR;
}
-
+ GNUNET_break (have_deposit);
*ret = spent;
return GNUNET_OK;
}
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c
b/src/exchangedb/plugin_exchangedb_postgres.c
index 4f57f32f..e517d069 100644
--- a/src/exchangedb/plugin_exchangedb_postgres.c
+++ b/src/exchangedb/plugin_exchangedb_postgres.c
@@ -4004,6 +4004,11 @@ struct CoinHistoryContext
* Set to 'true' if the transaction failed.
*/
bool failed;
+
+ /**
+ * Set to 'true' if we found a deposit (for invariant check).
+ */
+ bool have_deposit;
};
@@ -4029,6 +4034,7 @@ add_coin_deposit (void *cls,
struct TALER_EXCHANGEDB_TransactionList *tl;
uint64_t serial_id;
+ chc->have_deposit = true;
deposit = GNUNET_new (struct TALER_EXCHANGEDB_DepositListEntry);
{
struct GNUNET_PQ_ResultSpec rs[] = {
@@ -4506,6 +4512,7 @@ postgres_get_coin_transactions (
*tlp = chc.head;
if (NULL == chc.head)
return GNUNET_DB_STATUS_SUCCESS_NO_RESULTS;
+ GNUNET_break (chc.have_deposit);
return GNUNET_DB_STATUS_SUCCESS_ONE_RESULT;
}
--
To stop receiving notification emails like this one, please contact
address@hidden.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-exchange] branch master updated: add invariant checks for #6214,
gnunet <=