From ada4338acd69c02b13ca8baad01d58e87a1f3ad3 Mon Sep 17 00:00:00 2001 From: SergiySW Date: Sat, 28 Jul 2018 00:40:36 +0300 Subject: [PATCH] Consolidate received_frontier transactions --- rai/node/bootstrap.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/rai/node/bootstrap.cpp b/rai/node/bootstrap.cpp index 15d59525..71afa26b 100644 --- a/rai/node/bootstrap.cpp +++ b/rai/node/bootstrap.cpp @@ -273,12 +273,12 @@ void rai::frontier_req_client::received_frontier (boost::system::error_code cons { BOOST_LOG (connection->node->log) << boost::str (boost::format ("Received %1% frontiers from %2%") % std::to_string (count) % connection->socket->remote_endpoint ()); } + rai::transaction transaction (connection->node->store.environment, nullptr, false); if (!account.is_zero ()) { while (!current.is_zero () && current < account) { // We know about an account they don't. - rai::transaction transaction (connection->node->store.environment, nullptr, false); unsynced (info.head, 0); next (transaction); } @@ -286,7 +286,6 @@ void rai::frontier_req_client::received_frontier (boost::system::error_code cons { if (account == current) { - rai::transaction transaction (connection->node->store.environment, nullptr, false); if (latest == info.head) { // In sync @@ -322,14 +321,11 @@ void rai::frontier_req_client::received_frontier (boost::system::error_code cons } else { + while (!current.is_zero ()) { - rai::transaction transaction (connection->node->store.environment, nullptr, false); - while (!current.is_zero ()) - { - // We know about an account they don't. - unsynced (info.head, 0); - next (transaction); - } + // We know about an account they don't. + unsynced (info.head, 0); + next (transaction); } if (connection->node->config.logging.bulk_pull_logging ()) {