-
Notifications
You must be signed in to change notification settings - Fork 793
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[v17] Replay votes in response to a confirm_req for an active block #1409
[v17] Replay votes in response to a confirm_req for an active block #1409
Conversation
b363acf
to
9970618
Compare
IIRC compute_rep_votes is never called, so we can get rid of that function entirely. I was hoping that V17 would be a good opportunity to do some kind of LRU cache instead of tying it to active_transactions, but this is still a lot better than nothing, and we can improve it later if we need to. 👍 |
If you have LRU cache in mind, we can merge this in 17.0 & not merge to master, wait for cache I guess |
20fe710
to
a42a577
Compare
That's fine -- getting it fixed in V17.0 and doing something better in V18+ works |
Useful for tests & largest representatives
a8fc0e8
to
2cf9fa9
Compare
To prevent node.unlock_search assert
rai/node/voting.cpp
Outdated
@@ -49,6 +49,16 @@ void rai::vote_generator::send (std::unique_lock<std::mutex> & lock_a) | |||
auto transaction (node.store.tx_begin_read ()); | |||
node.wallets.foreach_representative (transaction, [this, &hashes_l, &transaction](rai::public_key const & pub_a, rai::raw_key const & prv_a) { | |||
auto vote (this->node.store.vote_generate (transaction, pub_a, prv_a, hashes_l)); | |||
std::unique_lock<std::mutex> lock (node.active.mutex); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MSVC is failing to compile this:
c:\projects\myproject\rai\node\voting.cpp(52): error C2143: syntax error: missing ')' before '.'
c:\projects\myproject\rai\node\voting.cpp(52): error C3484: syntax error: expected '->' before the return type
c:\projects\myproject\rai\node\voting.cpp(52): error C3613: missing return type after '->' ('int' assumed)
c:\projects\myproject\rai\node\voting.cpp(52): error C3646: 'active': unknown override specifier
c:\projects\myproject\rai\node\voting.cpp(52): error C3551: if a trailing return type is used then the leading return type shall be the single type-specifier 'auto' (not 'std::unique_lock<std::mutex>')
c:\projects\myproject\rai\node\voting.cpp(52): error C2059: syntax error: '.'
c:\projects\myproject\rai\node\voting.cpp(52): error C2059: syntax error: ')'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've seen this type of problem before, it needs to be this->node
. I wonder if we can enable a warning for this in GCC.
To prevent node.unlock_search assert Initially part of v17 nanocurrency#1409
* Add recursive_mutex to foreach_representative To prevent node.unlock_search assert Initially part of v17 #1409 * Calculate votes for local representatives in block_confirm * Use vote_generator * Fix * Make vote_generator public * Improve node.unlock_search test * Formatting
Port of #1382
Fixes #1393