Calculate votes for local representatives in block_confirm (#1534)
* Add recursive_mutex to foreach_representative To prevent node.unlock_search assert Initially part of v17 https://github.com/nanocurrency/raiblocks/pull/1409 * Calculate votes for local representatives in block_confirm * Use vote_generator * Fix * Make vote_generator public * Improve node.unlock_search test * Formatting
This commit is contained in:
parent
4e4b597644
commit
dcc2d0f5e0
3 changed files with 10 additions and 1 deletions
|
@ -368,6 +368,10 @@ TEST (node, unlock_search)
|
|||
{
|
||||
ASSERT_NO_ERROR (system.poll ());
|
||||
}
|
||||
while (!system.nodes[0]->active.roots.empty ())
|
||||
{
|
||||
ASSERT_NO_ERROR (system.poll ());
|
||||
}
|
||||
system.wallet (0)->insert_adhoc (key2.prv);
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lock (system.wallet (0)->store.mutex);
|
||||
|
|
|
@ -2635,6 +2635,11 @@ void nano::node::block_confirm (std::shared_ptr<nano::block> block_a)
|
|||
{
|
||||
active.start (block_a);
|
||||
network.broadcast_confirm_req (block_a);
|
||||
// Calculate votes for local representatives
|
||||
if (config.enable_voting && active.active (*block_a))
|
||||
{
|
||||
block_processor.generator.add (block_a->hash ());
|
||||
}
|
||||
}
|
||||
|
||||
nano::uint128_t nano::node::delta ()
|
||||
|
|
|
@ -433,6 +433,7 @@ public:
|
|||
bool have_blocks ();
|
||||
void process_blocks ();
|
||||
nano::process_return process_one (nano::transaction const &, std::shared_ptr<nano::block>, std::chrono::steady_clock::time_point = std::chrono::steady_clock::now (), bool = false);
|
||||
nano::vote_generator generator;
|
||||
|
||||
private:
|
||||
void queue_unchecked (nano::transaction const &, nano::block_hash const &, std::chrono::steady_clock::time_point = std::chrono::steady_clock::time_point ());
|
||||
|
@ -454,7 +455,6 @@ private:
|
|||
static size_t const rolled_back_max = 1024;
|
||||
std::condition_variable condition;
|
||||
nano::node & node;
|
||||
nano::vote_generator generator;
|
||||
std::mutex mutex;
|
||||
};
|
||||
class node : public std::enable_shared_from_this<nano::node>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue