initialize start_number in fakebank

This commit is contained in:
Christian Grothoff 2019-02-15 12:41:26 +01:00
parent c8b05da9b1
commit 1ce69e6b2f
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
3 changed files with 10 additions and 32 deletions

View File

@ -154,7 +154,7 @@ struct TALER_FAKEBANK_Handle
* Boxed @e mhd_fd. * Boxed @e mhd_fd.
*/ */
struct GNUNET_NETWORK_Handle *mhd_rfd; struct GNUNET_NETWORK_Handle *mhd_rfd;
/** /**
* File descriptor to use to wait for MHD. * File descriptor to use to wait for MHD.
*/ */
@ -730,6 +730,7 @@ handle_history (struct TALER_FAKEBANK_Handle *h,
GNUNET_break (0); GNUNET_break (0);
return MHD_NO; return MHD_NO;
} }
start_number = 0;
if ( (1 != sscanf (delta, if ( (1 != sscanf (delta,
"%lld", "%lld",
&count)) || &count)) ||
@ -880,7 +881,7 @@ handle_history (struct TALER_FAKEBANK_Handle *h,
"wt_subject", subject); "wt_subject", subject);
GNUNET_assert (NULL != trans); GNUNET_assert (NULL != trans);
GNUNET_free (subject); GNUNET_free (subject);
history_element = GNUNET_new (struct HistoryElement); history_element = GNUNET_new (struct HistoryElement);
history_element->element = trans; history_element->element = trans;

View File

@ -73,46 +73,37 @@ static void
run (void *cls, run (void *cls,
struct TALER_TESTING_Interpreter *is) struct TALER_TESTING_Interpreter *is)
{ {
struct TALER_TESTING_Command keys_serialization[] = { struct TALER_TESTING_Command keys_serialization[] = {
/** /**
* Serialize keys, and disconnect from the exchange. * Serialize keys, and disconnect from the exchange.
*/ */
TALER_TESTING_cmd_serialize_keys ("serialize-keys"), TALER_TESTING_cmd_serialize_keys ("serialize-keys"),
/** /**
* Reconnect to the exchange using the serialized keys. * Reconnect to the exchange using the serialized keys.
*/ */
TALER_TESTING_cmd_connect_with_state ("reconnect-with-state", TALER_TESTING_cmd_connect_with_state ("reconnect-with-state",
"serialize-keys"), "serialize-keys"),
TALER_TESTING_cmd_wire ("verify-/wire-with-serialized-keys", TALER_TESTING_cmd_wire ("verify-/wire-with-serialized-keys",
"x-taler-bank", "x-taler-bank",
NULL, NULL,
MHD_HTTP_OK), MHD_HTTP_OK),
TALER_TESTING_cmd_exec_keyup ("keyup-serialization", TALER_TESTING_cmd_exec_keyup ("keyup-serialization",
CONFIG_FILE_EXTENDED_2), CONFIG_FILE_EXTENDED_2),
TALER_TESTING_cmd_exec_auditor_sign TALER_TESTING_cmd_exec_auditor_sign
("auditor-sign-serialization", ("auditor-sign-serialization",
CONFIG_FILE_EXTENDED_2), CONFIG_FILE_EXTENDED_2),
TALER_TESTING_cmd_sleep ("sleep-serialization", TALER_TESTING_cmd_sleep ("sleep-serialization",
3), 3),
TALER_TESTING_cmd_signal ("reload-keys-serialization", TALER_TESTING_cmd_signal ("reload-keys-serialization",
is->exchanged, is->exchanged,
SIGUSR1), SIGUSR1),
TALER_TESTING_cmd_sleep ("sleep-serialization", TALER_TESTING_cmd_sleep ("sleep-serialization",
3), 3),
/** /**
* Why keys number decrease? * Why keys number decrease?
*/ */
TALER_TESTING_cmd_check_keys ("check-freshest-keys", TALER_TESTING_cmd_check_keys ("check-freshest-keys",
8, 9, /* generation */
10), 10),
TALER_TESTING_cmd_wire ("verify-/wire-with-fresh-keys", TALER_TESTING_cmd_wire ("verify-/wire-with-fresh-keys",
@ -125,64 +116,49 @@ run (void *cls,
}; };
struct TALER_TESTING_Command ordinary_cherry_pick[] = { struct TALER_TESTING_Command ordinary_cherry_pick[] = {
/* Trigger keys reloading from disk. */ /* Trigger keys reloading from disk. */
TALER_TESTING_cmd_signal ("signal-reaction-1", TALER_TESTING_cmd_signal ("signal-reaction-1",
is->exchanged, is->exchanged,
SIGUSR1), SIGUSR1),
TALER_TESTING_cmd_check_keys ("check-keys-1", TALER_TESTING_cmd_check_keys ("check-keys-1",
1, 1, /* generation */
4), 4),
/* sleep a bit */ /* sleep a bit */
TALER_TESTING_cmd_sleep ("sleep", TALER_TESTING_cmd_sleep ("sleep",
10), 10),
/* 1st keyup happens at start-up */ /* 1st keyup happens at start-up */
TALER_TESTING_cmd_exec_keyup ("keyup-2", TALER_TESTING_cmd_exec_keyup ("keyup-2",
CONFIG_FILE_EXTENDED), CONFIG_FILE_EXTENDED),
TALER_TESTING_cmd_exec_auditor_sign ("sign-keys-1", TALER_TESTING_cmd_exec_auditor_sign ("sign-keys-1",
CONFIG_FILE_EXTENDED), CONFIG_FILE_EXTENDED),
/* Cause exchange to reload (new) keys */ /* Cause exchange to reload (new) keys */
TALER_TESTING_cmd_signal ("trigger-keys-reload-1", TALER_TESTING_cmd_signal ("trigger-keys-reload-1",
is->exchanged, is->exchanged,
SIGUSR1), SIGUSR1),
TALER_TESTING_cmd_check_keys ("check-keys-2", TALER_TESTING_cmd_check_keys ("check-keys-2",
2, 2, /* generation */
6), 6),
/* sleep a bit */ /* sleep a bit */
TALER_TESTING_cmd_sleep ("sleep", TALER_TESTING_cmd_sleep ("sleep",
20), 20),
/* Do 2nd keyup */ /* Do 2nd keyup */
TALER_TESTING_cmd_exec_keyup ("keyup-3", TALER_TESTING_cmd_exec_keyup ("keyup-3",
CONFIG_FILE_EXTENDED), CONFIG_FILE_EXTENDED),
TALER_TESTING_cmd_exec_auditor_sign ("sign-keys-2", TALER_TESTING_cmd_exec_auditor_sign ("sign-keys-2",
CONFIG_FILE), CONFIG_FILE),
TALER_TESTING_cmd_signal ("trigger-keys-reload-2", TALER_TESTING_cmd_signal ("trigger-keys-reload-2",
is->exchanged, is->exchanged,
SIGUSR1), SIGUSR1),
TALER_TESTING_cmd_check_keys ("check-keys-3", TALER_TESTING_cmd_check_keys ("check-keys-3",
3, 3, /* generation */
8), 8),
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", TALER_TESTING_cmd_batch ("keys-serialization",
keys_serialization), keys_serialization),
TALER_TESTING_cmd_end () TALER_TESTING_cmd_end ()
}; };

View File

@ -625,8 +625,9 @@ TALER_TESTING_cert_cb
else else
{ {
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Got %d DK from /keys\n", "Got %d DK from /keys in generation %u\n",
keys->num_denom_keys); keys->num_denom_keys,
is->key_generation + 1);
} }
is->key_generation++; is->key_generation++;
is->keys = keys; is->keys = keys;