Add OutputType and CPubKey parameters to KeepDestination

These need to be added so that LearnRelatedScripts can be called
from within KeepDestination later.
This commit is contained in:
Andrew Chow
2019-11-26 11:52:51 -05:00
parent 9fcf8ce7ae
commit 65833a7407
3 changed files with 8 additions and 8 deletions

View File

@@ -18,7 +18,7 @@ bool LegacyScriptPubKeyMan::GetNewDestination(const OutputType type, CTxDestinat
// Generate a new key that is added to wallet
CPubKey new_key;
if (!GetKeyFromPool(new_key)) {
if (!GetKeyFromPool(new_key, type)) {
error = "Error: Keypool ran out, please call keypoolrefill first";
return false;
}
@@ -1086,7 +1086,7 @@ void LegacyScriptPubKeyMan::AddKeypoolPubkeyWithDB(const CPubKey& pubkey, const
m_pool_key_to_index[pubkey.GetID()] = index;
}
void LegacyScriptPubKeyMan::KeepDestination(int64_t nIndex)
void LegacyScriptPubKeyMan::KeepDestination(int64_t nIndex, const OutputType& type, const CPubKey& pubkey)
{
// Remove from key pool
WalletBatch batch(m_storage.GetDatabase());
@@ -1112,7 +1112,7 @@ void LegacyScriptPubKeyMan::ReturnDestination(int64_t nIndex, bool fInternal, co
WalletLogPrintf("keypool return %d\n", nIndex);
}
bool LegacyScriptPubKeyMan::GetKeyFromPool(CPubKey& result, bool internal)
bool LegacyScriptPubKeyMan::GetKeyFromPool(CPubKey& result, const OutputType type, bool internal)
{
if (!CanGetAddresses(internal)) {
return false;
@@ -1128,7 +1128,7 @@ bool LegacyScriptPubKeyMan::GetKeyFromPool(CPubKey& result, bool internal)
result = GenerateNewKey(batch, internal);
return true;
}
KeepDestination(nIndex);
KeepDestination(nIndex, type, keypool.vchPubKey);
result = keypool.vchPubKey;
}
return true;