Skip to content

Commit

Permalink
Depends NO_WALLET=1 setting fix (#1321)
Browse files Browse the repository at this point in the history
  • Loading branch information
levoncrypto authored Oct 12, 2023
1 parent 2139866 commit 0414c97
Show file tree
Hide file tree
Showing 17 changed files with 67 additions and 17 deletions.
28 changes: 24 additions & 4 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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)])],
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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])
Expand Down Expand Up @@ -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])
Expand Down Expand Up @@ -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"
Expand Down
2 changes: 2 additions & 0 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand All @@ -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) {
Expand Down
3 changes: 3 additions & 0 deletions src/lelantus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion src/llmq/quorums_instantsend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#ifdef ENABLE_WALLET
#include "wallet/wallet.h"
#endif

#include "primitives/mint_spend.h"
#include <boost/algorithm/string/replace.hpp>
#include <boost/thread.hpp>
#include <limits>
Expand Down
2 changes: 2 additions & 0 deletions src/miner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
16 changes: 10 additions & 6 deletions src/qt/bitcoingui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}


Expand Down Expand Up @@ -1452,7 +1452,9 @@ void BitcoinGUI::updateLelantusPage()

void BitcoinGUI::setRapAddressesVisible(bool checked)
{
#ifdef ENABLE_WALLET
gotoOverviewPage();
#endif // ENABLE_WALLET
createPcodeAction->setVisible(checked);
}

Expand Down Expand Up @@ -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);
}
Expand Down
2 changes: 2 additions & 0 deletions src/qt/masternodelist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <univalue.h>
Expand Down
2 changes: 1 addition & 1 deletion src/qt/pcodemodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#define PCODEMODEL_H

#include "walletmodel.h"

#include "../bip47/paymentcode.h"
#include <QAbstractTableModel>
#include <QStringList>
#include <QDateTime>
Expand Down
4 changes: 4 additions & 0 deletions src/qt/recover.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -167,5 +170,6 @@ bool Recover::askRecover(bool& newWallet)
}
}
}
#endif // ENABLE_WALLET
return true;
}
3 changes: 2 additions & 1 deletion src/qt/walletmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <map>
Expand Down
3 changes: 2 additions & 1 deletion src/rpc/masternode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
1 change: 1 addition & 0 deletions src/rpc/misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "wallet/wallet.h"
#include "wallet/walletdb.h"
#endif
#include "sigma.h"
#include "txdb.h"

#include "masternode-sync.h"
Expand Down
8 changes: 5 additions & 3 deletions src/rpc/rpcevo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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);
Expand All @@ -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<std::string> enableOrDisableKeys = sporkEnableOrDisableObj.getKeys();
Expand Down Expand Up @@ -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[] =
Expand Down
2 changes: 2 additions & 0 deletions src/sigma.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 2 additions & 0 deletions src/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 2 additions & 0 deletions src/wallet/wallet.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 0414c97

Please sign in to comment.