aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/scriptpubkeyman.cpp
diff options
context:
space:
mode:
authorAndrew Chow <[email protected]>2019-10-07 14:11:34 -0400
committerAndrew Chow <[email protected]>2019-12-02 11:57:20 -0500
commitba41aa4969169cd73d6b4f57444ed7d8d875de10 (patch)
tree1645f6defd962dc195bde34031a862a9bc84eed3 /src/wallet/scriptpubkeyman.cpp
parentAdd OutputType and CPubKey parameters to KeepDestination (diff)
downloaddiscoin-ba41aa4969169cd73d6b4f57444ed7d8d875de10.tar.xz
discoin-ba41aa4969169cd73d6b4f57444ed7d8d875de10.zip
Key pool: Move LearnRelated and GetDestination calls
Addresses are determined by LegacyScriptPubKeyMan::GetReservedDestination instead of ReserveDestination::GetReservedDestination as other ScriptPubKeyMan implementations may construct addresses differently This does not change behavior.
Diffstat (limited to 'src/wallet/scriptpubkeyman.cpp')
-rw-r--r--src/wallet/scriptpubkeyman.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/wallet/scriptpubkeyman.cpp b/src/wallet/scriptpubkeyman.cpp
index f7153a751..4986871fb 100644
--- a/src/wallet/scriptpubkeyman.cpp
+++ b/src/wallet/scriptpubkeyman.cpp
@@ -262,7 +262,7 @@ bool LegacyScriptPubKeyMan::EncryptKeys(CKeyingMaterial& vMasterKeyIn)
return true;
}
-bool LegacyScriptPubKeyMan::GetReservedDestination(const OutputType type, bool internal, int64_t& index, CKeyPool& keypool)
+bool LegacyScriptPubKeyMan::GetReservedDestination(const OutputType type, bool internal, CTxDestination& address, int64_t& index, CKeyPool& keypool)
{
if (!CanGetAddresses(internal)) {
return false;
@@ -271,6 +271,7 @@ bool LegacyScriptPubKeyMan::GetReservedDestination(const OutputType type, bool i
if (!ReserveKeyFromKeyPool(index, keypool, internal)) {
return false;
}
+ address = GetDestinationForKey(keypool.vchPubKey, type);
return true;
}
@@ -1091,6 +1092,7 @@ void LegacyScriptPubKeyMan::KeepDestination(int64_t nIndex, const OutputType& ty
// Remove from key pool
WalletBatch batch(m_storage.GetDatabase());
batch.ErasePool(nIndex);
+ LearnRelatedScripts(pubkey, type);
WalletLogPrintf("keypool keep %d\n", nIndex);
}