diff --git a/nano/core_test/peer_history.cpp b/nano/core_test/peer_history.cpp index e09dc69f6..7dd939791 100644 --- a/nano/core_test/peer_history.cpp +++ b/nano/core_test/peer_history.cpp @@ -26,8 +26,11 @@ TEST (peer_history, erase_old) { nano::test::system system; - auto & node1 = *system.add_node (); - auto & node2 = *system.add_node (); + auto node_config = system.default_config (); + node_config.peer_history.erase_cutoff = 1s; + + auto & node1 = *system.add_node (node_config); + auto & node2 = *system.add_node (node_config); ASSERT_TIMELY (5s, node1.peer_history.exists (node2.network.endpoint ())); ASSERT_TIMELY (5s, node2.peer_history.exists (node1.network.endpoint ())); @@ -41,6 +44,7 @@ TEST (peer_history, erase_old) ASSERT_EQ (cached1.size (), 1); ASSERT_EQ (cached1[0], node2_endpoint); + ASSERT_TIMELY_EQ (5s, node1.network.size (), 0); ASSERT_TIMELY (5s, !node1.peer_history.exists (node2_endpoint)); auto cached2 = node1.peer_history.peers (); diff --git a/nano/node/peer_history.cpp b/nano/node/peer_history.cpp index a8a650172..bf1fa099b 100644 --- a/nano/node/peer_history.cpp +++ b/nano/node/peer_history.cpp @@ -86,7 +86,7 @@ void nano::peer_history::run_one () // Add or update live peers for (auto const & peer : live_peers) { - auto const endpoint = peer->get_endpoint (); + auto const endpoint = peer->get_peering_endpoint (); bool const exists = store.peer.exists (transaction, endpoint); store.peer.put (transaction, endpoint, nano::milliseconds_since_epoch ()); if (!exists)