Skip to content

Commit

Permalink
Fixing issue where blocks were not being rebroadcast immediately upon… (
Browse files Browse the repository at this point in the history
#1657)

* Fixing issue where blocks were not being rebroadcast immediately upon being inserted in to the ledger.

* Merge master

* Submodules fix

* Remove unused buffer_a

* Use election_start time

* Remove debug functions
  • Loading branch information
zhyatt authored Jan 30, 2019
1 parent e3c47df commit 17efbe4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
19 changes: 14 additions & 5 deletions nano/node/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1844,6 +1844,19 @@ void nano::block_processor::process_batch (std::unique_lock<std::mutex> & lock_a
}
}

void nano::block_processor::process_live (nano::block_hash const & hash_a, std::shared_ptr<nano::block> block_a)
{
// Start collecting quorum on block
node.active.start (block_a);
// Announce block contents to the network
node.network.republish_block (block_a);
if (node.config.enable_voting)
{
// Announce our weighted vote to the network
generator.add (hash_a);
}
}

nano::process_return nano::block_processor::process_one (nano::transaction const & transaction_a, nano::unchecked_info info_a)
{
nano::process_return result;
Expand All @@ -1862,11 +1875,7 @@ nano::process_return nano::block_processor::process_one (nano::transaction const
}
if (info_a.modified > nano::seconds_since_epoch () - 300 && node.block_arrival.recent (hash))
{
node.active.start (info_a.block);
if (node.config.enable_voting)
{
generator.add (hash);
}
process_live (hash, info_a.block);
}
queue_unchecked (transaction_a, hash);
break;
Expand Down
1 change: 1 addition & 0 deletions nano/node/node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,7 @@ class block_processor
void queue_unchecked (nano::transaction const &, nano::block_hash const &);
void verify_state_blocks (nano::transaction const & transaction_a, std::unique_lock<std::mutex> &, size_t = std::numeric_limits<size_t>::max ());
void process_batch (std::unique_lock<std::mutex> &);
void process_live (nano::block_hash const &, std::shared_ptr<nano::block>);
bool stopped;
bool active;
std::chrono::steady_clock::time_point next_log;
Expand Down

0 comments on commit 17efbe4

Please sign in to comment.