From 0414c9725831a4ebfcc3593876a9526ebfa1922f Mon Sep 17 00:00:00 2001 From: levoncrypto <95240473+levoncrypto@users.noreply.github.com> Date: Thu, 12 Oct 2023 10:28:08 +0400 Subject: [PATCH] Depends NO_WALLET=1 setting fix (#1321) --- configure.ac | 28 ++++++++++++++++++++++++---- src/Makefile.am | 2 ++ src/init.cpp | 2 ++ src/lelantus.cpp | 3 +++ src/llmq/quorums_instantsend.cpp | 2 +- src/miner.cpp | 2 ++ src/qt/bitcoingui.cpp | 16 ++++++++++------ src/qt/masternodelist.cpp | 2 ++ src/qt/pcodemodel.h | 2 +- src/qt/recover.cpp | 4 ++++ src/qt/walletmodel.h | 3 ++- src/rpc/masternode.cpp | 3 ++- src/rpc/misc.cpp | 1 + src/rpc/rpcevo.cpp | 8 +++++--- src/sigma.cpp | 2 ++ src/validation.cpp | 2 ++ src/wallet/wallet.h | 2 ++ 17 files changed, 67 insertions(+), 17 deletions(-) diff --git a/configure.ac b/configure.ac index d4a8fd9732..dfbdddd117 100644 --- a/configure.ac +++ b/configure.ac @@ -92,7 +92,18 @@ AC_PATH_TOOL(OBJCOPY, objcopy) AC_ARG_VAR(PYTHONPATH, Augments the default search path for python module files) # Enable wallet -enable_wallet=yes +AC_ARG_ENABLE([wallet], + [AS_HELP_STRING([--disable-wallet], + [disable wallet (enabled by default)])], + [enable_wallet=$enableval], + [enable_wallet=yes]) + +AC_ARG_WITH([bdb], + [AS_HELP_STRING([--without-bdb], + [disable bdb wallet support (default is enabled if wallet is enabled)])], + [use_bdb=$withval], + [use_bdb=auto]) + AC_ARG_ENABLE([elysium], [AS_HELP_STRING([--enable-elysium],[enable elysium (disabled by default)])], @@ -651,9 +662,11 @@ AC_SUBST(LEVELDB_CPPFLAGS) AC_SUBST(LIBLEVELDB) AC_SUBST(LIBMEMENV) -if test x$enable_wallet != xno; then - dnl Check for libdb_cxx only if wallet enabled - BITCOIN_FIND_BDB48 +if test "$enable_wallet" != "no"; then + dnl Check for libdb_cxx only if wallet enabled + if test "$use_bdb" != "no"; then + BITCOIN_FIND_BDB48 + fi fi dnl Check for libminiupnpc (optional) @@ -1168,6 +1181,7 @@ AM_CONDITIONAL([USE_LCOV],[test x$use_lcov = xyes]) AM_CONDITIONAL([GLIBC_BACK_COMPAT],[test x$use_glibc_compat = xyes]) AM_CONDITIONAL([HARDEN],[test x$use_hardening = xyes]) AM_CONDITIONAL([ENABLE_SSE42],[test x$enable_sse42 = xyes]) +AM_CONDITIONAL([USE_BDB], [test "$use_bdb" = "yes"]) AC_DEFINE(CLIENT_VERSION_MAJOR, _CLIENT_VERSION_MAJOR, [Major version]) AC_DEFINE(CLIENT_VERSION_MINOR, _CLIENT_VERSION_MINOR, [Minor version]) @@ -1222,6 +1236,7 @@ AC_SUBST(ZMQ_LIBS) AC_SUBST(PROTOBUF_LIBS) AC_SUBST(QR_LIBS) AC_SUBST(DSYMUTIL_FLAT) +AC_SUBST(USE_BDB) AC_CONFIG_FILES([Makefile src/Makefile share/setup.nsi share/qt/Info.plist src/test/buildenv.py]) AC_CONFIG_FILES([qa/pull-tester/tests_config.py],[chmod +x qa/pull-tester/tests_config.py]) AC_CONFIG_FILES([contrib/devtools/split-debug.sh],[chmod +x contrib/devtools/split-debug.sh]) @@ -1291,6 +1306,11 @@ if test x$bitcoin_enable_qt != xno; then echo " qt version = $bitcoin_qt_got_major_vers" echo " with qr = $use_qr" fi + +if test "$enable_wallet" != "no"; then + echo " with bdb = $use_bdb" +fi + echo " with zmq = $use_zmq" echo " with test = $use_tests" echo " with bench = $use_bench" diff --git a/src/Makefile.am b/src/Makefile.am index 69e55d3d9f..005a93bc0e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -335,6 +335,7 @@ libbitcoin_util_a-clientversion.$(OBJEXT): obj/build.h libbitcoin_server_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(MINIUPNPC_CPPFLAGS) $(EVENT_CFLAGS) $(EVENT_PTHREADS_CFLAGS) libbitcoin_server_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) libbitcoin_server_a_SOURCES = \ + activemasternode.cpp \ addrman.cpp \ addrdb.cpp \ batchedlogger.cpp \ @@ -407,6 +408,7 @@ libbitcoin_server_a_SOURCES = \ sigma.cpp \ lelantus.cpp \ spark/state.cpp \ + spark/primitives.cpp \ coin_containers.cpp \ mtpstate.cpp \ $(BITCOIN_CORE_H) diff --git a/src/init.cpp b/src/init.cpp index b8f7234ba7..ef2d083275 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -972,6 +972,7 @@ void InitParameterInteraction() LogPrintf("%s: parameter interaction: -whitelistforcerelay=1 -> setting -whitelistrelay=1\n", __func__); } +#ifdef ENABLE_WALLET // Forcing all mnemonic settings off if -usehd is off. if (!GetBoolArg("-usehd", DEFAULT_USE_HD_WALLET)) { if (SoftSetBoolArg("-usemnemonic", false) && SoftSetArg("-mnemonic", "") && SoftSetArg("-mnemonicpassphrase", "") && SoftSetArg("-hdseed", "not hex")) @@ -983,6 +984,7 @@ void InitParameterInteraction() if (SoftSetArg("-mnemonic", "") && SoftSetArg("-mnemonicpassphrase", "") && SoftSetArg("-hdseed", "not hex")) LogPrintf("%s: Potential parameter interaction: -usemnemonic=0 -> setting -mnemonic=\"\", -mnemonicpassphrase=\"\"\n, -hdseed=\"not hex\"\n", __func__); } +#endif // ENABLE_WALLET } static std::string ResolveErrMsg(const char *const optname, const std::string &strBind) { diff --git a/src/lelantus.cpp b/src/lelantus.cpp index 9c71202e1b..57a0f29687 100644 --- a/src/lelantus.cpp +++ b/src/lelantus.cpp @@ -6,8 +6,11 @@ #include "base58.h" #include "definition.h" #include "txmempool.h" +#ifdef ENABLE_WALLET #include "wallet/wallet.h" #include "wallet/walletdb.h" +#endif // ENABLE_WALLET +#include "sigma.h" #include "crypto/sha256.h" #include "liblelantus/coin.h" #include "liblelantus/schnorr_prover.h" diff --git a/src/llmq/quorums_instantsend.cpp b/src/llmq/quorums_instantsend.cpp index 8496b341d1..9db3cade75 100644 --- a/src/llmq/quorums_instantsend.cpp +++ b/src/llmq/quorums_instantsend.cpp @@ -18,7 +18,7 @@ #ifdef ENABLE_WALLET #include "wallet/wallet.h" #endif - +#include "primitives/mint_spend.h" #include #include #include diff --git a/src/miner.cpp b/src/miner.cpp index 2d9f3d95d5..fee39aaff0 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -25,7 +25,9 @@ #include "util.h" #include "utilmoneystr.h" #include "validationinterface.h" +#ifdef ENABLE_WALLET #include "wallet/wallet.h" +#endif // ENABLE_WALLET #include "definition.h" #include "crypto/scrypt.h" #include "crypto/MerkleTreeProof/mtp.h" diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index fb8a0f5191..bbffd0a4c2 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -284,9 +284,10 @@ BitcoinGUI::BitcoinGUI(const PlatformStyle *_platformStyle, const NetworkStyle * // Install event filter to be able to catch status tip events (QEvent::StatusTip) this->installEventFilter(this); - +#ifdef ENABLE_WALLET // Initially wallet actions should be disabled setWalletActionsEnabled(false); +#endif // ENABLE_WALLET // Subscribe to notifications from core subscribeToCoreSignals(); @@ -456,10 +457,11 @@ void BitcoinGUI::createActions() optionsAction->setEnabled(false); toggleHideAction = new QAction(tr("&Show / Hide"), this); toggleHideAction->setStatusTip(tr("Show or hide the main Window")); - +#ifdef ENABLE_WALLET encryptWalletAction = new QAction(tr("&Encrypt Wallet..."), this); encryptWalletAction->setStatusTip(tr("Encrypt the private keys that belong to your wallet")); encryptWalletAction->setCheckable(true); +#endif // ENABLE_WALLET backupWalletAction = new QAction(tr("&Backup Wallet..."), this); backupWalletAction->setStatusTip(tr("Backup wallet to another location")); changePassphraseAction = new QAction(tr("&Change Passphrase..."), this); @@ -655,10 +657,9 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel) setTrayIconVisible(optionsModel->getHideTrayIcon()); } { +#ifdef ENABLE_WALLET auto blocks = clientModel->getNumBlocks(); checkZnodeVisibility(blocks); - -#ifdef ENABLE_WALLET checkLelantusVisibility(blocks); #endif // ENABLE_WALLET } @@ -1085,9 +1086,8 @@ void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVer #ifdef ENABLE_WALLET checkLelantusVisibility(count); -#endif // ENABLE_WALLET - checkZnodeVisibility(count); +#endif // ENABLE_WALLET } @@ -1452,7 +1452,9 @@ void BitcoinGUI::updateLelantusPage() void BitcoinGUI::setRapAddressesVisible(bool checked) { +#ifdef ENABLE_WALLET gotoOverviewPage(); +#endif // ENABLE_WALLET createPcodeAction->setVisible(checked); } @@ -1509,7 +1511,9 @@ void BitcoinGUI::checkLelantusVisibility(int numBlocks) if (allowLelantusPage != lelantusAction->isVisible()) { if (!allowLelantusPage && lelantusAction->isChecked()) { +#ifdef ENABLE_WALLET gotoOverviewPage(); +#endif // ENABLE_WALLET } lelantusAction->setVisible(allowLelantusPage); } diff --git a/src/qt/masternodelist.cpp b/src/qt/masternodelist.cpp index 08b9199511..a5b5e399e0 100644 --- a/src/qt/masternodelist.cpp +++ b/src/qt/masternodelist.cpp @@ -10,7 +10,9 @@ #include "netbase.h" #include "sync.h" #include "validation.h" +#ifdef ENABLE_WALLET #include "wallet/wallet.h" +#endif // ENABLE_WALLET #include "walletmodel.h" #include diff --git a/src/qt/pcodemodel.h b/src/qt/pcodemodel.h index 170ce5738b..7d9e960503 100644 --- a/src/qt/pcodemodel.h +++ b/src/qt/pcodemodel.h @@ -6,7 +6,7 @@ #define PCODEMODEL_H #include "walletmodel.h" - +#include "../bip47/paymentcode.h" #include #include #include diff --git a/src/qt/recover.cpp b/src/qt/recover.cpp index 8ac7ba9106..ba0611bebf 100644 --- a/src/qt/recover.cpp +++ b/src/qt/recover.cpp @@ -5,7 +5,9 @@ #include "util.h" +#ifdef ENABLE_WALLET #include "../wallet/wallet.h" +#endif // ENABLE_WALLET #include "../wallet/bip39.h" #include "support/allocators/secure.h" @@ -79,6 +81,7 @@ void Recover::on_usePassphrase_clicked() bool Recover::askRecover(bool& newWallet) { +#ifdef ENABLE_WALLET namespace fs = boost::filesystem; fs::path walletFile = GetDataDir(true) / GetArg("-wallet", DEFAULT_WALLET_DAT); @@ -167,5 +170,6 @@ bool Recover::askRecover(bool& newWallet) } } } +#endif // ENABLE_WALLET return true; } \ No newline at end of file diff --git a/src/qt/walletmodel.h b/src/qt/walletmodel.h index 280faeb98e..582e585fce 100644 --- a/src/qt/walletmodel.h +++ b/src/qt/walletmodel.h @@ -9,9 +9,10 @@ #include "walletmodeltransaction.h" #include "support/allocators/secure.h" - +#ifdef ENABLE_WALLET #include "wallet/walletdb.h" #include "wallet/wallet.h" +#endif // ENABLE_WALLET #include "wallet/coincontrol.h" #include diff --git a/src/rpc/masternode.cpp b/src/rpc/masternode.cpp index 9aa8615d13..30dbcba27c 100644 --- a/src/rpc/masternode.cpp +++ b/src/rpc/masternode.cpp @@ -14,8 +14,9 @@ #include "util.h" #include "utilmoneystr.h" #include "txmempool.h" - +#ifdef ENABLE_WALLET #include "wallet/wallet.h" +#endif // ENABLE_WALLET #include "wallet/rpcwallet.h" #include "wallet/coincontrol.h" diff --git a/src/rpc/misc.cpp b/src/rpc/misc.cpp index 6c0c3cac9d..9c52e50a05 100644 --- a/src/rpc/misc.cpp +++ b/src/rpc/misc.cpp @@ -19,6 +19,7 @@ #include "wallet/wallet.h" #include "wallet/walletdb.h" #endif +#include "sigma.h" #include "txdb.h" #include "masternode-sync.h" diff --git a/src/rpc/rpcevo.cpp b/src/rpc/rpcevo.cpp index a46264548a..14cd7d9dcb 100644 --- a/src/rpc/rpcevo.cpp +++ b/src/rpc/rpcevo.cpp @@ -12,11 +12,11 @@ #include "validation.h" #ifdef ENABLE_WALLET -#include "wallet/coincontrol.h" #include "wallet/wallet.h" #include "wallet/rpcwallet.h" #endif//ENABLE_WALLET +#include "wallet/coincontrol.h" #include "netbase.h" #include "evo/specialtx.h" @@ -1297,6 +1297,7 @@ UniValue spork(const JSONRPCRequest& request) else if (request.params.size() != 3) spork_help(); +#ifdef ENABLE_WALLET // create spork CWallet* const pwallet = GetWalletForJSONRPCRequest(request); CKey secretKey = ParsePrivKey(pwallet, request.params[0].get_str(), true); @@ -1305,12 +1306,12 @@ UniValue spork(const JSONRPCRequest& request) if (!CBitcoinAddress(Params().GetConsensus().evoSporkKeyID).GetKeyID(publicKeyID) || secretKey.GetPubKey().GetID() != publicKeyID) { throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "incorrect spork secret key"); } +#endif // ENABLE_WALLET CBitcoinAddress feeAddress(request.params[1].get_str()); if (!feeAddress.IsValid()) { throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, strprintf("invalid payout address: %s", request.params[1].get_str())); } - CSporkTx sporkTx; UniValue sporkEnableOrDisableObj = request.params[2].get_obj(); std::vector enableOrDisableKeys = sporkEnableOrDisableObj.getKeys(); @@ -1418,12 +1419,13 @@ UniValue spork(const JSONRPCRequest& request) // make sure fee calculation works correctly sporkTx.vchSig.resize(65); - +#ifdef ENABLE_WALLET FundSpecialTx(pwallet, tx, sporkTx, feeAddress.Get()); SignSpecialTxPayloadByHash(tx, sporkTx, secretKey); SetTxPayload(tx, sporkTx); return SignAndSendSpecialTx(tx); +#endif // ENABLE_WALLET } static const CRPCCommand commands[] = diff --git a/src/sigma.cpp b/src/sigma.cpp index 1958c19e02..ae32d83b3a 100644 --- a/src/sigma.cpp +++ b/src/sigma.cpp @@ -6,8 +6,10 @@ #include "base58.h" #include "definition.h" #include "txmempool.h" +#ifdef ENABLE_WALLET #include "wallet/wallet.h" #include "wallet/walletdb.h" +#endif // ENABLE_WALLET #include "crypto/sha256.h" #include "sigma/coinspend.h" #include "sigma/coin.h" diff --git a/src/validation.cpp b/src/validation.cpp index b8edbf0320..aad1ea69f1 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -37,8 +37,10 @@ #include "ui_interface.h" #include "undo.h" #include "util.h" +#ifdef ENABLE_WALLET #include "wallet/wallet.h" #include "wallet/walletdb.h" +#endif // ENABLE_WALLET #include "batchproof_container.h" #include "sigma.h" #include "lelantus.h" diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index 6ea15a2ef8..3f147fbfa0 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -17,7 +17,9 @@ #include "script/ismine.h" #include "script/sign.h" #include "wallet/crypter.h" +#ifdef ENABLE_WALLET #include "wallet/walletdb.h" +#endif // ENABLE_WALLET #include "wallet/rpcwallet.h" #include "wallet/mnemoniccontainer.h" #include "../spark/sparkwallet.h"