psycstore: add option to perform membership test when retrieving fragment or message
[oweals/gnunet.git] / src / psycstore / test_plugin_psycstore.c
index 77a4186bf7a4911721cd05c27b4a71637ae38b7f..8267ddba850388222d636fe23183828fb9638c27 100644 (file)
@@ -50,11 +50,11 @@ static int ok;
  */
 static const char *plugin_name;
 
-static struct GNUNET_CRYPTO_EccPrivateKey *channel_key;
-static struct GNUNET_CRYPTO_EccPrivateKey *slave_key;
+static struct GNUNET_CRYPTO_EddsaPrivateKey *channel_key;
+static struct GNUNET_CRYPTO_EcdsaPrivateKey *slave_key;
 
-static struct GNUNET_CRYPTO_EccPublicSignKey channel_pub_key;
-static struct GNUNET_CRYPTO_EccPublicSignKey slave_pub_key;
+static struct GNUNET_CRYPTO_EddsaPublicKey channel_pub_key;
+static struct GNUNET_CRYPTO_EcdsaPublicKey slave_pub_key;
 
 /**
  * Function called when the service shuts down.  Unloads our psycstore
@@ -174,12 +174,12 @@ run (void *cls, char *const *args, const char *cfgfile,
 
   /* Store & test membership */
 
-  channel_key = GNUNET_CRYPTO_ecc_key_create ();
-  slave_key = GNUNET_CRYPTO_ecc_key_create ();
+  channel_key = GNUNET_CRYPTO_eddsa_key_create ();
+  slave_key = GNUNET_CRYPTO_ecdsa_key_create ();
 
-  GNUNET_CRYPTO_ecc_key_get_public_for_signature (channel_key,
+  GNUNET_CRYPTO_eddsa_key_get_public (channel_key,
                                                   &channel_pub_key);
-  GNUNET_CRYPTO_ecc_key_get_public_for_signature (slave_key, &slave_pub_key);
+  GNUNET_CRYPTO_ecdsa_key_get_public (slave_key, &slave_pub_key);
 
   GNUNET_assert (GNUNET_OK == db->membership_store (db->cls, &channel_pub_key,
                                                     &slave_pub_key, GNUNET_YES,
@@ -218,7 +218,7 @@ run (void *cls, char *const *args, const char *cfgfile,
                              - sizeof (msg->hop_counter)
                              - sizeof (msg->signature));
   msg->purpose.purpose = htonl (234);
-  GNUNET_CRYPTO_ecc_sign (slave_key, &msg->purpose, &msg->signature);
+  GNUNET_CRYPTO_eddsa_sign (channel_key, &msg->purpose, &msg->signature);
 
   struct FragmentClosure fcls = { 0 };
   fcls.n = 0;
@@ -276,13 +276,13 @@ run (void *cls, char *const *args, const char *cfgfile,
                                                &retfrags, fragment_cb, &fcls));
   GNUNET_assert (fcls.n == 2 && retfrags == 2);
 
-  /* Master counters */
+  /* Message counters */
 
   uint64_t fragment_id = 0, message_id = 0, group_generation = 0;
   GNUNET_assert (
-    GNUNET_OK == db->counters_get_master (db->cls, &channel_pub_key,
-                                          &fragment_id, &message_id,
-                                          &group_generation)
+    GNUNET_OK == db->counters_message_get (db->cls, &channel_pub_key,
+                                           &fragment_id, &message_id,
+                                           &group_generation)
     && fragment_id == GNUNET_ntohll (msg1->fragment_id)
     && message_id == GNUNET_ntohll (msg1->message_id)
     && group_generation == GNUNET_ntohll (msg1->group_generation));
@@ -334,12 +334,12 @@ run (void *cls, char *const *args, const char *cfgfile,
                                                      state_cb, &scls));
   GNUNET_assert (scls.n == 2);
 
-  /* Slave counters */
+  /* State counters */
 
   uint64_t max_state_msg_id = 0;
-  GNUNET_assert (GNUNET_OK == db->counters_get_slave (db->cls, &channel_pub_key,
-                                               &max_state_msg_id)
-          && max_state_msg_id == message_id);
+  GNUNET_assert (GNUNET_OK == db->counters_state_get (db->cls, &channel_pub_key,
+                                                      &max_state_msg_id)
+                 && max_state_msg_id == message_id);
 
   /* State sync */