@@ -185,11 +185,11 @@ struct TestNodeTable: public NodeTable
185185 return m_buckets[_bucket].nodes .back ().lock ();
186186 }
187187
188- boost::optional<NodeValidation> nodeValidation (NodeID const & _id )
188+ boost::optional<NodeValidation> nodeValidation (bi::udp::endpoint const & _endpoint )
189189 {
190190 promise<boost::optional<NodeValidation>> promise;
191- m_io.post ([this , &promise, _id ] {
192- auto validation = m_sentPings.find (_id );
191+ m_io.post ([this , &promise, _endpoint ] {
192+ auto validation = m_sentPings.find (_endpoint );
193193 if (validation != m_sentPings.end ())
194194 promise.set_value (validation->second );
195195 else
@@ -544,7 +544,7 @@ BOOST_AUTO_TEST_CASE(noteActiveNodeEvictsTheNodeWhenBucketIsFull)
544544 // least recently seen node not removed yet
545545 BOOST_CHECK_EQUAL (nodeTable->bucketFirstNode (bucketIndex), leastRecentlySeenNode);
546546 // but added to evictions
547- auto evicted = nodeTable->nodeValidation (leastRecentlySeenNode->id );
547+ auto evicted = nodeTable->nodeValidation (leastRecentlySeenNode->endpoint );
548548 BOOST_REQUIRE (evicted.is_initialized ());
549549 BOOST_REQUIRE (evicted->replacementNodeEntry );
550550 BOOST_CHECK_EQUAL (evicted->replacementNodeEntry ->id , newNodeId);
@@ -632,7 +632,7 @@ BOOST_AUTO_TEST_CASE(invalidPong)
632632 nodeTable->packetsReceived .pop ();
633633
634634 // pending node validation should still be not deleted
635- BOOST_REQUIRE (nodeTable->nodeValidation (nodePubKey ));
635+ BOOST_REQUIRE (nodeTable->nodeValidation (nodeEndpoint ));
636636 // node is not in the node table
637637 BOOST_REQUIRE (!nodeTable->nodeExists (nodePubKey));
638638}
@@ -684,7 +684,7 @@ BOOST_AUTO_TEST_CASE(pongWithChangedNodeID)
684684 nodeTable->setRequestTimeToLive (std::chrono::seconds (1 ));
685685
686686 // socket receiving PING
687- TestUDPSocketHost nodeSocketHost{getRandomPortNumber ()};
687+ TestUDPSocketHost nodeSocketHost{randomPortNumber ()};
688688 nodeSocketHost.start ();
689689 uint16_t nodePort = nodeSocketHost.port ;
690690
@@ -719,7 +719,7 @@ BOOST_AUTO_TEST_CASE(pongWithChangedNodeID)
719719 this_thread::sleep_for (std::chrono::seconds (6 ));
720720
721721 BOOST_CHECK (!nodeTable->nodeExists (nodePubKey));
722- auto sentPing = nodeTable->nodeValidation (nodePubKey );
722+ auto sentPing = nodeTable->nodeValidation (nodeEndpoint );
723723 BOOST_CHECK (!sentPing.is_initialized ());
724724}
725725
@@ -746,7 +746,7 @@ BOOST_AUTO_TEST_CASE(pingTimeout)
746746 this_thread::sleep_for (chrono::seconds (6 ));
747747
748748 BOOST_CHECK (!nodeTable->nodeExists (nodePubKey));
749- auto sentPing = nodeTable->nodeValidation (nodePubKey );
749+ auto sentPing = nodeTable->nodeValidation (nodeEndpoint );
750750 BOOST_CHECK (!sentPing.is_initialized ());
751751
752752 // handle received PING
@@ -765,7 +765,7 @@ BOOST_AUTO_TEST_CASE(pingTimeout)
765765 nodeTable->packetsReceived .pop ();
766766
767767 BOOST_CHECK (!nodeTable->nodeExists (nodePubKey));
768- sentPing = nodeTable->nodeValidation (nodePubKey );
768+ sentPing = nodeTable->nodeValidation (nodeEndpoint );
769769 BOOST_CHECK (!sentPing.is_initialized ());
770770}
771771
@@ -897,7 +897,7 @@ BOOST_AUTO_TEST_CASE(evictionWithOldNodeAnswering)
897897 // wait for eviction
898898 evictEvents.pop (chrono::seconds (5 ));
899899
900- auto evicted = nodeTable->nodeValidation (nodeId );
900+ auto evicted = nodeTable->nodeValidation (nodeEndpoint );
901901 BOOST_REQUIRE (evicted.is_initialized ());
902902
903903 // handle received PING
@@ -919,7 +919,7 @@ BOOST_AUTO_TEST_CASE(evictionWithOldNodeAnswering)
919919 BOOST_REQUIRE (nodeTable->nodeExists (nodeId));
920920 auto addedNode = nodeTable->nodeEntry (nodeId);
921921 BOOST_CHECK (addedNode->lastPongReceivedTime );
922- auto sentPing = nodeTable->nodeValidation (nodeId );
922+ auto sentPing = nodeTable->nodeValidation (nodeEndpoint );
923923 BOOST_CHECK (!sentPing.is_initialized ());
924924 // check that old node is most recently seen in the bucket
925925 BOOST_CHECK (nodeTable->bucketLastNode (bucketIndex)->id == nodeId);
@@ -938,7 +938,7 @@ BOOST_AUTO_TEST_CASE(evictionWithOldNodeDropped)
938938
939939 nodeTableHost.start ();
940940
941- auto oldNodeId = nodeTable->bucketFirstNode (bucketIndex)-> id ;
941+ auto oldNode = nodeTable->bucketFirstNode (bucketIndex);
942942
943943 // generate new address for the same bucket
944944 NodeID newNodeId;
@@ -958,8 +958,8 @@ BOOST_AUTO_TEST_CASE(evictionWithOldNodeDropped)
958958 this_thread::sleep_for (chrono::seconds (6 ));
959959
960960 // check that old node is evicted
961- BOOST_CHECK (!nodeTable->nodeExists (oldNodeId ));
962- BOOST_CHECK (!nodeTable->nodeValidation (oldNodeId ).is_initialized ());
961+ BOOST_CHECK (!nodeTable->nodeExists (oldNode-> id ));
962+ BOOST_CHECK (!nodeTable->nodeValidation (oldNode-> endpoint ).is_initialized ());
963963 // check that replacement node is active
964964 BOOST_CHECK (nodeTable->nodeExists (newNodeId));
965965 auto newNode = nodeTable->nodeEntry (newNodeId);
@@ -1019,12 +1019,12 @@ BOOST_AUTO_TEST_CASE(addSelf)
10191019 auto nodePubKey = KeyPair::create ().pub ();
10201020 Node node (nodePubKey, nodeEndpoint);
10211021 nodeTable->addNode (node);
1022- BOOST_CHECK (nodeTable->nodeValidation (nodePubKey ));
1022+ BOOST_CHECK (nodeTable->nodeValidation (nodeEndpoint ));
10231023
10241024 // Create self node and verify it isn't pinged
1025- Node self (nodeTableHost.m_alias .pub (), nodeEndpoint );
1025+ Node self (nodeTableHost.m_alias .pub (), nodeTable-> m_hostNodeEndpoint );
10261026 nodeTable->addNode (self);
1027- BOOST_CHECK (!nodeTable->nodeValidation (nodeTableHost. m_alias . pub () ));
1027+ BOOST_CHECK (!nodeTable->nodeValidation (nodeTable-> m_hostNodeEndpoint ));
10281028}
10291029
10301030BOOST_AUTO_TEST_CASE (findNodeIsSentAfterPong)
@@ -1156,15 +1156,15 @@ BOOST_AUTO_TEST_CASE(addNodePingsNodeOnlyOnce)
11561156 auto nodePubKey = KeyPair::create ().pub ();
11571157 nodeTable->addNode (Node{nodePubKey, nodeEndpoint});
11581158
1159- auto sentPing = nodeTable->nodeValidation (nodePubKey );
1159+ auto sentPing = nodeTable->nodeValidation (nodeEndpoint );
11601160 BOOST_REQUIRE (sentPing.is_initialized ());
11611161
11621162 this_thread::sleep_for (chrono::milliseconds (2000 ));
11631163
11641164 // add it for the second time
11651165 nodeTable->addNode (Node{nodePubKey, nodeEndpoint});
11661166
1167- auto sentPing2 = nodeTable->nodeValidation (nodePubKey );
1167+ auto sentPing2 = nodeTable->nodeValidation (nodeEndpoint );
11681168 BOOST_REQUIRE (sentPing2.is_initialized ());
11691169
11701170 // check that Ping was sent only once, so Ping hash didn't change
0 commit comments