refactor: Get rid of Wallet::IsWalletFlagSet method

Replace by privateKeysDisabled method to avoid need for GUI to reference
internal wallet flags.

Also remove adjacent WalletModel canGetAddresses wrapper that serves no purpose
and make Wallet::canGetAddresses non-const so it can be implemented by IPC
classes in #10102.
This commit is contained in:
Russell Yanofsky
2017-12-05 15:57:12 -05:00
parent 5bf45fe2a9
commit 77e4b06572
8 changed files with 24 additions and 36 deletions

View File

@@ -23,7 +23,7 @@
#include <ui_interface.h>
#include <util/system.h> // for GetBoolArg
#include <wallet/coincontrol.h>
#include <wallet/wallet.h>
#include <wallet/wallet.h> // for CRecipient
#include <stdint.h>
@@ -184,7 +184,7 @@ WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransact
std::string strFailReason;
auto& newTx = transaction.getWtx();
newTx = m_wallet->createTransaction(vecSend, coinControl, !privateKeysDisabled() /* sign */, nChangePosRet, nFeeRequired, strFailReason);
newTx = m_wallet->createTransaction(vecSend, coinControl, !wallet().privateKeysDisabled() /* sign */, nChangePosRet, nFeeRequired, strFailReason);
transaction.setTransactionFee(nFeeRequired);
if (fSubtractFeeFromAmount && newTx)
transaction.reassignAmounts(nChangePosRet);
@@ -488,7 +488,7 @@ bool WalletModel::bumpFee(uint256 hash, uint256& new_hash)
return false;
}
const bool create_psbt = privateKeysDisabled();
const bool create_psbt = m_wallet->privateKeysDisabled();
// allow a user based fee verification
QString questionString = create_psbt ? tr("Do you want to draft a transaction with fee increase?") : tr("Do you want to increase the fee?");
@@ -558,16 +558,6 @@ bool WalletModel::isWalletEnabled()
return !gArgs.GetBoolArg("-disablewallet", DEFAULT_DISABLE_WALLET);
}
bool WalletModel::privateKeysDisabled() const
{
return m_wallet->IsWalletFlagSet(WALLET_FLAG_DISABLE_PRIVATE_KEYS);
}
bool WalletModel::canGetAddresses() const
{
return m_wallet->canGetAddresses();
}
QString WalletModel::getWalletName() const
{
return QString::fromStdString(m_wallet->getWalletName());