Partial merge bitcoin#14624: Some simple improvements to the RNG code#3923
Partial merge bitcoin#14624: Some simple improvements to the RNG code#3923PastaPastaPasta merged 7 commits intodashpay:developfrom kwvg:develop
Conversation
std::shuffle doesn't accept only two arguments so we use FastRandomContext()
UdjinM6
left a comment
There was a problem hiding this comment.
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 <[email protected]>
Co-authored-by: UdjinM6 <[email protected]>
|
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 <[email protected]>
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 |
UdjinM6
left a comment
There was a problem hiding this comment.
Interesting. Makes sense to fix it then I guess.
utACK
xdustinface
left a comment
There was a problem hiding this comment.
utACK, nice that those deprecation warning will be gone now :)
PastaPastaPasta
left a comment
There was a problem hiding this comment.
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 <[email protected]> * llmq: use inherited FastRandomContext Co-authored-by: UdjinM6 <[email protected]> * Make the linter happy :) Co-authored-by: dustinface <[email protected]> Co-authored-by: UdjinM6 <[email protected]> Co-authored-by: dustinface <[email protected]>
Overview
std::random_shufflehas been deprecated and Bitcoin has opted to implement an alternative tostd::shuffleforFastRandomContextdue to a bug specific tolibstdc++namedShuffle.Unlike
std::random_shuffle,std::shuffledoes 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