Skip to content

Commit 7920df2

Browse files
committed
Wallet: SetupSPKM prevent keypool generation in unit tests.
1 parent c6243af commit 7920df2

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

src/wallet/scriptpubkeyman.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
#include "crypter.h"
88
#include "script/standard.h"
99

10-
bool ScriptPubKeyMan::SetupGeneration(bool force)
10+
bool ScriptPubKeyMan::SetupGeneration(bool newKeypool, bool force)
1111
{
1212
if (CanGenerateKeys() && !force) {
1313
return false;
1414
}
1515

1616
SetHDSeed(GenerateNewSeed(), force);
17-
if (!NewKeyPool()) {
17+
if (newKeypool && !NewKeyPool()) {
1818
return false;
1919
}
2020
return true;

src/wallet/scriptpubkeyman.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class ScriptPubKeyMan {
3535
* Returns false if already setup or setup fails, true if setup is successful
3636
* Set force=true to make it re-setup if already setup, used for upgrades
3737
*/
38-
bool SetupGeneration(bool force = false);
38+
bool SetupGeneration(bool newKeypool = true, bool force = false);
3939

4040
/** Upgrades the wallet to the specified version */
4141
bool Upgrade(const int& prev_version, std::string& error);

src/wallet/wallet.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ std::string COutput::ToString() const
7272

7373
///////////////////////////////////////////////////////////////////////////////////////////////////
7474

75-
bool CWallet::SetupSPKM()
75+
bool CWallet::SetupSPKM(bool newKeypool)
7676
{
7777
if (m_spk_man->SetupGeneration()) {
7878
LogPrintf("%s : spkm setup completed\n", __func__);

src/wallet/wallet.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ class CWallet : public CCryptoKeyStore, public CValidationInterface
263263
static const CAmount DEFAULT_STAKE_SPLIT_THRESHOLD = 500 * COIN;
264264

265265
//! Generates hd wallet //
266-
bool SetupSPKM();
266+
bool SetupSPKM(bool newKeypool = true);
267267
//! Whether the wallet is hd or not //
268268
bool IsHDEnabled() const;
269269

0 commit comments

Comments
 (0)