Fix some formatting issues on develop (#2480)

This commit is contained in:
cryptocode 2020-01-14 15:46:45 +01:00 committed by GitHub
commit 5b7fb78579
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 29 additions and 27 deletions

View file

@ -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.

View file

@ -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;
}

View file

@ -1,5 +1,4 @@
#include <nano/node/confirmation_solicitor.hpp>
#include <nano/node/election.hpp>
#include <nano/node/node.hpp>

View file

@ -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<std::shared_ptr<nano::election>> ()(item_a.election) ^ std::hash<nano::transport::channel> ()(*item_a.channel);
return std::hash<std::shared_ptr<nano::election>> () (item_a.election) ^ std::hash<nano::transport::channel> () (*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<nano::election>);
/** 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<nano::representative> representatives;
/** Unique channel/hash to be requested */
std::unordered_set<request, nano::confirmation_solicitor::request_hash> requests;
bool prepared { false };
bool prepared{ false };
};
}

View file

@ -556,24 +556,24 @@ void nano::node::process_fork (nano::transaction const & transaction_a, std::sha
{
std::weak_ptr<nano::node> this_w (shared_from_this ());
if (!active.start (ledger_block, false, [this_w, root](std::shared_ptr<nano::block>) {
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::container_info_component> 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"));

View file

@ -15,7 +15,7 @@ using tally_t = std::map<nano::uint128_t, std::shared_ptr<nano::block>, 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 &);