-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Partial merge bitcoin#14624: Some simple improvements to the RNG code #3923
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
Conversation
std::shuffle doesn't accept only two arguments so we use FastRandomContext()
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.
Thanks for looking into it 👍 Those random_shuffle
deprecation warnings on compilation are pretty annoying and concerning indeed.
Few thoughts/suggestions:
- The original commit was included into btc 0.18 and was not backported to 0.17 afaik. Are there any real issues or is it simply to fix compilation warnings/make it C++17 compatible?
- PR title should say smth like
Partial merge bitcoin#14624: Some simple improvements to the RNG code
(makes it easier to track backported PRs ingit log
) - see below
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
I was attempting to have Dash compile with Apple Clang and it wasn't happy with the deprecated references. PR title has been changed and changes have been committed! I mixed up the Bitcoin versions, I was looking at bitcoin@f686002 instead of bitcoin@3db746b, my bad. |
Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>
Does it fail to compile or does it simply complain via warnings (but succeeds otherwise)? Cause I'm on mac too (macOS 10.14.6, Apple clang version 11.0.0) and it compiles just fine for me. |
I'm using |
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.
Interesting. Makes sense to fix it then I guess.
utACK
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.
utACK, nice that those deprecation warning will be gone now :)
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.
utACK. Be aware, your contribution may be worthy of a bounty https://trello.com/c/dbkj327J/86-dash-core-contributions
…dashpay#3923) * random: Introduce std::shuffle alternative for FastRandomContext bitcoin@3db746b * random: change std::random_shuffle calls to std::shuffle https://en.cppreference.com/w/cpp/algorithm/random_shuffle (deprecated in c++14) * random: change FastRandomContext std::random_shuffle calls to shuffle * random: change last std::shuffle calls to Shuffle std::shuffle doesn't accept only two arguments so we use FastRandomContext() * llmq: use inherited FastRandomContext Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com> * llmq: use inherited FastRandomContext Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com> * Make the linter happy :) Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com> Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com> Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>
Overview
std::random_shuffle
has been deprecated and Bitcoin has opted to implement an alternative tostd::shuffle
forFastRandomContext
due to a bug specific tolibstdc++
namedShuffle
.Unlike
std::random_shuffle
,std::shuffle
does not accept only two arguments so those invocations now useFastRandomContext
.Replicating the commit would only implement changes to Bitcoin-derived logic while leaving Dash-specific logic using the deprecated call, changes have been made for LLMQ, Governance and Privatesend accordingly.
Disclosure
Dash-specific changes have not been tested, only compilation has been ensured. Running the client on (a) testnet may be necessary.
Resources