Skip to content

Commit

Permalink
Key pool: Move CanGetAddresses call
Browse files Browse the repository at this point in the history
This is a minor change in behavior: call now only happens if a new key needs to
be reserved, since if a key is already reserved it might fail unnecessarily.

This change also serves as a sanity check
bitcoin#16341 (comment)
  • Loading branch information
achow101 committed Oct 7, 2019
1 parent f0d7bf1 commit bd7c03d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/wallet/scriptpubkeyman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,10 @@ bool LegacyScriptPubKeyMan::Encrypt(const CKeyingMaterial& master_key, WalletBat

bool LegacyScriptPubKeyMan::GetReservedDestination(const OutputType type, bool internal, int64_t& index, CKeyPool& keypool)
{
if (!CanGetAddresses(internal)) {
return false;
}

{
LOCK(cs_KeyStore);
if (!ReserveKeyFromKeyPool(index, keypool, internal)) {
Expand Down
3 changes: 0 additions & 3 deletions src/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3261,9 +3261,6 @@ bool ReserveDestination::GetReservedDestination(const OutputType type, CTxDestin
return false;
}

if (!pwallet->CanGetAddresses(internal)) {
return false;
}

if (nIndex == -1)
{
Expand Down

0 comments on commit bd7c03d

Please sign in to comment.