diff options
author | Christian Grothoff <grothoff@gnunet.org> | 2022-03-12 04:29:16 +0100 |
---|---|---|
committer | Christian Grothoff <grothoff@gnunet.org> | 2022-03-12 04:29:16 +0100 |
commit | f818a3feb7b354ad1dd2bc7abd903d710cc83f11 (patch) | |
tree | a8cc34eaf50477999a5e5fe29a2c6ddbf87fb368 /src | |
parent | ff992f47e6528b00937c3951b812f6938e1ee21a (diff) |
only hash over PID, not full HELLO URL when checking for duplicate HELLO blocks
Diffstat (limited to 'src')
-rw-r--r-- | src/dht/plugin_block_dht.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/dht/plugin_block_dht.c b/src/dht/plugin_block_dht.c index 9ff67fa4e..5b6841a98 100644 --- a/src/dht/plugin_block_dht.c +++ b/src/dht/plugin_block_dht.c @@ -254,14 +254,23 @@ block_plugin_dht_check_reply ( } case GNUNET_BLOCK_TYPE_DHT_URL_HELLO: { - struct GNUNET_HashCode phash; + struct GNUNET_HELLO_Builder *b; + struct GNUNET_PeerIdentity pid; + struct GNUNET_HashCode h_pid; - GNUNET_CRYPTO_hash (reply_block, - reply_block_size, - &phash); + b = GNUNET_HELLO_builder_from_block (reply_block, + reply_block_size); + GNUNET_assert (NULL != b); + GNUNET_HELLO_builder_iterate (b, + &pid, + NULL, NULL); + GNUNET_CRYPTO_hash (&pid, + sizeof (pid), + &h_pid); + GNUNET_HELLO_builder_free (b); if (GNUNET_YES == GNUNET_BLOCK_GROUP_bf_test_and_set (group, - &phash)) + &h_pid)) return GNUNET_BLOCK_REPLY_OK_DUPLICATE; return GNUNET_BLOCK_REPLY_OK_MORE; } |