diff --git a/src/kademlia/routing_table.cpp b/src/kademlia/routing_table.cpp index c29904b68..fdbaef4ea 100644 --- a/src/kademlia/routing_table.cpp +++ b/src/kademlia/routing_table.cpp @@ -512,6 +512,12 @@ routing_table::add_node_status_t routing_table::add_node_impl(node_entry e) } return node_added; } + else if (existing->id.is_all_zeros()) + { + // this node's ID was unknown. remove the old entry and + // replace it with the node's real ID + remove_node(existing, existing_bucket); + } else if (!e.pinged()) { // this may be a routing table poison attack. If we haven't confirmed diff --git a/test/test_dht.cpp b/test/test_dht.cpp index a89d20a9f..e89168f31 100644 --- a/test/test_dht.cpp +++ b/test/test_dht.cpp @@ -1761,7 +1761,7 @@ void test_bootstrap(address(&rand_addr)()) || find_node_keys[2].string_value() == "get_peers"); if (find_node_keys[0].string_value() != "q" || (find_node_keys[2].string_value() != "find_node" - && find_node_keys[2].string_value() == "get_peers")) return; + && find_node_keys[2].string_value() != "get_peers")) return; } else {