-
-
Notifications
You must be signed in to change notification settings - Fork 354
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
Fix build and run issues with --disable-wallet configuration #1492
Conversation
WalkthroughThe changes in this pull request involve updates across three files: Changes
Possibly related PRs
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (3)
- src/qt/bitcoinaddressvalidator.h (1 hunks)
- src/qt/bitcoingui.cpp (1 hunks)
- src/wallet/coincontrol.h (1 hunks)
✅ Files skipped from review due to trivial changes (1)
- src/wallet/coincontrol.h
🔇 Additional comments (2)
src/qt/bitcoinaddressvalidator.h (1)
14-14
: Verify if spark/state.h requires conditional compilation.The unconditional inclusion of "../spark/state.h" might need to be wrapped with ENABLE_WALLET if it contains wallet-specific functionality.
Let's check the contents and dependencies of state.h:
#!/bin/bash # Search for wallet-specific includes or dependencies in state.h rg -l "wallet" -- "**/spark/state.h" # Check if state.h is included in other wallet-disabled contexts rg -l "state\.h" -- "**/spark/**/*.h" "**/spark/**/*.cpp" | xargs rg "ENABLE_WALLET"src/qt/bitcoingui.cpp (1)
1486-1499
: LGTM! Good defensive programming practice.The changes add proper null checks before accessing toolbar action widgets, which prevents potential crashes in --disable-wallet mode. The implementation correctly:
- Checks each action widget's existence before accessing it
- Maintains the same width calculation logic
- Safely handles cases where actions may not be available
#ifdef ENABLE_WALLET | ||
#include "../spark/sparkwallet.h" | ||
#endif |
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.
💡 Codebase verification
Let me analyze the results. The search shows that validateSparkAddress
is used extensively throughout the codebase, particularly in wallet-related functionality:
- It's used in
src/wallet/wallet.cpp
for address book operations - It's used in
src/qt/walletmodel.cpp
for transaction validation and address book management - It's used in
src/qt/transactiondesc.cpp
for transaction descriptions - It's used in
src/qt/sendcoinsentry.cpp
andsrc/qt/sendcoinsdialog.cpp
for sending coins - It's used in
src/qt/addresstablemodel.cpp
for address validation
All these usages are in wallet-related code that is already properly guarded with ENABLE_WALLET. The function is clearly part of the wallet functionality and should be conditionally compiled.
Wrap validateSparkAddress method with ENABLE_WALLET to ensure proper compilation when wallet is disabled.
The validateSparkAddress method is used exclusively within wallet-related code paths and depends on wallet functionality. It should be conditionally compiled to maintain consistency with the --disable-wallet build configuration.
🔗 Analysis chain
Consider wrapping validateSparkAddress method with ENABLE_WALLET.
While the conditional inclusion of sparkwallet.h is correct, the validateSparkAddress
method in BitcoinAddressCheckValidator
might also need to be conditionally compiled if it depends on wallet functionality. This would ensure complete isolation of wallet-related code when building with --disable-wallet.
Let's verify if validateSparkAddress uses any wallet-specific functionality:
Consider wrapping the method declaration with ENABLE_WALLET:
class BitcoinAddressCheckValidator : public QValidator
{
Q_OBJECT
public:
explicit BitcoinAddressCheckValidator(QObject *parent);
State validate(QString &input, int &pos) const;
+#ifdef ENABLE_WALLET
bool validateSparkAddress(const std::string& address) const;
+#endif
};
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for validateSparkAddress implementation and its dependencies
ast-grep --pattern 'bool BitcoinAddressCheckValidator::validateSparkAddress($_) { $$$ }'
# Search for any references to wallet-specific types or functions within validateSparkAddress
rg -A 5 "validateSparkAddress.*\{"
Length of output: 15300
No description provided.