This makes compilation of wallet.cpp use a few % less memory and time, locally.
Created in the context of #28109, but I don't think it is enough to actually fix this problem.
<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--021abf342d371248e50ceaed478a90ca-->
See the guideline for information on the review process.
| Type | Reviewers |
|---|---|
| ACK | hebasto |
| Concept ACK | jonatack, theuni, Empact, RandyMcMillan |
| Stale ACK | ryanofsky, TheCharlatan |
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.
<!--174a7506f384e20aa4161008e828411d-->
Reviewers, 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.
Good job! The circular dependency "wallet/fees -> wallet/wallet -> wallet/fees" is no longer present. Please remove it from EXPECTED_CIRCULAR_DEPENDENCIES in test/lint/lint-circular-dependencies.py to make sure this circular dependency is not accidentally reintroduced.
🎉
Concept ACK
Thanks, force pushed to fix the linter and made the commit hash start with cccc
Code review ACK ccccbd8dd0f5cd74a744e74608c4ea102ec33fd1
4 | @@ -5,50 +5,72 @@ 5 | 6 | #include <wallet/wallet.h> 7 | 8 | +#include <bitcoin-config.h>
#if defined(HAVE_CONFIG_H)
#include <config/bitcoin-config.h>
#endif
ACK fa8940852f88f74cb0d4975e05ec32fd3594961c
24 | #include <kernel/cs_main.h> 25 | -#include <kernel/mempool_entry.h> 26 | +#include <kernel/mempool_entry.h> // IWYU pragma: export 27 | +#include <kernel/mempool_limits.h> // IWYU pragma: export 28 | +#include <kernel/mempool_options.h> // IWYU pragma: export 29 | +#include <kernel/mempool_removal_reason.h> // IWYU pragma: export
It seems IWYU pragma: export causes:
txmempool.h should add these lines:
...
#include "kernel/mempool_limits.h"
#include "kernel/mempool_options.h"
#include "kernel/mempool_removal_reason.h" // for MemPoolRemovalReason (ptr only)
...
Perhaps, a better solution is to use contrib/devtools/iwyu/bitcoin.core.imp.
Yes, I am aware, but I think this bug should be reported to IWYU, or is it not a bug?
I think this bug should be reported to IWYU...
https://github.com/include-what-you-use/include-what-you-use/issues/1280
Concept ACK. I didn't review the includes changes in detail, but the move makes sense to me. And I'm always up for one-data-structure-per-header :)
Concept ACK
nit: IMO better to split the the iwyu adds/removals into a 3rd commit on this PR, somewhat in the spirit of the "Pull Request Philosophy"
The second commit is basically iwyu on src/blockfilter.h and wallet.cpp/h, so I don't think it can be split further.
To be clear as to what I'm referring to, note your commit messages both end with "Also ...". This alludes to the fact that you're doing a variety of things in each, which is a burden (in this case a minor one) on review.
Feel free to disregard as a nit, but I think this is a good practice to keep in mind, that we may maintain discipline in how we structure our changes for the benefit of review.
Thanks, I've split each commit to be iwyu targeted to one header/module. The overall force-push diff is zero.
Concept ACK
What about this one:
wallet/wallet.h should remove these lines:
- #include <boost/signals2/signal.hpp> // lines 52-52
Probably should be moved to the implementation file, no?
Can you post a patch that compiles?
Concept ACK
macOS Catalina Version 10.15.7 (19H2026)
@RandyMcMillan That looks unrelated to the changes here. You'll have to use make clean && make distclean, or something similar
Can you post a patch that compiles?
Seems like an easy win, no?
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index 7c74b6b9ff..fe4c3d0f67 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -79,6 +79,8 @@
#include <tuple>
#include <variant>
+#include <boost/signals2/signal.hpp>
+
struct KeyOriginInfo;
using interfaces::FoundBlock;
diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h
index 8a1a513062..24cedd5160 100644
--- a/src/wallet/wallet.h
+++ b/src/wallet/wallet.h
@@ -49,8 +49,6 @@
#include <utility>
#include <vector>
-#include <boost/signals2/signal.hpp>
-
class CKey;
class CKeyID;
class CPubKey;
Seems like an easy win, no?
No. The boost include is still there (via src/wallet/scriptpubkeyman.h:#include <boost/signals2/signal.hpp>
Removing boost seems unrelated and can be done in a follow-up. You can help by reviewing the first step: https://github.com/bitcoin/bitcoin/pull/28240
ACK fac3e2fa6adf9cb034ea5ee28c572b25cc7e3c2d
No. The boost include is still there (via src/wallet/scriptpubkeyman.h:#include <boost/signals2/signal.hpp>
Yeah, totally. Should have checked this before trusting the iwyu suggestion.
... and move them to where they are really needed.
This was found by IWYU:
txmempool.h should remove these lines:
- #include <random.h> // lines 29-29
- class CBlockIndex; // lines 43-43
- class Chainstate; // lines 45-45
Also, move the stdlib section to the right place. Can be reviewed with:
--color-moved=dimmed-zebra
This is needed for a future commit. Can be reviewed with:
--color-moved=dimmed-zebra
This removes unused includes, primitives/block found manually, and the
others by iwyu:
blockfilter.h should remove these lines:
- #include <serialize.h> // lines 16-16
- #include <undo.h> // lines 18-18
This removes unused includes, such as undo.h or txmempool.h from
wallet.cpp.
Also, add missing ones, according to IWYU.
rebased, should be trivial to re-ACK
ACK fa6286891fa4164510e4fbf4bc214ce3033b2d1b, I have reviewed the code and it looks OK.