Skip to content

Commit 596f646

Browse files
committed
Key pool: Move CanGetAddresses call
Call LegacyScriptPubKeyMan::CanGetAddresses directly instead of calling CWallet::CanGetAddresses to only query the relevant key manager 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/bitcoin#16341 (comment)
1 parent 0b79caf commit 596f646

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/wallet/scriptpubkeyman.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,10 @@ bool LegacyScriptPubKeyMan::EncryptKeys(CKeyingMaterial& vMasterKeyIn)
264264

265265
bool LegacyScriptPubKeyMan::GetReservedDestination(const OutputType type, bool internal, int64_t& index, CKeyPool& keypool)
266266
{
267+
if (!CanGetAddresses(internal)) {
268+
return false;
269+
}
270+
267271
if (!ReserveKeyFromKeyPool(index, keypool, internal)) {
268272
return false;
269273
}

src/wallet/wallet.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3298,9 +3298,6 @@ bool ReserveDestination::GetReservedDestination(CTxDestination& dest, bool inter
32983298
return false;
32993299
}
33003300

3301-
if (!pwallet->CanGetAddresses(internal)) {
3302-
return false;
3303-
}
33043301

33053302
if (nIndex == -1)
33063303
{

0 commit comments

Comments
 (0)