wallet: LearnRelatedScripts only if KeepDestination

This commit is contained in:
João Barbosa 2019-10-24 09:45:20 +01:00
parent 55295fba4c
commit 3958295bc8

View file

@ -3256,7 +3256,6 @@ bool ReserveDestination::GetReservedDestination(CTxDestination& dest, bool inter
fInternal = keypool.fInternal; fInternal = keypool.fInternal;
} }
assert(vchPubKey.IsValid()); assert(vchPubKey.IsValid());
m_spk_man->LearnRelatedScripts(vchPubKey, type);
address = GetDestinationForKey(vchPubKey, type); address = GetDestinationForKey(vchPubKey, type);
dest = address; dest = address;
return true; return true;
@ -3264,8 +3263,10 @@ bool ReserveDestination::GetReservedDestination(CTxDestination& dest, bool inter
void ReserveDestination::KeepDestination() void ReserveDestination::KeepDestination()
{ {
if (nIndex != -1) if (nIndex != -1) {
m_spk_man->KeepDestination(nIndex); m_spk_man->KeepDestination(nIndex);
m_spk_man->LearnRelatedScripts(vchPubKey, type);
}
nIndex = -1; nIndex = -1;
vchPubKey = CPubKey(); vchPubKey = CPubKey();
address = CNoDestination(); address = CNoDestination();