diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e8b2f05356..c420eaab08 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -61,21 +61,15 @@ The title of the pull request should be prefixed by the component or area that the pull request affects. Valid areas as: - *Consensus* for changes to consensus critical code - - *Docs* for changes to the documentation + - *Doc* for changes to the documentation - *Qt* for changes to dash-qt + - *Log* Changes to log messages - *Mining* for changes to the mining code - *Net* or *P2P* for changes to the peer-to-peer network code + - *Refactor* for structural changes that do not change behavior - *RPC/REST/ZMQ* for changes to the RPC, REST or ZMQ APIs - *Scripts and tools* for changes to the scripts and tools - - *Tests* for changes to the unit tests or QA tests - - *Trivial* should **only** be used for PRs that do not change generated - executable code. Notably, refactors (change of function arguments and code - reorganization) and changes in behavior should **not** be marked as trivial. - Examples of trivial PRs are changes to: - - comments - - whitespace - - variable names - - logging and messages + - *Test* for changes to the unit tests or QA tests - *Utils and libraries* for changes to the utils and libraries - *Wallet* for changes to the wallet code @@ -84,10 +78,10 @@ Examples: Consensus: Add new opcode for BIP-XXXX OP_CHECKAWESOMESIG Net: Automatically create hidden service, listen on Tor Qt: Add feed bump button - Trivial: Fix typo in init.cpp + Log: Fix typo in log message Note that translations should not be submitted as pull requests, please see -[Translation Process](https://github.com/dashpay/dash/blob/master/doc/translation_process.md) +[Translation Process](https://github.com/dashpay/dash/blob/master/doc/translation_process.md) for more information on helping with translations. If a pull request is not to be considered for merging (yet), please @@ -424,7 +418,7 @@ The project leader is the release manager for each Dash Core release. Copyright --------- -By contributing to this repository, you agree to license your work under the -MIT license unless specified otherwise in `contrib/debian/copyright` or at -the top of the file itself. Any work contributed where you are not the original +By contributing to this repository, you agree to license your work under the +MIT license unless specified otherwise in `contrib/debian/copyright` or at +the top of the file itself. Any work contributed where you are not the original author must contain its license header with the original author(s) and source. diff --git a/depends/packages/qt.mk b/depends/packages/qt.mk index e2453e5345..4de8db70a2 100644 --- a/depends/packages/qt.mk +++ b/depends/packages/qt.mk @@ -43,6 +43,7 @@ $(package)_config_opts += -no-freetype $(package)_config_opts += -no-gif $(package)_config_opts += -no-glib $(package)_config_opts += -no-icu +$(package)_config_opts += -no-ico $(package)_config_opts += -no-iconv $(package)_config_opts += -no-kms $(package)_config_opts += -no-linuxfb @@ -79,19 +80,35 @@ $(package)_config_opts += -qt-harfbuzz $(package)_config_opts += -system-zlib $(package)_config_opts += -static $(package)_config_opts += -v +$(package)_config_opts += -no-feature-bearermanagement +$(package)_config_opts += -no-feature-colordialog +$(package)_config_opts += -no-feature-commandlineparser +$(package)_config_opts += -no-feature-concurrent $(package)_config_opts += -no-feature-dial +$(package)_config_opts += -no-feature-filesystemwatcher +$(package)_config_opts += -no-feature-fontcombobox $(package)_config_opts += -no-feature-ftp +$(package)_config_opts += -no-feature-image_heuristic_mask +$(package)_config_opts += -no-feature-keysequenceedit $(package)_config_opts += -no-feature-lcdnumber $(package)_config_opts += -no-feature-pdf -$(package)_config_opts += -no-feature-printer $(package)_config_opts += -no-feature-printdialog -$(package)_config_opts += -no-feature-concurrent +$(package)_config_opts += -no-feature-printer +$(package)_config_opts += -no-feature-printpreviewdialog +$(package)_config_opts += -no-feature-printpreviewwidget +$(package)_config_opts += -no-feature-sessionmanager $(package)_config_opts += -no-feature-sql $(package)_config_opts += -no-feature-statemachine $(package)_config_opts += -no-feature-syntaxhighlighter $(package)_config_opts += -no-feature-textbrowser $(package)_config_opts += -no-feature-textodfwriter +$(package)_config_opts += -no-feature-topleveldomain $(package)_config_opts += -no-feature-udpsocket +$(package)_config_opts += -no-feature-undocommand +$(package)_config_opts += -no-feature-undogroup +$(package)_config_opts += -no-feature-undostack +$(package)_config_opts += -no-feature-undoview +$(package)_config_opts += -no-feature-vnc $(package)_config_opts += -no-feature-wizard $(package)_config_opts += -no-feature-xml @@ -116,7 +133,6 @@ $(package)_config_opts_linux += -qt-xcb $(package)_config_opts_linux += -no-xcb-xlib $(package)_config_opts_linux += -no-feature-xlib $(package)_config_opts_linux += -system-freetype -$(package)_config_opts_linux += -no-feature-sessionmanager $(package)_config_opts_linux += -fontconfig $(package)_config_opts_linux += -no-opengl $(package)_config_opts_linux += -dbus-runtime diff --git a/doc/bips.md b/doc/bips.md index 31d77d1d85..cf1d633ff4 100644 --- a/doc/bips.md +++ b/doc/bips.md @@ -12,7 +12,7 @@ BIPs that are implemented by Bitcoin Core (up-to-date up to **v0.18.0**): * [`BIP 31`](https://github.com/bitcoin/bips/blob/master/bip-0031.mediawiki): The 'pong' protocol message (and the protocol version bump to 60001) has been implemented since **v0.6.1** ([PR #1081](https://github.com/bitcoin/bitcoin/pull/1081)). * [`BIP 32`](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki): Hierarchical Deterministic Wallets has been implemented since **v0.13.0** ([PR #8035](https://github.com/bitcoin/bitcoin/pull/8035)). * [`BIP 34`](https://github.com/bitcoin/bips/blob/master/bip-0034.mediawiki): The rule that requires blocks to contain their height (number) in the coinbase input, and the introduction of version 2 blocks has been implemented since **v0.7.0**. The rule took effect for version 2 blocks as of *block 224413* (March 5th 2013), and version 1 blocks are no longer allowed since *block 227931* (March 25th 2013) ([PR #1526](https://github.com/bitcoin/bitcoin/pull/1526)). -* [`BIP 35`](https://github.com/bitcoin/bips/blob/master/bip-0035.mediawiki): The 'mempool' protocol message (and the protocol version bump to 60002) has been implemented since **v0.7.0** ([PR #1641](https://github.com/bitcoin/bitcoin/pull/1641)). +* [`BIP 35`](https://github.com/bitcoin/bips/blob/master/bip-0035.mediawiki): The 'mempool' protocol message (and the protocol version bump to 60002) has been implemented since **v0.7.0** ([PR #1641](https://github.com/bitcoin/bitcoin/pull/1641)). As of **v0.13.0**, this is only available for `NODE_BLOOM` (BIP 111) peers. * [`BIP 37`](https://github.com/bitcoin/bips/blob/master/bip-0037.mediawiki): The bloom filtering for transaction relaying, partial Merkle trees for blocks, and the protocol version bump to 70001 (enabling low-bandwidth SPV clients) has been implemented since **v0.8.0** ([PR #1795](https://github.com/bitcoin/bitcoin/pull/1795)). * [`BIP 42`](https://github.com/bitcoin/bips/blob/master/bip-0042.mediawiki): The bug that would have caused the subsidy schedule to resume after block 13440000 was fixed in **v0.9.2** ([PR #3842](https://github.com/bitcoin/bitcoin/pull/3842)). * [`BIP 61`](https://github.com/bitcoin/bips/blob/master/bip-0061.mediawiki): The 'reject' protocol message (and the protocol version bump to 70002) was added in **v0.9.0** ([PR #3185](https://github.com/bitcoin/bitcoin/pull/3185)). Starting *v0.16.0*, whether to send reject messages can be configured with the `-enablebip61` option. diff --git a/src/Makefile.am b/src/Makefile.am index 11cce20ee7..c85f5a8fab 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -444,7 +444,7 @@ libdash_server_a_SOURCES += dummywallet.cpp endif if ENABLE_ZMQ -libdash_zmq_a_CPPFLAGS = $(BITCOIN_INCLUDES) $(ZMQ_CFLAGS) +libdash_zmq_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(ZMQ_CFLAGS) libdash_zmq_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) libdash_zmq_a_SOURCES = \ zmq/zmqabstractnotifier.cpp \ diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 32f3fabde6..324130e717 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -309,7 +309,7 @@ public: fDefaultConsistencyChecks = false; fRequireStandard = true; fRequireRoutableExternalIP = true; - fMineBlocksOnDemand = false; + m_is_test_chain = false; fAllowMultipleAddressesFromGroup = false; fAllowMultiplePorts = false; nLLMQConnectionRetryTimeout = 60; @@ -522,7 +522,7 @@ public: fDefaultConsistencyChecks = false; fRequireStandard = false; fRequireRoutableExternalIP = true; - fMineBlocksOnDemand = false; + m_is_test_chain = true; fAllowMultipleAddressesFromGroup = false; fAllowMultiplePorts = true; nLLMQConnectionRetryTimeout = 60; @@ -553,7 +553,6 @@ public: // (the tx=... number in the ChainStateFlushed debug.log lines) 0.01 // * estimated number of transactions per second after that timestamp }; - } }; @@ -722,7 +721,7 @@ public: fDefaultConsistencyChecks = false; fRequireStandard = false; fRequireRoutableExternalIP = true; - fMineBlocksOnDemand = false; + m_is_test_chain = true; fAllowMultipleAddressesFromGroup = true; fAllowMultiplePorts = true; nLLMQConnectionRetryTimeout = 60; @@ -904,9 +903,9 @@ public: vSeeds.clear(); //!< Regtest mode doesn't have any DNS seeds. fDefaultConsistencyChecks = true; - fRequireStandard = false; + fRequireStandard = true; fRequireRoutableExternalIP = false; - fMineBlocksOnDemand = true; + m_is_test_chain = true; fAllowMultipleAddressesFromGroup = true; fAllowMultiplePorts = true; nLLMQConnectionRetryTimeout = 1; // must be lower then the LLMQ signing session timeout so that tests have control over failing behavior diff --git a/src/chainparams.h b/src/chainparams.h index cedab59775..c27a11487a 100644 --- a/src/chainparams.h +++ b/src/chainparams.h @@ -71,13 +71,15 @@ public: bool RequireStandard() const { return fRequireStandard; } /** Require addresses specified with "-externalip" parameter to be routable */ bool RequireRoutableExternalIP() const { return fRequireRoutableExternalIP; } + /** If this chain is exclusively used for testing */ + bool IsTestChain() const { return m_is_test_chain; } uint64_t PruneAfterHeight() const { return nPruneAfterHeight; } /** Minimum free space (in GB) needed for data directory */ uint64_t AssumedBlockchainSize() const { return m_assumed_blockchain_size; } /** Minimum free space (in GB) needed for data directory when pruned; Does not include prune target*/ uint64_t AssumedChainStateSize() const { return m_assumed_chain_state_size; } - /** Make miner stop after a block is found. In RPC, don't return until nGenProcLimit blocks are generated */ - bool MineBlocksOnDemand() const { return fMineBlocksOnDemand; } + /** Whether it is possible to mine blocks on demand (no retargeting) */ + bool MineBlocksOnDemand() const { return consensus.fPowNoRetargeting; } /** Allow multiple addresses to be selected from the same network group (e.g. 192.168.x.x) */ bool AllowMultipleAddressesFromGroup() const { return fAllowMultipleAddressesFromGroup; } /** Allow nodes with the same address and multiple ports */ @@ -130,7 +132,7 @@ protected: bool fDefaultConsistencyChecks; bool fRequireStandard; bool fRequireRoutableExternalIP; - bool fMineBlocksOnDemand; + bool m_is_test_chain; bool fAllowMultipleAddressesFromGroup; bool fAllowMultiplePorts; int nLLMQConnectionRetryTimeout; diff --git a/src/chainparamsbase.h b/src/chainparamsbase.h index ce48376e06..47133e7e27 100644 --- a/src/chainparamsbase.h +++ b/src/chainparamsbase.h @@ -7,7 +7,6 @@ #include #include -#include /** * CBaseChainParams defines the base parameters (shared between dash-cli and dashd) diff --git a/src/init.cpp b/src/init.cpp index fd293d1260..030cf8fc4e 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1494,8 +1494,9 @@ bool AppInitParameterInteraction() } fRequireStandard = !gArgs.GetBoolArg("-acceptnonstdtxn", !chainparams.RequireStandard()); - if (chainparams.RequireStandard() && !fRequireStandard) + if (!chainparams.IsTestChain() && !fRequireStandard) { return InitError(strprintf("acceptnonstdtxn is not currently supported for %s chain", chainparams.NetworkIDString())); + } nBytesPerSigOp = gArgs.GetArg("-bytespersigop", nBytesPerSigOp); if (!g_wallet_init_interface.ParameterInteraction()) return false; @@ -2130,7 +2131,9 @@ bool AppInitMain(InitInterfaces& interfaces) break; } - ResetBlockFailureFlags(nullptr); + if (gArgs.GetArg("-checklevel", DEFAULT_CHECKLEVEL) >= 3) { + ResetBlockFailureFlags(nullptr); + } } } catch (const std::exception& e) { LogPrintf("%s\n", e.what()); diff --git a/src/qt/dash.cpp b/src/qt/dash.cpp index 8ea38903f8..dabe7b961c 100644 --- a/src/qt/dash.cpp +++ b/src/qt/dash.cpp @@ -26,7 +26,8 @@ #ifdef ENABLE_WALLET #include #include -#endif +#include +#endif // ENABLE_WALLET #include #include @@ -219,12 +220,6 @@ BitcoinApplication::~BitcoinApplication() delete window; window = nullptr; -#ifdef ENABLE_WALLET - delete paymentServer; - paymentServer = nullptr; - delete m_wallet_controller; - m_wallet_controller = nullptr; -#endif // Delete Qt-settings if user clicked on "Reset Options" QSettings settings; if(optionsModel && optionsModel->resetSettingsOnShutdown){ @@ -344,24 +339,21 @@ void BitcoinApplication::initializeResult(bool success) { // Log this only after AppInitMain finishes, as then logging setup is guaranteed complete qInfo() << "Platform customization:" << gArgs.GetArg("-uiplatform", BitcoinGUI::DEFAULT_UIPLATFORM).c_str(); -#ifdef ENABLE_WALLET - m_wallet_controller = new WalletController(m_node, optionsModel, this); -#ifdef ENABLE_BIP70 - PaymentServer::LoadRootCAs(); -#endif - if (paymentServer) { - paymentServer->setOptionsModel(optionsModel); -#ifdef ENABLE_BIP70 - connect(m_wallet_controller, &WalletController::coinsSent, paymentServer, &PaymentServer::fetchPaymentACK); -#endif - } -#endif - clientModel = new ClientModel(m_node, optionsModel); window->setClientModel(clientModel); #ifdef ENABLE_WALLET - window->setWalletController(m_wallet_controller); + if (WalletModel::isWalletEnabled()) { + m_wallet_controller = new WalletController(m_node, optionsModel, this); + window->setWalletController(m_wallet_controller); + if (paymentServer) { + paymentServer->setOptionsModel(optionsModel); +#ifdef ENABLE_BIP70 + PaymentServer::LoadRootCAs(); + connect(m_wallet_controller, &WalletController::coinsSent, paymentServer, &PaymentServer::fetchPaymentACK); #endif + } + } +#endif // ENABLE_WALLET // If -min option passed, start window minimized (iconified) or minimized to tray if (!gArgs.GetBoolArg("-min", false)) { @@ -579,8 +571,10 @@ int GuiMain(int argc, char* argv[]) // Start up the payment server early, too, so impatient users that click on // dash: links repeatedly have their payment requests routed to this process: - app.createPaymentServer(); -#endif + if (WalletModel::isWalletEnabled()) { + app.createPaymentServer(); + } +#endif // ENABLE_WALLET /// 9. Main GUI initialization // Install global event filter that makes sure that out-of-focus labels do not contain text cursor. diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp index 3cdd80d2f4..4e6ba17602 100644 --- a/src/qt/walletmodel.cpp +++ b/src/qt/walletmodel.cpp @@ -269,9 +269,12 @@ WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransact return TransactionCreationFailed; } - // Reject absurdly high fee - if (nFeeRequired > m_wallet->getDefaultMaxTxFee()) + // Reject absurdly high fee. (This can never happen because the + // wallet never creates transactions with fee greater than + // m_default_max_tx_fee. This merely a belt-and-suspenders check). + if (nFeeRequired > m_wallet->getDefaultMaxTxFee()) { return AbsurdFee; + } return SendCoinsReturn(OK); } diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp index c203191caa..e2f0fc47a3 100644 --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -771,7 +771,10 @@ static UniValue signrawtransactionwithkey(const JSONRPCRequest& request) UniValue sendrawtransaction(const JSONRPCRequest& request) { - const RPCHelpMan help{"sendrawtransaction", "\nSubmits raw transaction (serialized, hex-encoded) to local node and network.\n" + const RPCHelpMan help{"sendrawtransaction", "\nSubmit a raw transaction (serialized, hex-encoded) to local node and network.\n" + "\nNote that the transaction will be sent unconditionally to all peers, so using this\n" + "for manual rebroadcast may degrade privacy by leaking the transaction's origin, as\n" + "nodes will normally not rebroadcast non-wallet transactions already in their mempool.\n" "\nAlso see createrawtransaction and signrawtransactionwithkey calls.\n", { {"hexstring", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The hex string of the raw transaction"}, diff --git a/src/wallet/fees.cpp b/src/wallet/fees.cpp index 038d7030ef..1ad9911152 100644 --- a/src/wallet/fees.cpp +++ b/src/wallet/fees.cpp @@ -58,6 +58,9 @@ CFeeRate GetMinimumFeeRate(const CWallet& wallet, const CCoinControl& coin_contr // if we don't have enough data for estimateSmartFee, then use fallback fee feerate_needed = wallet.m_fallback_fee; if (feeCalc) feeCalc->reason = FeeReason::FALLBACK; + + // directly return if fallback fee is disabled (feerate 0 == disabled) + if (wallet.m_fallback_fee.GetFee(1000) == 0) return feerate_needed; } // Obey mempool min fee when using smart fee estimation CFeeRate min_mempool_feerate = wallet.chain().mempoolMinFee(); diff --git a/src/wallet/init.cpp b/src/wallet/init.cpp index 072518e561..9cb4b81272 100644 --- a/src/wallet/init.cpp +++ b/src/wallet/init.cpp @@ -3,6 +3,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. +#include #include #include #include diff --git a/src/wallet/test/wallet_tests.cpp b/src/wallet/test/wallet_tests.cpp index d8c52ba0a5..e5402306b6 100644 --- a/src/wallet/test/wallet_tests.cpp +++ b/src/wallet/test/wallet_tests.cpp @@ -478,9 +478,9 @@ public: const std::string strUnableToLocateCoinJoin1 = "Unable to locate enough non-denominated funds for this transaction."; const std::string strUnableToLocateCoinJoin2 = "Unable to locate enough mixed funds for this transaction. CoinJoin uses exact denominated amounts to send funds, you might simply need to mix some more coins."; const std::string strTransactionTooLarge = "Transaction too large"; - const std::string strTransactionTooLargeForFeePolicy = "Transaction too large for fee policy"; const std::string strChangeIndexOutOfRange = "Change index out of range"; const std::string strExceededMaxTries = "Exceeded max tries."; + const std::string strMaxFeeExceeded = "Fee exceeds maximum configured by -maxtxfee"; CreateTransactionTestSetup() { @@ -886,13 +886,9 @@ BOOST_FIXTURE_TEST_CASE(CreateTransactionTest, CreateTransactionTestSetup) createOutputEntries(2935); BOOST_CHECK(CreateTransaction(vecOutputEntries, strTransactionTooLarge, false)); - auto prevRate = minRelayTxFee; - coinControl.m_feerate = prevRate; - coinControl.fOverrideFeeRate = true; - minRelayTxFee = CFeeRate(prevRate.GetFeePerK() * 10); - BOOST_CHECK(CreateTransaction({{5000, false}}, strTransactionTooLargeForFeePolicy, false)); - coinControl.m_feerate.reset(); - minRelayTxFee = prevRate; + wallet->m_default_max_tx_fee = 0; + BOOST_CHECK(CreateTransaction({{5000, false}}, strMaxFeeExceeded, false)); + wallet->m_default_max_tx_fee = DEFAULT_TRANSACTION_MAXFEE; BOOST_CHECK(CreateTransaction({{5000, false}, {5000, false}, {5000, false}}, strChangeIndexOutOfRange, 4, false)); } diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 17394bd5f3..a6b4892d74 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -169,7 +169,7 @@ std::shared_ptr LoadWallet(interfaces::Chain& chain, const std::string& return LoadWallet(chain, WalletLocation(name), error, warning); } -const uint256 CMerkleTx::ABANDON_HASH(uint256S("0000000000000000000000000000000000000000000000000000000000000001")); +const uint256 CWalletTx::ABANDON_HASH(uint256S("0000000000000000000000000000000000000000000000000000000000000001")); /** @defgroup mapWallet * @@ -3236,11 +3236,6 @@ bool CWallet::FundTransaction(CMutableTransaction& tx, CAmount& nFeeRet, int& nC } } - if (nFeeRet > m_default_max_tx_fee) { - strFailReason = TransactionErrorString(TransactionError::MAX_FEE_EXCEEDED); - return false; - } - return true; } @@ -3722,13 +3717,6 @@ bool CWallet::CreateTransaction(interfaces::Chain::Lock& locked_chain, const std nFee = GetMinimumFee(*this, nBytes, coin_control, &feeCalc); - // If we made it here and we aren't even able to meet the relay fee on the next pass, give up - // because we must be at the maximum allowed fee. - if (nFee < ::minRelayTxFee.GetFee(nBytes)) { - strFailReason = _("Transaction too large for fee policy"); - return false; - } - return true; }; @@ -3836,6 +3824,12 @@ bool CWallet::CreateTransaction(interfaces::Chain::Lock& locked_chain, const std } } + if (feeCalc.reason == FeeReason::FALLBACK && !m_allow_fallback_fee) { + // eventually allow a fallback fee + strFailReason = _("Fee estimation failed. Fallbackfee is disabled. Wait a few blocks or enable -fallbackfee."); + return false; + } + if (nAmountLeft == nFeeRet) { // We either added the change amount to nFeeRet because the change amount was considered // to be dust or the input exactly matches output + fee. @@ -3894,6 +3888,11 @@ bool CWallet::CreateTransaction(interfaces::Chain::Lock& locked_chain, const std tx = MakeTransactionRef(std::move(txNew)); } + if (nFeeRet > m_default_max_tx_fee) { + strFailReason = TransactionErrorString(TransactionError::MAX_FEE_EXCEEDED); + return false; + } + if (gArgs.GetBoolArg("-walletrejectlongchains", DEFAULT_WALLET_REJECT_LONG_CHAINS)) { // Lastly, ensure this tx will pass the mempool's chain limits if (!chain().checkChainLimits(tx)) { @@ -5094,8 +5093,7 @@ std::shared_ptr CWallet::CreateWalletFromFile(interfaces::Chain& chain, walletInstance->m_min_fee = CFeeRate(n); } - // TODO: enable when IsFallbackFeeEnabled is backported - // walletInstance->m_allow_fallback_fee = Params().IsFallbackFeeEnabled(); + walletInstance->m_allow_fallback_fee = Params().IsTestChain(); if (gArgs.IsArgSet("-fallbackfee")) { CAmount nFeePerK = 0; if (!ParseMoney(gArgs.GetArg("-fallbackfee", ""), nFeePerK)) { @@ -5508,7 +5506,7 @@ CKeyPool::CKeyPool(const CPubKey& vchPubKeyIn, bool fInternalIn) fInternal = fInternalIn; } -void CMerkleTx::SetMerkleBranch(const uint256& block_hash, int posInBlock) +void CWalletTx::SetMerkleBranch(const uint256& block_hash, int posInBlock) { // Update the tx's hashBlock hashBlock = block_hash; @@ -5517,7 +5515,7 @@ void CMerkleTx::SetMerkleBranch(const uint256& block_hash, int posInBlock) nIndex = posInBlock; } -int CMerkleTx::GetDepthInMainChain(interfaces::Chain::Lock& locked_chain) const +int CWalletTx::GetDepthInMainChain(interfaces::Chain::Lock& locked_chain) const { if (hashUnset()) return 0; @@ -5525,7 +5523,7 @@ int CMerkleTx::GetDepthInMainChain(interfaces::Chain::Lock& locked_chain) const return locked_chain.getBlockDepth(hashBlock) * (nIndex == -1 ? -1 : 1); } -bool CMerkleTx::IsLockedByInstantSend() const +bool CWalletTx::IsLockedByInstantSend() const { if (fIsChainlocked) { fIsInstantSendLocked = false; @@ -5535,7 +5533,7 @@ bool CMerkleTx::IsLockedByInstantSend() const return fIsInstantSendLocked; } -bool CMerkleTx::IsChainLocked() const +bool CWalletTx::IsChainLocked() const { if (!fIsChainlocked) { AssertLockHeld(cs_main); @@ -5547,7 +5545,7 @@ bool CMerkleTx::IsChainLocked() const return fIsChainlocked; } -int CMerkleTx::GetBlocksToMaturity(interfaces::Chain::Lock& locked_chain) const +int CWalletTx::GetBlocksToMaturity(interfaces::Chain::Lock& locked_chain) const { if (!IsCoinBase()) return 0; @@ -5556,7 +5554,7 @@ int CMerkleTx::GetBlocksToMaturity(interfaces::Chain::Lock& locked_chain) const return std::max(0, (COINBASE_MATURITY+1) - chain_depth); } -bool CMerkleTx::IsImmatureCoinBase(interfaces::Chain::Lock& locked_chain) const +bool CWalletTx::IsImmatureCoinBase(interfaces::Chain::Lock& locked_chain) const { // note GetBlocksToMaturity is 0 for non-coinbase tx return GetBlocksToMaturity(locked_chain) > 0; diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index 93861b9f3b..e148d7321e 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -12,7 +12,6 @@ #include #include #include -#include #include