Skip to content
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

Global fix disable wallet #3

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 24 additions & 4 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,17 @@ 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 +661,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 +1180,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 +1235,8 @@ 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 @@ -330,6 +330,8 @@ 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 = \
bip47/paymentcode.cpp \
activemasternode.cpp \
addrman.cpp \
addrdb.cpp \
batchedlogger.cpp \
Expand Down
2 changes: 1 addition & 1 deletion src/evo/spork.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,4 @@ class CMempoolSporkManager
ActiveSporkMap GetActiveSporks() const { return mempoolSporks; }
};

#endif
#endif
2 changes: 2 additions & 0 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -971,6 +971,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 @@ -982,6 +983,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
#include "sigma.h"
#include "crypto/sha256.h"
#include "liblelantus/coin.h"
#include "liblelantus/schnorr_prover.h"
Expand Down
1 change: 1 addition & 0 deletions src/llmq/quorums_instantsend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "masternode-sync.h"
#include "net_processing.h"
#include "validation.h"
#include "primitives/mint_spend.h"

#ifdef ENABLE_WALLET
#include "wallet/wallet.h"
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
#include "definition.h"
#include "crypto/scrypt.h"
#include "crypto/MerkleTreeProof/mtp.h"
Expand Down
18 changes: 13 additions & 5 deletions src/qt/bitcoingui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,10 @@ BitcoinGUI::BitcoinGUI(const PlatformStyle *_platformStyle, const NetworkStyle *
this->installEventFilter(this);

// Initially wallet actions should be disabled
#ifdef ENABLE_WALLET
setWalletActionsEnabled(false);

#endif
// Subscribe to notifications from core
subscribeToCoreSignals();

Expand Down Expand Up @@ -462,9 +464,11 @@ void BitcoinGUI::createActions()
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
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 @@ -638,24 +642,24 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel)
{
walletFrame->setClientModel(_clientModel);
}
#endif // ENABLE_WALLET
#endif
unitDisplayControl->setOptionsModel(_clientModel->getOptionsModel());

OptionsModel* optionsModel = _clientModel->getOptionsModel();
if(optionsModel)
{
// be aware of the tray icon disable state change reported by the OptionsModel object.
connect(optionsModel,SIGNAL(hideTrayIconChanged(bool)),this,SLOT(setTrayIconVisible(bool)));

// update lelantus page if option is changed.
connect(optionsModel,SIGNAL(lelantusPageChanged(bool)),this,SLOT(updateLelantusPage()));

// initialize the disable state of the tray icon with the current value in the model.
setTrayIconVisible(optionsModel->getHideTrayIcon());
}
{
#ifdef ENABLE_WALLET
auto blocks = clientModel->getNumBlocks();
checkZnodeVisibility(blocks);
checkZnodeVisibility(blocks);
#endif

#ifdef ENABLE_WALLET
checkSigmaVisibility(blocks);
Expand Down Expand Up @@ -1094,9 +1098,9 @@ void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVer
#ifdef ENABLE_WALLET
checkSigmaVisibility(count);
checkLelantusVisibility(count);
checkZnodeVisibility(count);
#endif // ENABLE_WALLET

checkZnodeVisibility(count);
}


Expand Down Expand Up @@ -1506,7 +1510,9 @@ void BitcoinGUI::checkSigmaVisibility(int numBlocks)
auto allowSigmaPage = sigma::IsSigmaAllowed(numBlocks) && !lelantus::IsLelantusAllowed(numBlocks);
if (allowSigmaPage != sigmaAction->isVisible()) {
if (!allowSigmaPage && sigmaAction->isChecked()) {
#ifdef ENABLE_WALLET
gotoOverviewPage();
#endif
}
sigmaAction->setVisible(allowSigmaPage);
}
Expand All @@ -1523,7 +1529,9 @@ void BitcoinGUI::checkLelantusVisibility(int numBlocks)

if (allowLelantusPage != lelantusAction->isVisible()) {
if (!allowLelantusPage && lelantusAction->isChecked()) {
#ifdef ENABLE_WALLET
gotoOverviewPage();
#endif
}
lelantusAction->setVisible(allowLelantusPage);
}
Expand Down
4 changes: 2 additions & 2 deletions src/qt/bitcoingui.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,11 @@ public Q_SLOTS:
*/
void message(const QString &title, const QString &message, unsigned int style, bool *ret = NULL);

#ifdef ENABLE_WALLET
/** Set the encryption status as shown in the UI.
@param[in] status current encryption status
@see WalletModel::EncryptionStatus
*/
#ifdef ENABLE_WALLET
void setEncryptionStatus(int status);

/** Set the Elysium pending transactions label **/
Expand All @@ -210,7 +210,7 @@ public Q_SLOTS:

/** Show incoming transaction notification for new transactions. */
void incomingTransaction(const QString& date, int unit, const CAmount& amount, const QString& type, const QString& address, const QString& label);
#endif // ENABLE_WALLET
#endif

private Q_SLOTS:
#ifdef ENABLE_WALLET
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
#include "walletmodel.h"

#include <univalue.h>
Expand Down
1 change: 1 addition & 0 deletions src/qt/pcodemodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#define PCODEMODEL_H

#include "walletmodel.h"
#include "../bip47/paymentcode.h"

#include <QAbstractTableModel>
#include <QStringList>
Expand Down
6 changes: 5 additions & 1 deletion 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
#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;
}
}
4 changes: 3 additions & 1 deletion src/qt/walletmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@

#include "support/allocators/secure.h"

#include "wallet/walletdb.h"
#ifdef ENABLE_WALLET
#include "wallet/wallet.h"
#include "wallet/walletdb.h"
#endif
#include "wallet/coincontrol.h"

#include <map>
Expand Down
2 changes: 2 additions & 0 deletions src/rpc/masternode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
#include "utilmoneystr.h"
#include "txmempool.h"

#ifdef ENABLE_WALLET
#include "wallet/wallet.h"
#endif
#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 @@ -21,6 +21,7 @@
#endif
#include "txdb.h"

#include "sigma.h"
#include "masternode-sync.h"

#include <stdint.h>
Expand Down
8 changes: 6 additions & 2 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 @@ -937,7 +937,7 @@ UniValue protx_list(const JSONRPCRequest& request)
CWallet* const pwallet = GetWalletForJSONRPCRequest(request);
#else
CWallet* const pwallet = nullptr;
#endif
#endif // ENABLE_WALLET

std::string type = "registered";
if (request.params.size() > 1) {
Expand Down Expand Up @@ -1298,13 +1298,15 @@ UniValue spork(const JSONRPCRequest& request)
spork_help();

// create spork
#ifdef ENABLE_WALLET
CWallet* const pwallet = GetWalletForJSONRPCRequest(request);
CKey secretKey = ParsePrivKey(pwallet, request.params[0].get_str(), true);
CKeyID publicKeyID;

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()) {
Expand Down Expand Up @@ -1419,11 +1421,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
#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
#include "batchproof_container.h"
#include "sigma.h"
#include "lelantus.h"
Expand Down
Loading