From 5b7fb78579b3a9c51081b73b488e4f1bf2d5cbdf Mon Sep 17 00:00:00 2001 From: cryptocode Date: Tue, 14 Jan 2020 15:46:45 +0100 Subject: [PATCH] Fix some formatting issues on develop (#2480) --- nano/nano_node/entry.cpp | 3 ++- nano/node/blockprocessor.cpp | 2 +- nano/node/confirmation_solicitor.cpp | 1 - nano/node/confirmation_solicitor.hpp | 10 +++++--- nano/node/node.cpp | 38 ++++++++++++++-------------- nano/secure/ledger.hpp | 2 +- 6 files changed, 29 insertions(+), 27 deletions(-) diff --git a/nano/nano_node/entry.cpp b/nano/nano_node/entry.cpp index d2aa2d40..42c5bbdc 100644 --- a/nano/nano_node/entry.cpp +++ b/nano/nano_node/entry.cpp @@ -617,7 +617,8 @@ int main (int argc, char * const * argv) run_addr2line (false); { std::ofstream ofs (crash_report_filename, std::ios_base::out | std::ios_base::app); - ofs << std::endl << "Using relative addresses:" << std::endl; // Add an empty line to separate the absolute & relative output + ofs << std::endl + << "Using relative addresses:" << std::endl; // Add an empty line to separate the absolute & relative output } // Now run using relative addresses. This will give actual results for other dlls, the results from the nano_node executable. diff --git a/nano/node/blockprocessor.cpp b/nano/node/blockprocessor.cpp index a08ff8de..bbb6b57c 100644 --- a/nano/node/blockprocessor.cpp +++ b/nano/node/blockprocessor.cpp @@ -427,7 +427,7 @@ nano::process_return nano::block_processor::process_one (nano::write_transaction info_a.modified = nano::seconds_since_epoch (); } node.store.unchecked_put (transaction_a, nano::unchecked_key (node.ledger.block_source (transaction_a, *(info_a.block)), hash), info_a); - ++node.ledger.cache.unchecked_count; + ++node.ledger.cache.unchecked_count; node.gap_cache.add (hash); break; } diff --git a/nano/node/confirmation_solicitor.cpp b/nano/node/confirmation_solicitor.cpp index ba20625d..df52fb1b 100644 --- a/nano/node/confirmation_solicitor.cpp +++ b/nano/node/confirmation_solicitor.cpp @@ -1,5 +1,4 @@ #include - #include #include diff --git a/nano/node/confirmation_solicitor.hpp b/nano/node/confirmation_solicitor.hpp index 213a69ff..6bf606ad 100644 --- a/nano/node/confirmation_solicitor.hpp +++ b/nano/node/confirmation_solicitor.hpp @@ -24,11 +24,12 @@ class confirmation_solicitor final class request_hash { public: - size_t operator () (nano::confirmation_solicitor::request const & item_a) const + size_t operator() (nano::confirmation_solicitor::request const & item_a) const { - return std::hash> ()(item_a.election) ^ std::hash ()(*item_a.channel); + return std::hash> () (item_a.election) ^ std::hash () (*item_a.channel); } }; + public: confirmation_solicitor (nano::node &); /** Prepare object for batching election confirmation requests*/ @@ -37,15 +38,16 @@ public: void add (std::shared_ptr); /** Bundle hashes together for identical channels in to a single confirm_req by hash packet */ void flush (); + private: static size_t constexpr max_confirm_req_batches = 20; static size_t constexpr max_confirm_req = 5; static size_t constexpr max_block_broadcasts = 30; - int rebroadcasted { 0 }; + int rebroadcasted{ 0 }; nano::node & node; std::vector representatives; /** Unique channel/hash to be requested */ std::unordered_set requests; - bool prepared { false }; + bool prepared{ false }; }; } diff --git a/nano/node/node.cpp b/nano/node/node.cpp index d6982bcc..2d288863 100644 --- a/nano/node/node.cpp +++ b/nano/node/node.cpp @@ -556,24 +556,24 @@ void nano::node::process_fork (nano::transaction const & transaction_a, std::sha { std::weak_ptr this_w (shared_from_this ()); if (!active.start (ledger_block, false, [this_w, root](std::shared_ptr) { - if (auto this_l = this_w.lock ()) - { - auto attempt (this_l->bootstrap_initiator.current_attempt ()); - if (attempt && attempt->mode == nano::bootstrap_mode::legacy) - { - auto transaction (this_l->store.tx_begin_read ()); - auto account (this_l->ledger.store.frontier_get (transaction, root)); - if (!account.is_zero ()) - { - attempt->requeue_pull (nano::pull_info (account, root, root)); - } - else if (this_l->ledger.store.account_exists (transaction, root)) - { - attempt->requeue_pull (nano::pull_info (root, nano::block_hash (0), nano::block_hash (0))); - } - } - } - })) + if (auto this_l = this_w.lock ()) + { + auto attempt (this_l->bootstrap_initiator.current_attempt ()); + if (attempt && attempt->mode == nano::bootstrap_mode::legacy) + { + auto transaction (this_l->store.tx_begin_read ()); + auto account (this_l->ledger.store.frontier_get (transaction, root)); + if (!account.is_zero ()) + { + attempt->requeue_pull (nano::pull_info (account, root, root)); + } + else if (this_l->ledger.store.account_exists (transaction, root)) + { + attempt->requeue_pull (nano::pull_info (root, nano::block_hash (0), nano::block_hash (0))); + } + } + } + })) { logger.always_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 ())); network.broadcast_confirm_req (ledger_block); @@ -592,7 +592,7 @@ std::unique_ptr nano::collect_container_info (no composite->add_component (collect_container_info (node.active, "active")); composite->add_component (collect_container_info (node.bootstrap_initiator, "bootstrap_initiator")); composite->add_component (collect_container_info (node.bootstrap, "bootstrap")); - composite->add_component (collect_container_info (node.network, "network")); + composite->add_component (collect_container_info (node.network, "network")); composite->add_component (collect_container_info (node.observers, "observers")); composite->add_component (collect_container_info (node.wallets, "wallets")); composite->add_component (collect_container_info (node.vote_processor, "vote_processor")); diff --git a/nano/secure/ledger.hpp b/nano/secure/ledger.hpp index ac1da66a..60e71060 100644 --- a/nano/secure/ledger.hpp +++ b/nano/secure/ledger.hpp @@ -15,7 +15,7 @@ using tally_t = std::map, std::gre class ledger final { public: - ledger (nano::block_store &, nano::stat &, nano::generate_cache const & = nano::generate_cache()); + ledger (nano::block_store &, nano::stat &, nano::generate_cache const & = nano::generate_cache ()); nano::account account (nano::transaction const &, nano::block_hash const &) const; nano::uint128_t amount (nano::transaction const &, nano::account const &); nano::uint128_t amount (nano::transaction const &, nano::block_hash const &);