Skip to content

Commit 0680705

Browse files
dave-mannAmirAbrams
authored andcommitted
[Wallet] Don't attempt to generate keys when wallet is locked
1 parent c8d61b4 commit 0680705

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

src/wallet/rpcwallet.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,6 @@ UniValue getnewed25519address(const JSONRPCRequest& request)
163163
"\nExamples:\n" +
164164
HelpExampleCli("getnewed25519address", "") + HelpExampleRpc("getnewed25519address", ""));
165165

166-
EnsureWalletIsUnlocked();
167-
168166
LOCK2(cs_main, pwalletMain->cs_wallet);
169167

170168
// Parse the account first so we don't generate a key if there's an error

src/wallet/wallet.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4928,12 +4928,11 @@ bool CWallet::GetKeysFromPool(CPubKey& pubkeyWallet, std::vector<unsigned char>&
49284928
pubkeyWallet = keypool.vchPubKey;
49294929
}
49304930

4931-
CKey keyRetrieved;
4932-
GetKey(pubkeyWallet.GetID(), keyRetrieved);
4933-
49344931
if (nEdIndex == -1) {
49354932
if (IsLocked(true))
49364933
return false;
4934+
CKey keyRetrieved;
4935+
GetKey(pubkeyWallet.GetID(), keyRetrieved);
49374936
vchEd25519PubKey = GenerateNewEdKey(0, fInternal, keyRetrieved);
49384937
}
49394938
else {

0 commit comments

Comments
 (0)