-
Notifications
You must be signed in to change notification settings - Fork 122
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
Add sleep in batchvote rpc #1810
Conversation
src/masternodes/rpc_proposals.cpp
Outdated
// relay the TXs as it works through. Otherwise, the main | ||
// chain can be locked for too long that prevent broadcasting of | ||
// TXs | ||
std::this_thread::sleep_for(std::chrono::seconds(1)); |
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.
1 second seems like a long time. Have we tested smaller time periods?
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.
Edit: Moved rationale to main thread.
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.
Switched to 0.5s in light of the perf. observations data with -walletfastselect
/kind fix
Node can become too busy to broadcast during batch voting. This workarounds it by for now by adding an idle period to process messages in between.
Wait time is just added as an escape hatch for now since it's meant for limited advanced uses cases and not for widespread adoption.
Note: The node also needs to keep catching up on other things like validating incoming blocks, possibly other minor RPCs, etc in between in this time the sleep is added.
Rationale: Ideal targets are institutions that vote on behalf of users, so likely 500 to 3000 votes at a time using the current single threaded wallet logic that's held by global locks.
Considering these nodes might have many addresses per wallet, using a large time factor of 30s - 5m to sign the TX.
Overhead is high only on low counts, where the consumers are better off using single vote.
Edit: Now using 0.5s as default, since
-walletfastselect
has much better observed perf. characteristics. This should allows us to turn it as a default and just use a 0.5s for safety for now.