summaryrefslogtreecommitdiff
path: root/src/exchangedb/test_exchangedb.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-03-14 19:45:43 +0100
committerChristian Grothoff <christian@grothoff.org>2020-03-14 19:45:43 +0100
commit6aca928cf89bbd3ddc9384d773415dbb04f0659f (patch)
treeaa5e874c07cbd8802576f87dfcdfeead1dc4ca64 /src/exchangedb/test_exchangedb.c
parentd9c3627bc53fe68184d93dce8df6fbdbe3910827 (diff)
downloadexchange-6aca928cf89bbd3ddc9384d773415dbb04f0659f.tar.gz
exchange-6aca928cf89bbd3ddc9384d773415dbb04f0659f.tar.bz2
exchange-6aca928cf89bbd3ddc9384d773415dbb04f0659f.zip
expand DB test to cover #6124 better (passed immediately, does not explain the failure)
Diffstat (limited to 'src/exchangedb/test_exchangedb.c')
-rw-r--r--src/exchangedb/test_exchangedb.c43
1 files changed, 33 insertions, 10 deletions
diff --git a/src/exchangedb/test_exchangedb.c b/src/exchangedb/test_exchangedb.c
index 3520ff24..e9b47942 100644
--- a/src/exchangedb/test_exchangedb.c
+++ b/src/exchangedb/test_exchangedb.c
@@ -1656,16 +1656,39 @@ run (void *cls)
plugin->ensure_coin_known (plugin->cls,
session,
&deposit.coin));
- FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
- plugin->insert_recoup_request (plugin->cls,
- session,
- &reserve_pub,
- &deposit.coin,
- &coin_sig,
- &coin_blind,
- &value,
- &cbc.h_coin_envelope,
- deadline));
+ {
+ struct TALER_EXCHANGEDB_Reserve pre_reserve;
+ struct TALER_EXCHANGEDB_Reserve post_reserve;
+ struct TALER_Amount delta;
+
+ pre_reserve.pub = reserve_pub;
+ FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
+ plugin->reserves_get (plugin->cls,
+ session,
+ &pre_reserve));
+ FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
+ plugin->insert_recoup_request (plugin->cls,
+ session,
+ &reserve_pub,
+ &deposit.coin,
+ &coin_sig,
+ &coin_blind,
+ &value,
+ &cbc.h_coin_envelope,
+ deadline));
+ post_reserve.pub = reserve_pub;
+ FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
+ plugin->reserves_get (plugin->cls,
+ session,
+ &post_reserve));
+ FAILIF (GNUNET_OK !=
+ TALER_amount_subtract (&delta,
+ &post_reserve.balance,
+ &pre_reserve.balance));
+ FAILIF (0 !=
+ TALER_amount_cmp (&delta,
+ &value));
+ }
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
plugin->select_recoup_above_serial_id (plugin->cls,
session,