Minor cleanup of the code that searches for a valid transparent key.
This commit is contained in:
parent
de57da38ce
commit
f65d6f63ee
|
@ -281,12 +281,13 @@ CPubKey CWallet::GenerateNewKey()
|
|||
BIP44CoinType(),
|
||||
ZCASH_LEGACY_ACCOUNT).value();
|
||||
|
||||
while (true) {
|
||||
auto extKey = accountChains.DeriveExternal(hdChain.GetLegacyTKeyCounter());
|
||||
std::optional<std::pair<CExtKey, HDKeyPath>> extKey = std::nullopt;
|
||||
do {
|
||||
extKey = accountChains.DeriveExternal(hdChain.GetLegacyTKeyCounter());
|
||||
hdChain.IncrementLegacyTKeyCounter();
|
||||
|
||||
// if we did not successfully generate a key, try again.
|
||||
if (extKey.has_value()) {
|
||||
} while (!extKey.has_value());
|
||||
|
||||
CKey secret = extKey.value().first.key;
|
||||
CPubKey pubkey = secret.GetPubKey();
|
||||
assert(secret.VerifyPubKey(pubkey));
|
||||
|
@ -309,8 +310,6 @@ CPubKey CWallet::GenerateNewKey()
|
|||
|
||||
return pubkey;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool CWallet::AddKeyPubKey(const CKey& secret, const CPubKey &pubkey)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue