diff options
| author | Wladimir J. van der Laan <[email protected]> | 2017-09-19 17:45:10 +0200 |
|---|---|---|
| committer | Wladimir J. van der Laan <[email protected]> | 2017-09-19 17:46:05 +0200 |
| commit | 4f7e37e26c5d1ca5421bb070e583aaa6b0c93d03 (patch) | |
| tree | 0ffed811f101b267cd33e71643993ce84a3e629f /src | |
| parent | doc: Add release notes for 0.15.0.1 (diff) | |
| parent | wallet: Display non-HD error on first run (diff) | |
| download | discoin-4f7e37e26c5d1ca5421bb070e583aaa6b0c93d03.tar.xz discoin-4f7e37e26c5d1ca5421bb070e583aaa6b0c93d03.zip | |
Merge #11307: wallet: Display non-HD error on first run
fadf31e wallet: Display non-HD error on first run (MarcoFalke)
Pull request description:
On current master a fresh wallet created with `-usehd=0` is silently created as HD wallet.
An error should be displayed on the first run.
Also, this restores a test that was removed in c22a53c
Fixes: #11313
Tree-SHA512: 226a4129984324f88a431c7e2726383f6841711f0227d8e9f5b4f89d4bb9f2b8e922e6cf0a6f91d6efa747d139543a236b9f29326fc5d1e5d6f1dea2465d9b85
Diffstat (limited to 'src')
| -rw-r--r-- | src/wallet/wallet.cpp | 8 | ||||
| -rw-r--r-- | src/wallet/wallet.h | 2 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index d376de233..cbc045fa1 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -3827,6 +3827,10 @@ CWallet* CWallet::CreateWalletFromFile(const std::string walletFile) if (fFirstRun) { // ensure this wallet.dat can only be opened by clients supporting HD with chain split and expects no default key + if (!gArgs.GetBoolArg("-usehd", true)) { + InitError(strprintf(_("Error creating %s: You can't create non-HD wallets with this version."), walletFile)); + return nullptr; + } walletInstance->SetMinVersion(FEATURE_NO_DEFAULT_KEY); // generate a new master key @@ -3843,9 +3847,9 @@ CWallet* CWallet::CreateWalletFromFile(const std::string walletFile) walletInstance->SetBestChain(chainActive.GetLocator()); } else if (gArgs.IsArgSet("-usehd")) { - bool useHD = gArgs.GetBoolArg("-usehd", DEFAULT_USE_HD_WALLET); + bool useHD = gArgs.GetBoolArg("-usehd", true); if (walletInstance->IsHDEnabled() && !useHD) { - InitError(strprintf(_("Error loading %s: You can't disable HD on an already existing HD wallet or create new non-HD wallets."), walletFile)); + InitError(strprintf(_("Error loading %s: You can't disable HD on an already existing HD wallet"), walletFile)); return nullptr; } if (!walletInstance->IsHDEnabled() && useHD) { diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index 542e9bd5c..c4af192f3 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -65,8 +65,6 @@ static const unsigned int DEFAULT_TX_CONFIRM_TARGET = 6; static const bool DEFAULT_WALLET_RBF = false; static const bool DEFAULT_WALLETBROADCAST = true; static const bool DEFAULT_DISABLE_WALLET = false; -//! if set, all keys will be derived by using BIP32 -static const bool DEFAULT_USE_HD_WALLET = true; extern const char * DEFAULT_WALLET_DAT; |