util: Allow FastRandomContext::randbytes for std::byte, Allow std::byte serialization #28012
pull MarcoFalke wants to merge 2 commits into bitcoin:master from MarcoFalke:2306-fs_stuff- changing 4 files +14 −6-
MarcoFalke commented at 10:14 am on June 30, 2023: memberI need this for some stuff, but it should also be useful by itself for other developers that need it.
-
Allow FastRandomContext::randbytes for all byte types fade43edc4
-
Allow std::byte serialization fac6af16f4
-
DrahtBot commented at 10:14 am on June 30, 2023: contributor
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
Reviews
See the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.
-
DrahtBot renamed this:
util: Allow FastRandomContext::randbytes for std::byte, Allow std::byte serialization
util: Allow FastRandomContext::randbytes for std::byte, Allow std::byte serialization
on Jun 30, 2023 -
DrahtBot added the label Utils/log/libs on Jun 30, 2023
-
sipa commented at 6:27 pm on June 30, 2023: member
utACK fac6af16f4a254458b8cb3522317422b40362f8d
The two commits feel quite unrelated here, though, but both seem fine to me.
-
dergoegge approved
-
dergoegge commented at 8:33 am on July 7, 2023: memberCode review ACK fac6af16f4a254458b8cb3522317422b40362f8d
-
fanquake merged this on Jul 7, 2023
-
fanquake closed this on Jul 7, 2023
-
sidhujag referenced this in commit b3c7e68a27 on Jul 7, 2023
-
MarcoFalke deleted the branch on Jul 8, 2023
-
in src/random.h:215 in fac6af16f4
210@@ -211,7 +211,8 @@ class FastRandomContext 211 } 212 213 /** Generate random bytes. */ 214- std::vector<unsigned char> randbytes(size_t len); 215+ template <typename B = unsigned char> 216+ std::vector<B> randbytes(size_t len);
jonatack commented at 5:32 pm on July 12, 2023:Why this change? It is currently unused, “I need this for some stuff” is vague, and this change is being cited in #27425 (review) as a reason not to use rand test helpers consistently.
MarcoFalke commented at 5:39 pm on July 12, 2023:std::byte
is used in many places to pass bytes. Adding this helper makes it easier to fill a vector withstd::byte
s. For example, it is used in 9999a49b3299bd25dde4805f5c68adef3876057f (https://github.com/bitcoin/bitcoin/pull/28060). But the helper can also be used in other places.
jonatack commented at 5:43 pm on July 12, 2023:Thank you for clarifying for me.
github-metadata-mirror
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-07-08 22:13 UTC
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-07-08 22:13 UTC
This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me
More mirrored repositories can be found on mirror.b10c.me