Test the big lookahead_sign, plus notes.

This commit is contained in:
Marcello Stanisci 2019-04-06 20:17:41 +02:00
parent fdeb630160
commit 301f287b2b
No known key found for this signature in database
GPG Key ID: 8D526861953F4C0F
2 changed files with 66 additions and 23 deletions

View File

@ -439,12 +439,20 @@ get_anchor (const char *dir,
} }
else if (anchor->abs_value_us != now.abs_value_us) else if (anchor->abs_value_us != now.abs_value_us)
{ {
/* Real starting time is the last start time + duration - overlap */
/**
* XXX-ANCHOR question: why adding the duration only in this
* case, and not _all the times we found a anchor_ ? Like
* for instance out of this block below ?
*/
*anchor = GNUNET_TIME_absolute_add (*anchor, *anchor = GNUNET_TIME_absolute_add (*anchor,
duration); duration);
*anchor = GNUNET_TIME_absolute_subtract (*anchor, *anchor = GNUNET_TIME_absolute_subtract (*anchor,
overlap); overlap);
} }
/* anchor is now the stamp where we need to create a new key */ /* anchor is now the stamp where we need to create a new key */
} }
@ -838,7 +846,6 @@ exchange_keys_update_cointype (void *cls,
(GNUNET_TIME_absolute_get_difference (p.anchor, (GNUNET_TIME_absolute_get_difference (p.anchor,
lookahead_sign_stamp), lookahead_sign_stamp),
GNUNET_NO)); GNUNET_NO));
dkf = get_cointype_file (&p, dkf = get_cointype_file (&p,
p.anchor); p.anchor);
GNUNET_break (GNUNET_YES != GNUNET_break (GNUNET_YES !=

View File

@ -113,19 +113,25 @@ run (void *cls,
{ {
struct TALER_TESTING_Command keys_serialization[] = { struct TALER_TESTING_Command keys_serialization[] = {
TALER_TESTING_cmd_serialize_keys ("serialize-keys"), TALER_TESTING_cmd_serialize_keys
TALER_TESTING_cmd_connect_with_state ("reconnect-with-state", ("serialize-keys"),
"serialize-keys"),
TALER_TESTING_cmd_connect_with_state
("reconnect-with-state",
"serialize-keys"),
TALER_TESTING_cmd_wire
("verify-/wire-with-serialized-keys",
"x-taler-bank",
NULL,
MHD_HTTP_OK),
TALER_TESTING_cmd_wire ("verify-/wire-with-serialized-keys",
"x-taler-bank",
NULL,
MHD_HTTP_OK),
/** /**
* This loads a very big lookahead_sign (3500s). * This loads a very big lookahead_sign (3500s).
*/ */
TALER_TESTING_cmd_exec_keyup ("keyup-serialization", TALER_TESTING_cmd_exec_keyup
CONFIG_FILE_EXTENDED_2), ("keyup-serialization",
CONFIG_FILE_EXTENDED_2),
#if 0 #if 0
@ -166,10 +172,6 @@ run (void *cls,
now = GNUNET_TIME_absolute_get (); now = GNUNET_TIME_absolute_get ();
struct TALER_TESTING_Command ordinary_cherry_pick[] = { struct TALER_TESTING_Command ordinary_cherry_pick[] = {
/* Trigger keys reloading from disk. */
TALER_TESTING_cmd_signal ("signal-reaction-1",
is->exchanged,
SIGUSR1),
/** /**
* 1 DK with 80s withdraw duration, lookahead_sign is 60s * 1 DK with 80s withdraw duration, lookahead_sign is 60s
* => expect 1 DK. * => expect 1 DK.
@ -178,14 +180,20 @@ run (void *cls,
1, /* generation */ 1, /* generation */
1), 1),
/** /**
* This has a lookahead_sign == 60, and DK withdraw_time == 80 * The far-future now will cause "keyup" to start a fresh
* => one DK should be created. * key set. The new KS will have only one key, because the
* current lookahead_sign == 60 seconds and the key's withdraw
* duration is 80 seconds.
*/ */
TALER_TESTING_cmd_exec_keyup_with_now ("keyup-serialization", TALER_TESTING_cmd_exec_keyup_with_now
CONFIG_FILE, ("keyup-1",
TTH_parse_time (JAN2030)), CONFIG_FILE,
TTH_parse_time (JAN2030)),
/** /**
* Should return 1 key, + the original one = 2. * Should return 1 new key, + the original one. NOTE: the
* original DK will never be 'cancelled' as for the current
* libtalerexchange logic, so it must always be counted.
*/ */
TALER_TESTING_cmd_check_keys_with_now TALER_TESTING_cmd_check_keys_with_now
("check-keys-2", ("check-keys-2",
@ -193,14 +201,42 @@ run (void *cls,
2, 2,
TTH_parse_time (JAN2030)), TTH_parse_time (JAN2030)),
/**
* We now load a very high lookahead_sign value of 3500 s,
* with now == JAN2030.
*/
TALER_TESTING_cmd_exec_keyup_with_now
("keyup-3",
CONFIG_FILE_EXTENDED_2,
TTH_parse_time (JAN2030)),
/**
* For each DK with a withdraw duration of 80 s, and for
* the latest 3500 s lookahead_sign value, we should have
* ((3500 - _80_) / 80) keys we just downloaded + 2 old DK
* keys stored in memory (total 45). The _80_ seconds
* we subtract are from the one key generated at "keyup-1".
*
* This currently fails: look for XXX-ANCHOR at
* taler-exchange-keyup.c to get some insight about the reason
* behind.
*/
TALER_TESTING_cmd_check_keys_with_now
("check-keys-3",
3,
45,
TTH_parse_time (JAN2030)),
TALER_TESTING_cmd_end () TALER_TESTING_cmd_end ()
}; };
struct TALER_TESTING_Command commands[] = { struct TALER_TESTING_Command commands[] = {
TALER_TESTING_cmd_batch ("ordinary-cherry-pick", TALER_TESTING_cmd_batch ("ordinary-cherry-pick",
ordinary_cherry_pick), ordinary_cherry_pick),
/*TALER_TESTING_cmd_batch ("keys-serialization", /*
keys_serialization),*/ TALER_TESTING_cmd_batch ("keys-serialization",
keys_serialization),
*/
TALER_TESTING_cmd_end () TALER_TESTING_cmd_end ()
}; };