aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/exchange/exchange.conf2
-rw-r--r--src/exchange/taler-exchange-expire.c6
-rw-r--r--src/testing/test_exchange_p2p.c33
3 files changed, 35 insertions, 6 deletions
diff --git a/src/exchange/exchange.conf b/src/exchange/exchange.conf
index df136d9eb..58e57c82e 100644
--- a/src/exchange/exchange.conf
+++ b/src/exchange/exchange.conf
@@ -54,7 +54,7 @@ ROUTER_IDLE_SLEEP_INTERVAL = 60 s
# by taler-exchange-expire (in time). It may take
# this much time for an expired purse to be really
# cleaned up and the coins refunded.
-EXPIRE_SHARD_SIZE = 5 m
+EXPIRE_SHARD_SIZE = 1 h
# How long should the transfer tool
# sleep if it has nothing to do?
diff --git a/src/exchange/taler-exchange-expire.c b/src/exchange/taler-exchange-expire.c
index b5df64a77..d99c430e0 100644
--- a/src/exchange/taler-exchange-expire.c
+++ b/src/exchange/taler-exchange-expire.c
@@ -392,13 +392,13 @@ run_shard (void *cls)
GNUNET_SCHEDULER_shutdown ();
return;
}
- if (GNUNET_TIME_absolute_is_future (s->shard_start))
+ if (GNUNET_TIME_absolute_is_future (s->shard_end))
{
+ abort_shard (s);
GNUNET_assert (NULL == task);
- task = GNUNET_SCHEDULER_add_at (s->shard_start,
+ task = GNUNET_SCHEDULER_add_at (s->shard_end,
&run_shard,
NULL);
- abort_shard (s);
return;
}
/* If this is a first-time run, we immediately
diff --git a/src/testing/test_exchange_p2p.c b/src/testing/test_exchange_p2p.c
index ec3c660c4..a20649f4d 100644
--- a/src/testing/test_exchange_p2p.c
+++ b/src/testing/test_exchange_p2p.c
@@ -281,7 +281,7 @@ run (void *cls,
TALER_TESTING_cmd_purse_create_with_reserve (
"purse-create-with-reserve-expire",
MHD_HTTP_OK,
- "{\"amount\":\"EUR:1\",\"summary\":\"ice cream\"}",
+ "{\"amount\":\"EUR:2\",\"summary\":\"ice cream\"}",
true /* upload contract */,
GNUNET_TIME_relative_multiply (
GNUNET_TIME_UNIT_SECONDS,
@@ -312,6 +312,20 @@ run (void *cls,
"EUR:1",
true,
GNUNET_TIME_UNIT_MINUTES),
+ /* This should fail, as too much of the coin
+ is already spend / in a purse */
+ TALER_TESTING_cmd_purse_create_with_deposit (
+ "purse-with-deposit-overspending",
+ MHD_HTTP_CONFLICT,
+ "{\"amount\":\"EUR:2\",\"summary\":\"ice cream\"}",
+ true, /* upload contract */
+ GNUNET_TIME_relative_multiply (
+ GNUNET_TIME_UNIT_SECONDS,
+ 1), /* expiration */
+ "withdraw-coin-1",
+ "EUR:2.01",
+ NULL),
+
TALER_TESTING_cmd_sleep ("sleep",
2 /* seconds */),
TALER_TESTING_cmd_exec_expire ("exec-expire",
@@ -328,7 +342,22 @@ run (void *cls,
GNUNET_TIME_UNIT_SECONDS,
15),
"pull-poll-purse-before-expire"),
- // FIXME: check coin was refunded
+ /* coin was refunded, so now this should be OK */
+ /* This should fail, as too much of the coin
+ is already spend / in a purse */
+ TALER_TESTING_cmd_purse_create_with_deposit (
+ "purse-with-deposit-refunded",
+ MHD_HTTP_OK,
+ "{\"amount\":\"EUR:2\",\"summary\":\"ice cream\"}",
+ true, /* upload contract */
+ GNUNET_TIME_relative_multiply (
+ GNUNET_TIME_UNIT_SECONDS,
+ 1), /* expiration */
+ "withdraw-coin-1",
+ "EUR:2.01",
+ NULL),
+
+
// FIXME: check reserve purse capacity is back up!
TALER_TESTING_cmd_end ()
};