From dd27377bad046e78fb09a69bfa8250bfb3d6207e Mon Sep 17 00:00:00 2001 From: clemahieu Date: Sat, 21 Apr 2018 00:20:44 +0100 Subject: [PATCH] Fix formatting. --- rai/node/bootstrap.cpp | 36 ++++++++++++++++++------------------ rai/node/bootstrap.hpp | 1 + 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/rai/node/bootstrap.cpp b/rai/node/bootstrap.cpp index 0fa3777a..37d54b30 100644 --- a/rai/node/bootstrap.cpp +++ b/rai/node/bootstrap.cpp @@ -23,7 +23,7 @@ void rai::socket_timeout::start (std::chrono::steady_clock::time_point timeout_a { auto ticket_l (++ticket); std::weak_ptr client_w (client.shared ()); - client.node->alarm.add (timeout_a, [client_w, ticket_l] () { + client.node->alarm.add (timeout_a, [client_w, ticket_l]() { if (auto client_l = client_w.lock ()) { if (client_l->timeout.ticket == ticket_l) @@ -1044,23 +1044,23 @@ void rai::bootstrap_attempt::process_fork (MDB_txn * transaction_a, std::shared_ { std::weak_ptr this_w (shared_from_this ()); if (!node->active.start (transaction_a, std::make_pair (ledger_block, block_a), [this_w, root](std::shared_ptr, bool resolved) { - if (auto this_l = this_w.lock ()) - { - if (resolved) - { - rai::transaction transaction (this_l->node->store.environment, nullptr, false); - auto account (this_l->node->ledger.store.frontier_get (transaction, root)); - if (!account.is_zero ()) - { - this_l->requeue_pull (rai::pull_info (account, root, root)); - } - else if (this_l->node->ledger.store.account_exists (transaction, root)) - { - this_l->requeue_pull (rai::pull_info (root, rai::block_hash (0), rai::block_hash (0))); - } - } - } - })) + if (auto this_l = this_w.lock ()) + { + if (resolved) + { + rai::transaction transaction (this_l->node->store.environment, nullptr, false); + auto account (this_l->node->ledger.store.frontier_get (transaction, root)); + if (!account.is_zero ()) + { + this_l->requeue_pull (rai::pull_info (account, root, root)); + } + else if (this_l->node->ledger.store.account_exists (transaction, root)) + { + this_l->requeue_pull (rai::pull_info (root, rai::block_hash (0), rai::block_hash (0))); + } + } + } + })) { BOOST_LOG (node->log) << boost::str (boost::format ("Resolving fork between our block: %1% and block %2% both with root %3%") % ledger_block->hash ().to_string () % block_a->hash ().to_string () % block_a->root ().to_string ()); node->network.broadcast_confirm_req (ledger_block); diff --git a/rai/node/bootstrap.hpp b/rai/node/bootstrap.hpp index 86b5d2c7..99adb431 100644 --- a/rai/node/bootstrap.hpp +++ b/rai/node/bootstrap.hpp @@ -29,6 +29,7 @@ public: socket_timeout (rai::bootstrap_client &); void start (std::chrono::steady_clock::time_point); void stop (); + private: std::atomic ticket; rai::bootstrap_client & client;