Conversation
|
Why do you keep moving CTxDestination to key? IMHO it doesn't belong there at all. |
|
Since this one depends on the other, I'll be showing more controversial things like that one. |
|
How can scriptutils.h not include script.h? It needs the CScript type...? |
|
|
|
Ah. So, my opinion about this: using forward declarations and .h files including fewer things than the corresponding .cpp file is nice for one thing only: speeding up compilation. For all other purposes, I consider it ugly. It hides dependencies between modules, and may cause breaking in case of reorganizations that change types. As far as I'm concerned, the most important thing (and the only thing worth doing refactoring effort to obtain) is dependencies between modules, where a module is defined as the combination of the .h and .cpp file. You can't use the .h file without the .cpp file (typically), so including the .h file means you're depending on that code. Moving CTxDestination to a place where it makes no sense semantically (scripts, and their identifiers, are much higher level constructs than keys) is IMHO a bad idea, but if the only goal is dropping an #include (without even breaking a module dependency), it's unacceptable. |
|
Of course it all comes down to whether or not it makes sense semantically there. Re: forward declarations: I guess if there weren't so many definitions in .h files, forward declarations wouldn't save that much compiling time. |
Yes, it may seem that moving CTxDestination to CKey simplifies things, but that's just because you ignore the code in the script utils cpp file that is intimately using CTxDestination, while nothing relying on key is. Really, just consider the .h and .cpp always as a whole when deciding boundaries of responsibilities. |
|
Agree that CTxDestination doesn't belong in key.h. We've had this discussion before, please don't keep doing that. |
|
I'm sorry I shouldn't have pushed that again. I should have at least used the separated destination.h instead of just mentioning it while pushing the change that had been rejected again, or better yet, not push that commit at all since the PR wasn't finished. |
d6e6922 to
0cef8f2
Compare
|
Rebased on top of #4788 |
|
@jtimon I'd say if it is only used by the wallet, move it to the wallet. On the other hand the wallet.cpp is growing quite a lot lately so maybe it makes sense to keep it split up. But make it clear in the name (and build system) that it's part of the wallet. |
|
What about wallet_ismine.o? |
|
I wouldn't worry too much about source/object names for now. Just |
|
Yeah, it is bike-shedding but better do it before I do the rename. |
|
@jtimon I'd say wallet_ismine.o. Moving it to a directory can always be done later and should happen along with the other files libbitcoin_wallet. |
|
Fair enough, wallet_ismine.o then |
bce45ba to
e82502a
Compare
|
Closing until #4754 is merged. |
|
I can squash the alphabetical fix into one of the other commits. |
|
utACK, verified code move. |
There was a problem hiding this comment.
Instead of putting these #ifdefs, I'd prefer to move these to a wallet-specific test cpp (e.g. wallet_tests.cpp or create a new one)
There was a problem hiding this comment.
+1, but I wouldn't object to doing that later.
|
Looks good to me. Agreed about moving out the wallet tests as a next step. |
|
Updated with the ifdef in the includes of the tests fix. |
|
@jtimon In case of doubt about the sorting you could run the lines through sort. In vim this is a matter of selecting the range with V then |
|
Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/p4755_d1e623c444d664f00f3eaf2c332cffc3784388e9/ for binaries and test log. |
|
ACK |
|
Merged via fd1caa0 (added the #ifdef) |
|
Thanks @laanwj. I don't use vim but emacs has the equivalent M-x sort-lines. I could have thought of that. |
Continues #4754