-
Notifications
You must be signed in to change notification settings - Fork 37.7k
refactor: share and use GenerateRandomKey
helper
#28455
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
refactor: share and use GenerateRandomKey
helper
#28455
Conversation
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code CoverageFor detailed information about the code coverage, see the test coverage report. ReviewsSee 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. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
Code Review ACK 81187d0 |
I see
I found these by doing |
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.
Concept ACK. I think this is a useful refactor to have since it's more modular to have GenerateRandomKey
in key.cpp
rather than net code.
I found these by doing grep -nri "MakeNewKey" ./src --binary-files=without-match
do we plan on making this modification to these files aswell?
@kevkevinpal, it makes sense to do this refactor when we're instantiating a CKey object and also filling the value together in the same line. we can't do this in arrays for example, where the instantiation is done prior to filling values. we can do this refactor in:
ACK 81187d0 The Stratum v2 Template Provider in #28983 also uses the
I can re-review if more tests are modified to use this new helper, but I'm also fine with leaving as is. New code can use it. |
Making the `GenerateRandomKey` helper available to other modules via key.{h.cpp} allows us to create random private keys directly at instantiation of CKey, in contrast to the two-step process of creating the instance and then having to call `MakeNewKey(...)`.
81187d0
to
fa1d495
Compare
Thanks for the reviews! I've tackled the missing header include and the two more instances where the refactoring can be done (script_standard_Solver_failure and script_standard_ExtractDestination). Can be easily re-reviewed via |
re-ACK fa1d495 |
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 fa1d495
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.
cr utACK fa1d495
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.
ACK fa1d495.
ACK fa1d495 |
Making the
GeneratingRandomKey
helper (recently introduced in PR #28433, commit b6934fd) available to other modules via key.{h.cpp} allows us to create random private keys directly at CKey instantiation, in contrast to the currently needed two-step process of creating an (invalid) CKey instance first and then having to callMakeNewKey(...)
.This is mostly used in unit tests and a few instances in the wallet.