-
Notifications
You must be signed in to change notification settings - Fork 47
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
Modernize code: use std::optional instead of bool/outarg #114
Conversation
} | ||
|
||
bool ParseScriptNumber(const std::pair<opcodetype, std::vector<unsigned char>>& in, int64_t& k) { | ||
std::optional<int64_t> ParseScriptNumber(const std::pair<opcodetype, std::vector<unsigned char>>& in) { |
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.
You missed some call sites, such as:
miniscript/bitcoin/script/miniscript.h
Line 1693 in 8a81eeb
if (!ParseScriptNumber(in[1], n)) return {}; |
bitcoin/test/fuzz/miniscript.cpp
Outdated
@@ -77,13 +77,12 @@ struct TestData { | |||
struct ParserContext { | |||
typedef CPubKey Key; | |||
|
|||
bool ToString(const Key& key, std::string& ret) const | |||
std::optional<std::string> ToString(const Key& key, std::string& ret) const |
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.
You need to remove the out argument, too.
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.
To make a comprehensive list of the missing call sites from these changes:
thresh
parsingmulti
parsingminiscript_string
usage ofToString
- the
KeyConverter
in the unit tests
From my branch which has this included in Bitcoin Core on which i could actually compile.
Looks good to me otherwise, nice cleanup!
Rebased, and addressed comments. I've also made a few additional changes; turning inline "&& (num = ParseScriptNum(...)) &&" conditions into separate lines. |
ACK 033238f Checked the diff with my Bitcoin Core branch that i tested quite a lot. I didn't look for more potentially missed called sites too hard. |
13edbef miniscript: mark nodes with duplicate keys as insane (Antoine Poinsot) Pull request description: Based off a rebased #114 ACKs for top commit: sipa: utACK 13edbef Tree-SHA512: 729ff124f1a320f91069cde35b90d313faca012b122255e9b247a05d6e912e5422245dfde0f7881e0205cf8a537d390499cb3f8728e908d8ffe467dd8448eb40
Built on top of #106.