diff --git a/rai/core/core.cpp b/rai/core/core.cpp index 38de7ab6..1b978167 100644 --- a/rai/core/core.cpp +++ b/rai/core/core.cpp @@ -373,7 +373,7 @@ void rai::network::merge_peers (std::array const & peers_a) { for (auto i (peers_a.begin ()), j (peers_a.end ()); i != j; ++i) { - if (!client.peers.known_peer (*i)) + if (!client.peers.not_a_peer (*i) && !client.peers.known_peer (*i)) { send_keepalive (*i); } @@ -3351,7 +3351,7 @@ void rai::frontier_req_client::received_frontier (boost::system::error_code cons while (current != end && current->first < account) { // We know about an account they don't. - pushes [account] = rai::block_hash (0); + pushes [current->first] = rai::block_hash (0); ++current; } if (current != end) @@ -3391,7 +3391,7 @@ void rai::frontier_req_client::received_frontier (boost::system::error_code cons while (current != end) { // We know about an account they don't. - pushes [account] = rai::block_hash (0); + pushes [current->first] = rai::block_hash (0); ++current; } completed_requests (); @@ -3469,8 +3469,11 @@ void rai::bulk_push_client::push () } return result; }); + auto hash (current->first); rai::frontier frontier; - connection->connection->client->store.latest_get (current->first, frontier); + auto error (connection->connection->client->store.latest_get (hash, frontier)); + assert (!error); + ++current; filler.generate (frontier.hash); push_block (); } diff --git a/rai/core_test/network.cpp b/rai/core_test/network.cpp index fd76f0fc..c7c0612f 100644 --- a/rai/core_test/network.cpp +++ b/rai/core_test/network.cpp @@ -88,6 +88,7 @@ TEST (network, send_keepalive) ASSERT_EQ (1, peers2.size ()); ASSERT_NE (peers1.end (), std::find_if (peers1.begin (), peers1.end (), [&client1] (rai::peer_information const & information_a) {return information_a.endpoint == client1->network.endpoint ();})); ASSERT_NE (peers2.end (), std::find_if (peers2.begin (), peers2.end (), [&system] (rai::peer_information const & information_a) {return information_a.endpoint == system.clients [0]->network.endpoint ();})); + client1->stop (); } TEST (network, keepalive_ipv4) @@ -107,6 +108,7 @@ TEST (network, keepalive_ipv4) ++iterations; ASSERT_LT (iterations, 200); } + client1->stop (); } TEST (network, multi_keepalive)