From 6b4adeeae84a53df94960693829a6f6025c486b1 Mon Sep 17 00:00:00 2001 From: levoncrypto Date: Sun, 5 Jun 2022 17:04:45 +0400 Subject: [PATCH 1/5] Fixing disable-wallet configuration --- src/Makefile.am | 2 ++ src/evo/spork.h | 2 +- src/hdmint/tracker.h | 4 ++++ src/init.cpp | 2 ++ src/lelantus.cpp | 6 +++++- src/llmq/quorums_instantsend.cpp | 1 + src/miner.cpp | 4 ++++ src/qt/bitcoin.cpp | 1 - src/qt/bitcoingui.cpp | 24 ++++++++++++++++++------ src/qt/bitcoingui.h | 5 +++-- src/qt/masternodelist.cpp | 4 ++++ src/qt/pcodemodel.h | 1 + src/qt/recover.cpp | 8 ++++++-- src/qt/walletmodel.h | 5 ++++- src/rpc/masternode.cpp | 3 +++ src/rpc/misc.cpp | 3 +++ src/rpc/rawtransaction.cpp | 1 - src/rpc/rpcevo.cpp | 13 ++++++++----- src/sigma.cpp | 4 ++++ src/validation.cpp | 4 ++++ src/wallet/db.h | 1 - src/wallet/rpcwallet.cpp | 1 + src/wallet/rpcwallet.h | 1 + src/wallet/wallet.cpp | 1 + src/wallet/wallet.h | 4 ++++ src/wallet/walletdb.cpp | 2 ++ src/wallet/walletdb.h | 2 ++ 27 files changed, 88 insertions(+), 21 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index afeb99539e..db5e2daa89 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -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 \ diff --git a/src/evo/spork.h b/src/evo/spork.h index 4087513813..21113a1554 100644 --- a/src/evo/spork.h +++ b/src/evo/spork.h @@ -151,4 +151,4 @@ class CMempoolSporkManager ActiveSporkMap GetActiveSporks() const { return mempoolSporks; } }; -#endif \ No newline at end of file +#endif diff --git a/src/hdmint/tracker.h b/src/hdmint/tracker.h index 5e87e8a045..1598ac3594 100644 --- a/src/hdmint/tracker.h +++ b/src/hdmint/tracker.h @@ -7,7 +7,11 @@ #include "primitives/mint_spend.h" #include "hdmint/mintpool.h" + + #include "wallet/walletdb.h" + + #include class CHDMint; diff --git a/src/init.cpp b/src/init.cpp index ae9fa59906..7769ff0a75 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -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")) @@ -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) { diff --git a/src/lelantus.cpp b/src/lelantus.cpp index 7a973a7929..0bfe9764fc 100644 --- a/src/lelantus.cpp +++ b/src/lelantus.cpp @@ -6,8 +6,13 @@ #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" @@ -17,7 +22,6 @@ #include "policy/policy.h" #include "coins.h" #include "batchproof_container.h" - #include #include #include diff --git a/src/llmq/quorums_instantsend.cpp b/src/llmq/quorums_instantsend.cpp index a9e9310f38..0e31e7ca8d 100644 --- a/src/llmq/quorums_instantsend.cpp +++ b/src/llmq/quorums_instantsend.cpp @@ -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" diff --git a/src/miner.cpp b/src/miner.cpp index c514d649cc..4f180c793a 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -25,7 +25,11 @@ #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" diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index 2e1b3cd79e..7f34930dd9 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -475,7 +475,6 @@ void BitcoinApplication::initializeResult(int retval) PaymentServer::LoadRootCAs(); paymentServer->setOptionsModel(optionsModel); #endif - clientModel = new ClientModel(optionsModel); window->setClientModel(clientModel); diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 99fa850b0a..b478bd01a3 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -22,6 +22,7 @@ #include "rpcconsole.h" #include "utilitydialog.h" + #ifdef ENABLE_WALLET #include "walletframe.h" #include "walletmodel.h" @@ -284,8 +285,9 @@ 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(); @@ -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); @@ -638,7 +642,7 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel) { walletFrame->setClientModel(_clientModel); } -#endif // ENABLE_WALLET +#endif unitDisplayControl->setOptionsModel(_clientModel->getOptionsModel()); OptionsModel* optionsModel = _clientModel->getOptionsModel(); @@ -646,16 +650,16 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel) { // 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); @@ -1094,9 +1098,10 @@ void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVer #ifdef ENABLE_WALLET checkSigmaVisibility(count); checkLelantusVisibility(count); + checkZnodeVisibility(count); #endif // ENABLE_WALLET - checkZnodeVisibility(count); + } @@ -1312,6 +1317,7 @@ bool BitcoinGUI::eventFilter(QObject *object, QEvent *event) bool BitcoinGUI::handlePaymentRequest(const SendCoinsRecipient& recipient) { // URI has to be valid + if (walletFrame && walletFrame->handlePaymentRequest(recipient)) { showNormalIfMinimized(); @@ -1321,6 +1327,7 @@ bool BitcoinGUI::handlePaymentRequest(const SendCoinsRecipient& recipient) return false; } + void BitcoinGUI::setElysiumPendingStatus(bool pending) { if (!pending) { @@ -1506,10 +1513,13 @@ 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); } + } void BitcoinGUI::checkLelantusVisibility(int numBlocks) @@ -1523,7 +1533,9 @@ void BitcoinGUI::checkLelantusVisibility(int numBlocks) if (allowLelantusPage != lelantusAction->isVisible()) { if (!allowLelantusPage && lelantusAction->isChecked()) { +#ifdef ENABLE_WALLET gotoOverviewPage(); +#endif } lelantusAction->setVisible(allowLelantusPage); } diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h index 8a6cf41adc..d2e18ba03c 100644 --- a/src/qt/bitcoingui.h +++ b/src/qt/bitcoingui.h @@ -191,11 +191,12 @@ 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 **/ @@ -210,7 +211,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 diff --git a/src/qt/masternodelist.cpp b/src/qt/masternodelist.cpp index 8d368130dd..480edad246 100644 --- a/src/qt/masternodelist.cpp +++ b/src/qt/masternodelist.cpp @@ -10,7 +10,11 @@ #include "netbase.h" #include "sync.h" #include "validation.h" + +#ifdef ENABLE_WALLET #include "wallet/wallet.h" +#endif + #include "walletmodel.h" #include diff --git a/src/qt/pcodemodel.h b/src/qt/pcodemodel.h index 170ce5738b..14fd4deb14 100644 --- a/src/qt/pcodemodel.h +++ b/src/qt/pcodemodel.h @@ -6,6 +6,7 @@ #define PCODEMODEL_H #include "walletmodel.h" +#include "../bip47/paymentcode.h" #include #include diff --git a/src/qt/recover.cpp b/src/qt/recover.cpp index 313e69360f..280eff0f35 100644 --- a/src/qt/recover.cpp +++ b/src/qt/recover.cpp @@ -5,7 +5,10 @@ #include "util.h" +#ifdef ENABLE_WALLET #include "../wallet/wallet.h" +#endif + #include "../wallet/bip39.h" #include "support/allocators/secure.h" @@ -79,9 +82,9 @@ 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); - if (!fs::exists(walletFile)) { newWallet = true; @@ -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 70a835c554..4eb41c95f4 100644 --- a/src/qt/walletmodel.h +++ b/src/qt/walletmodel.h @@ -10,8 +10,11 @@ #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 diff --git a/src/rpc/masternode.cpp b/src/rpc/masternode.cpp index 9aa8615d13..89a4b64a76 100644 --- a/src/rpc/masternode.cpp +++ b/src/rpc/masternode.cpp @@ -15,7 +15,10 @@ #include "utilmoneystr.h" #include "txmempool.h" +#ifdef ENABLE_WALLET #include "wallet/wallet.h" +#endif + #include "wallet/rpcwallet.h" #include "wallet/coincontrol.h" diff --git a/src/rpc/misc.cpp b/src/rpc/misc.cpp index 555733bd35..c58a6c3398 100644 --- a/src/rpc/misc.cpp +++ b/src/rpc/misc.cpp @@ -14,13 +14,16 @@ #include "txmempool.h" #include "util.h" #include "utilstrencodings.h" + #ifdef ENABLE_WALLET #include "wallet/rpcwallet.h" #include "wallet/wallet.h" #include "wallet/walletdb.h" #endif + #include "txdb.h" +#include "sigma.h" #include "masternode-sync.h" #include diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp index c21827c6aa..d0f5c8e10f 100644 --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -28,7 +28,6 @@ #include "wallet/rpcwallet.h" #include "wallet/wallet.h" #endif - #include #include #include diff --git a/src/rpc/rpcevo.cpp b/src/rpc/rpcevo.cpp index a46264548a..3e3171fe1a 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" @@ -666,7 +666,6 @@ UniValue protx_update_service(const JSONRPCRequest& request) } FundSpecialTx(pwallet, tx, ptx, feeSource); - SignSpecialTxPayloadByHash(tx, ptx, keyOperator); SetTxPayload(tx, ptx); @@ -932,12 +931,11 @@ UniValue protx_list(const JSONRPCRequest& request) if (request.fHelp) { protx_list_help(); } - #ifdef ENABLE_WALLET CWallet* const pwallet = GetWalletForJSONRPCRequest(request); #else CWallet* const pwallet = nullptr; -#endif +#endif // ENABLE_WALLET std::string type = "registered"; if (request.params.size() > 1) { @@ -1278,6 +1276,7 @@ static UniValue spork_listToJSON(const std::map diff --git a/src/wallet/walletdb.h b/src/wallet/walletdb.h index 585be7e41b..a9eedda072 100644 --- a/src/wallet/walletdb.h +++ b/src/wallet/walletdb.h @@ -9,7 +9,9 @@ #include "amount.h" #include "primitives/transaction.h" #include "primitives/mint_spend.h" + #include "wallet/db.h" + #include "mnemoniccontainer.h" #include "streams.h" #include "key.h" From 45adf39fb2a576c307b5c841b8931ef31bfb6784 Mon Sep 17 00:00:00 2001 From: levoncrypto Date: Sun, 5 Jun 2022 19:48:39 +0400 Subject: [PATCH 2/5] Coding stile fix --- src/evo/spork.h | 1 - src/hdmint/tracker.h | 4 ---- src/qt/bitcoingui.cpp | 4 ---- src/qt/bitcoingui.h | 1 - src/qt/masternodelist.cpp | 2 -- src/qt/recover.cpp | 1 - src/qt/walletmodel.h | 1 - src/rpc/masternode.cpp | 1 - src/rpc/misc.cpp | 2 -- src/rpc/rpcevo.cpp | 2 -- src/sigma.cpp | 2 -- src/validation.cpp | 2 -- src/wallet/rpcwallet.cpp | 1 - src/wallet/rpcwallet.h | 1 - src/wallet/wallet.cpp | 1 - src/wallet/wallet.h | 2 -- src/wallet/walletdb.cpp | 2 -- src/wallet/walletdb.h | 2 -- 18 files changed, 32 deletions(-) diff --git a/src/evo/spork.h b/src/evo/spork.h index 21113a1554..299dad117f 100644 --- a/src/evo/spork.h +++ b/src/evo/spork.h @@ -150,5 +150,4 @@ class CMempoolSporkManager bool IsTransactionAllowed(const CTransaction &tx, CValidationState &state) const; ActiveSporkMap GetActiveSporks() const { return mempoolSporks; } }; - #endif diff --git a/src/hdmint/tracker.h b/src/hdmint/tracker.h index 1598ac3594..5e87e8a045 100644 --- a/src/hdmint/tracker.h +++ b/src/hdmint/tracker.h @@ -7,11 +7,7 @@ #include "primitives/mint_spend.h" #include "hdmint/mintpool.h" - - #include "wallet/walletdb.h" - - #include class CHDMint; diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index b478bd01a3..b5aa6f62c5 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -22,7 +22,6 @@ #include "rpcconsole.h" #include "utilitydialog.h" - #ifdef ENABLE_WALLET #include "walletframe.h" #include "walletmodel.h" @@ -1317,7 +1316,6 @@ bool BitcoinGUI::eventFilter(QObject *object, QEvent *event) bool BitcoinGUI::handlePaymentRequest(const SendCoinsRecipient& recipient) { // URI has to be valid - if (walletFrame && walletFrame->handlePaymentRequest(recipient)) { showNormalIfMinimized(); @@ -1327,7 +1325,6 @@ bool BitcoinGUI::handlePaymentRequest(const SendCoinsRecipient& recipient) return false; } - void BitcoinGUI::setElysiumPendingStatus(bool pending) { if (!pending) { @@ -1519,7 +1516,6 @@ void BitcoinGUI::checkSigmaVisibility(int numBlocks) } sigmaAction->setVisible(allowSigmaPage); } - } void BitcoinGUI::checkLelantusVisibility(int numBlocks) diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h index d2e18ba03c..b858166bd3 100644 --- a/src/qt/bitcoingui.h +++ b/src/qt/bitcoingui.h @@ -191,7 +191,6 @@ public Q_SLOTS: */ void message(const QString &title, const QString &message, unsigned int style, bool *ret = NULL); - /** Set the encryption status as shown in the UI. @param[in] status current encryption status @see WalletModel::EncryptionStatus diff --git a/src/qt/masternodelist.cpp b/src/qt/masternodelist.cpp index 480edad246..4179600ded 100644 --- a/src/qt/masternodelist.cpp +++ b/src/qt/masternodelist.cpp @@ -10,11 +10,9 @@ #include "netbase.h" #include "sync.h" #include "validation.h" - #ifdef ENABLE_WALLET #include "wallet/wallet.h" #endif - #include "walletmodel.h" #include diff --git a/src/qt/recover.cpp b/src/qt/recover.cpp index 280eff0f35..78742ab54d 100644 --- a/src/qt/recover.cpp +++ b/src/qt/recover.cpp @@ -8,7 +8,6 @@ #ifdef ENABLE_WALLET #include "../wallet/wallet.h" #endif - #include "../wallet/bip39.h" #include "support/allocators/secure.h" diff --git a/src/qt/walletmodel.h b/src/qt/walletmodel.h index 4eb41c95f4..6987183d7f 100644 --- a/src/qt/walletmodel.h +++ b/src/qt/walletmodel.h @@ -14,7 +14,6 @@ #include "wallet/wallet.h" #include "wallet/walletdb.h" #endif - #include "wallet/coincontrol.h" #include diff --git a/src/rpc/masternode.cpp b/src/rpc/masternode.cpp index 89a4b64a76..14e30e98b3 100644 --- a/src/rpc/masternode.cpp +++ b/src/rpc/masternode.cpp @@ -18,7 +18,6 @@ #ifdef ENABLE_WALLET #include "wallet/wallet.h" #endif - #include "wallet/rpcwallet.h" #include "wallet/coincontrol.h" diff --git a/src/rpc/misc.cpp b/src/rpc/misc.cpp index c58a6c3398..79fef7f25b 100644 --- a/src/rpc/misc.cpp +++ b/src/rpc/misc.cpp @@ -14,13 +14,11 @@ #include "txmempool.h" #include "util.h" #include "utilstrencodings.h" - #ifdef ENABLE_WALLET #include "wallet/rpcwallet.h" #include "wallet/wallet.h" #include "wallet/walletdb.h" #endif - #include "txdb.h" #include "sigma.h" diff --git a/src/rpc/rpcevo.cpp b/src/rpc/rpcevo.cpp index 3e3171fe1a..4beca40601 100644 --- a/src/rpc/rpcevo.cpp +++ b/src/rpc/rpcevo.cpp @@ -1276,7 +1276,6 @@ static UniValue spork_listToJSON(const std::map diff --git a/src/wallet/walletdb.h b/src/wallet/walletdb.h index a9eedda072..585be7e41b 100644 --- a/src/wallet/walletdb.h +++ b/src/wallet/walletdb.h @@ -9,9 +9,7 @@ #include "amount.h" #include "primitives/transaction.h" #include "primitives/mint_spend.h" - #include "wallet/db.h" - #include "mnemoniccontainer.h" #include "streams.h" #include "key.h" From ba33d5f311e8c45765950a533e6d73aaa6b92545 Mon Sep 17 00:00:00 2001 From: levoncrypto Date: Sun, 5 Jun 2022 21:05:35 +0400 Subject: [PATCH 3/5] Coding stile fix --- src/lelantus.cpp | 3 +-- src/miner.cpp | 2 -- src/qt/bitcoin.cpp | 1 + src/qt/bitcoingui.cpp | 2 +- src/qt/recover.cpp | 1 + src/rpc/rawtransaction.cpp | 1 + src/rpc/rpcevo.cpp | 3 +++ src/wallet/db.h | 1 + 8 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/lelantus.cpp b/src/lelantus.cpp index 0bfe9764fc..41ef554f36 100644 --- a/src/lelantus.cpp +++ b/src/lelantus.cpp @@ -6,12 +6,10 @@ #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" @@ -22,6 +20,7 @@ #include "policy/policy.h" #include "coins.h" #include "batchproof_container.h" + #include #include #include diff --git a/src/miner.cpp b/src/miner.cpp index 4f180c793a..79bd3d2de9 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -25,11 +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" diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index 7f34930dd9..2e1b3cd79e 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -475,6 +475,7 @@ void BitcoinApplication::initializeResult(int retval) PaymentServer::LoadRootCAs(); paymentServer->setOptionsModel(optionsModel); #endif + clientModel = new ClientModel(optionsModel); window->setClientModel(clientModel); diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index b5aa6f62c5..c70fa386e0 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -286,6 +286,7 @@ BitcoinGUI::BitcoinGUI(const PlatformStyle *_platformStyle, const NetworkStyle * // Initially wallet actions should be disabled #ifdef ENABLE_WALLET setWalletActionsEnabled(false); + #endif // Subscribe to notifications from core subscribeToCoreSignals(); @@ -1100,7 +1101,6 @@ void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVer checkZnodeVisibility(count); #endif // ENABLE_WALLET - } diff --git a/src/qt/recover.cpp b/src/qt/recover.cpp index 78742ab54d..6531814f44 100644 --- a/src/qt/recover.cpp +++ b/src/qt/recover.cpp @@ -84,6 +84,7 @@ bool Recover::askRecover(bool& newWallet) #ifdef ENABLE_WALLET namespace fs = boost::filesystem; fs::path walletFile = GetDataDir(true) / GetArg("-wallet", DEFAULT_WALLET_DAT); + if (!fs::exists(walletFile)) { newWallet = true; diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp index d0f5c8e10f..c21827c6aa 100644 --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -28,6 +28,7 @@ #include "wallet/rpcwallet.h" #include "wallet/wallet.h" #endif + #include #include #include diff --git a/src/rpc/rpcevo.cpp b/src/rpc/rpcevo.cpp index 4beca40601..d7967f30de 100644 --- a/src/rpc/rpcevo.cpp +++ b/src/rpc/rpcevo.cpp @@ -666,6 +666,7 @@ UniValue protx_update_service(const JSONRPCRequest& request) } FundSpecialTx(pwallet, tx, ptx, feeSource); + SignSpecialTxPayloadByHash(tx, ptx, keyOperator); SetTxPayload(tx, ptx); @@ -931,6 +932,7 @@ UniValue protx_list(const JSONRPCRequest& request) if (request.fHelp) { protx_list_help(); } + #ifdef ENABLE_WALLET CWallet* const pwallet = GetWalletForJSONRPCRequest(request); #else @@ -1423,6 +1425,7 @@ UniValue spork(const JSONRPCRequest& request) FundSpecialTx(pwallet, tx, sporkTx, feeAddress.Get()); SignSpecialTxPayloadByHash(tx, sporkTx, secretKey); SetTxPayload(tx, sporkTx); + return SignAndSendSpecialTx(tx); #endif // ENABLE_WALLET } diff --git a/src/wallet/db.h b/src/wallet/db.h index bf8dd6c9d3..ea56200323 100644 --- a/src/wallet/db.h +++ b/src/wallet/db.h @@ -33,6 +33,7 @@ class CDBEnv std::string strPath; void EnvShutdown(); + public: mutable CCriticalSection cs_db; DbEnv *dbenv; From fa4a2d4954626ffd6160cbad3b5d4ddbdb6047d0 Mon Sep 17 00:00:00 2001 From: levoncrypto Date: Sun, 5 Jun 2022 21:08:45 +0400 Subject: [PATCH 4/5] Coding stile fix --- src/evo/spork.h | 1 + src/rpc/rpcevo.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/evo/spork.h b/src/evo/spork.h index 299dad117f..21113a1554 100644 --- a/src/evo/spork.h +++ b/src/evo/spork.h @@ -150,4 +150,5 @@ class CMempoolSporkManager bool IsTransactionAllowed(const CTransaction &tx, CValidationState &state) const; ActiveSporkMap GetActiveSporks() const { return mempoolSporks; } }; + #endif diff --git a/src/rpc/rpcevo.cpp b/src/rpc/rpcevo.cpp index d7967f30de..5d60d9ade9 100644 --- a/src/rpc/rpcevo.cpp +++ b/src/rpc/rpcevo.cpp @@ -666,7 +666,7 @@ UniValue protx_update_service(const JSONRPCRequest& request) } FundSpecialTx(pwallet, tx, ptx, feeSource); - + SignSpecialTxPayloadByHash(tx, ptx, keyOperator); SetTxPayload(tx, ptx); From 9c2f463140d639baa117736506743743f1e6ada4 Mon Sep 17 00:00:00 2001 From: levoncrypto Date: Fri, 1 Jul 2022 20:54:33 +0400 Subject: [PATCH 5/5] Fixed configure with no_wallet --- configure.ac | 28 ++++++++++++++++++++++++---- src/wallet/rpcwallet.cpp | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 34345e79bd..7a1e12e1cd 100644 --- a/configure.ac +++ b/configure.ac @@ -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)])], @@ -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) @@ -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]) @@ -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]) @@ -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/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index a669f17f43..572692b976 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -157,6 +157,38 @@ std::string AccountFromValue(const UniValue& value) return strAccount; } +UniValue checkYourAllMintValidity(const JSONRPCRequest& request) +{ + CWallet * const pwallet = GetWalletForJSONRPCRequest(request); + if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { + assert(false || "Invalid wallet"); + } + + if (request.fHelp) { + throw std::runtime_error( + "checkYourAllMintValidity\n" + "checkYourAllMintValidity returns invalid(valid in your wallet but invalid from the outside) mints vector\n" + "\nResult\n" + "\"vector of invalid mints\"" + "\n\nExamples:\n" + + HelpExampleCli("checkYourAllMintValidity", "") + + HelpExampleRpc("checkYourAllMintValidity", "") + ); + } + + const auto listMints = pwallet->zwallet->GetTracker().ListLelantusMints(true, false, false); + Scalar bnSerial; + + UniValue usedMints(UniValue::VARR); + + for (auto it = listMints.begin(); it != listMints.end(); ++it) { + if (lelantus::CLelantusState::GetState()->IsUsedCoinSerialHash(bnSerial, it->hashSerial)) { + usedMints.push_back(it->GetPubCoinValueHash().GetHex()); + } + } + return usedMints; /// if "usedMints" is empty, returns empty vector +} + UniValue getnewaddress(const JSONRPCRequest& request) { CWallet * const pwallet = GetWalletForJSONRPCRequest(request); @@ -4831,6 +4863,7 @@ static const CRPCCommand commands[] = { "wallet", "addwitnessaddress", &addwitnessaddress, true, {"address"} }, { "wallet", "backupwallet", &backupwallet, true, {"destination"} }, { "wallet", "bumpfee", &bumpfee, true, {"txid", "options"} }, + { "wallet", "checkyourallMintValidity", &checkYourAllMintValidity, true, {} }, { "wallet", "dumpprivkey", &dumpprivkey_firo, true, {"address"} }, { "wallet", "dumpwallet", &dumpwallet_firo, true, {"filename"} }, { "wallet", "encryptwallet", &encryptwallet, true, {"passphrase"} },