Peer history fixes
This commit is contained in:
parent
4266c5fc99
commit
72265d172c
2 changed files with 7 additions and 3 deletions
|
|
@ -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 ();
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue