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: split CKeyID/CScriptID/CTxDestination from CBitcoinAddress #1357
Conversation
What do other people think about using boost::variant? I'm not a fan of the "write a little class to do simple things" style of programming that it brings, I think it just obfuscates the flow of control and makes debugging harder. (oh, and creates god-awful compiler errors if you screw up) |
The main motivation for this patch is to make a clear separation between key identifiers and addresses, split internal representation from their base58 encodings, and sanitize header dependencies. If people have a problem with boost::variant, I have absolutely no problem to write an ad-doc CTxDestination implementation that doesn't use it. RE: "write a little class to do simple things"; if you're referring to this case in particular: it just replaces CBitcoinAddress which was for all intents and purposes already a variant of key or script references, only done via its base58 representation. |
ACK |
@gavinandresen what say you? |
I like the refactor. It would be really nice to have English-language rationale for the design of CKeyID/CScriptID/CPubKey/CTxDestination in the .h file(s) and not just in the commit comment. |
This introduces internal types: * CKeyID: reference (hash160) of a key * CScriptID: reference (hash160) of a script * CTxDestination: a boost::variant of the former two CBitcoinAddress is retrofitted to be a Base58 encoding of a CTxDestination. This allows all internal code to only use the internal types, and only have RPC and GUI depend on the base58 code. Furthermore, the header dependencies are a lot saner now. base58.h is at the top (right below rpc and gui) instead of at the bottom. For the rest: wallet -> script -> keystore -> key. Only keystore still requires a forward declaration of CScript. Solving that would require splitting script into two layers.
Rebased and fixed unit tests. @gavinandresen: added some comments, as well |
Refactor: split CKeyID/CScriptID/CTxDestination from CBitcoinAddress
Refactor: split CKeyID/CScriptID/CTxDestination from CBitcoinAddress
Prevent the re-requesting of txns we already have
96b4732 [Qt] Replace deprecated Qt methods (Fuzzbawls) Pull request description: `qSort`, `qStableSort`, `qLowerBound`, and `qUpperBound` have been marked as deprecated since Qt 5.2. Also, `QSslSocket::setDefaultCaCertificates()` and `QSslSocket::systemCaCertificates()` member functions are obsolete as of Qt 5.12 This PR replaces the former with their `std::` equivalents, and the latter with `QSslConfiguration` equivalents. Changes maintain backwards compatibility with Qt 5.5.1 ACKs for top commit: random-zebra: utACK 96b4732 furszy: utACK 96b4732 Tree-SHA512: 0631d1930ccc45dc574c354f0de2406000af82e5203a6153a0e50e5e96f027eb829a08c30d109cd7d3df267ebd84c7c1fa838cd6f3798ca037bc6f3ecc49785d
3351c91 refactor: Make CScriptVisitor stateless (João Barbosa) Pull request description: `CScriptVisitor` was added in 1025440 (#1357) and the visitor return type was never used. Now `CScriptVisitor` is stateless and `CScript` is the return type. ACKs for top commit: MarcoFalke: ACK 3351c91 🏤 sipa: utACK 3351c91 Tree-SHA512: d158ad2ebe8ea4dc8cc090b943dd66fa5421a84f9443e16ab2d661df38e1a85de16ff13cbaa56924489d8d43cba25fa3cd8b6904bbbcbf356b886ffe8ffba19a
3351c91 refactor: Make CScriptVisitor stateless (João Barbosa) Pull request description: `CScriptVisitor` was added in 1025440 (bitcoin#1357) and the visitor return type was never used. Now `CScriptVisitor` is stateless and `CScript` is the return type. ACKs for top commit: MarcoFalke: ACK 3351c91 🏤 sipa: utACK 3351c91 Tree-SHA512: d158ad2ebe8ea4dc8cc090b943dd66fa5421a84f9443e16ab2d661df38e1a85de16ff13cbaa56924489d8d43cba25fa3cd8b6904bbbcbf356b886ffe8ffba19a
Summary: > CScriptVisitor was added in [[bitcoin/bitcoin#1357 | core#1357]] and the visitor return type was never used. Now CScriptVisitor is stateless and CScript is the return type. This is a backport of [[bitcoin/bitcoin#18863 | core#18863]] Test Plan: `ninja all check-all` Reviewers: #bitcoin_abc, majcosta Reviewed By: #bitcoin_abc, majcosta Differential Revision: https://reviews.bitcoinabc.org/D9939
This introduces internal types:
CBitcoinAddress is retrofitted to be a Base58 encoding of a CTxDestination. This allows all internal code to only use the internal types, and only have RPC and GUI depend on the base58 code.
Furthermore, the header dependencies are a lot saner now. base58.h is at the top (right below rpc and gui) instead of at the bottom. For the rest: wallet -> script -> keystore -> key. Only keystore still requires a forward declaration of CScript. Solving that would require splitting script into two layers.