This PR makes early check for the -disablewallet option.
If -disablewallet=1, objects PaymentServer and WalletController are nor created.
This PR makes early check for the -disablewallet option.
If -disablewallet=1, objects PaymentServer and WalletController are nor created.
<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--174a7506f384e20aa4161008e828411d-->
No conflicts as of last run.
211 | @@ -211,11 +212,15 @@ BitcoinApplication::~BitcoinApplication() 212 | delete window; 213 | window = nullptr; 214 | #ifdef ENABLE_WALLET 215 | - delete paymentServer; 216 | - paymentServer = nullptr; 217 | - delete m_wallet_controller; 218 | - m_wallet_controller = nullptr; 219 | -#endif 220 | + if (paymentServer) {
This is not necessary, it is safe to delete nullptr.
Or maybe you want to get rid of these delete as these objects are owned by BitcoinApplication instance.
Or maybe you want to get rid of these
deleteas these objects are owned byBitcoinApplicationinstance.
Exactly!
354 | #ifdef ENABLE_WALLET 355 | - window->setWalletController(m_wallet_controller); 356 | + if (WalletModel::isWalletEnabled()) { 357 | + m_wallet_controller = new WalletController(m_node, platformStyle, optionsModel, this); 358 | + window->setWalletController(m_wallet_controller); 359 | + if (paymentServer) {
This could be assert(paymentServer)?
Failing to create a PaymentServer object is not critical, IMO.
Also new will never return a nullptr anyway.
Concept ACK, makes sense to not instantiate these objects when -disablewallet.
It would be nice to remove all ENABLE_WALLET and other similar checks from src/qt/bitcoin.cpp.
nit, commit could also have prefix.
Concept ACK
utACK 4057b7acb7125739537078d026ad96bb21708e3c Removes three #ifdefs, probably very tiny ressource reduction when not running with the wallet.
ACK 4057b7acb7125739537078d026ad96bb21708e3c