aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/scriptpubkeyman.cpp
diff options
context:
space:
mode:
authorAndrew Chow <achow101-github@achow101.com>2019-10-07 14:11:34 -0400
committerAndrew Chow <achow101-github@achow101.com>2019-11-01 22:58:05 -0400
commita18edd7b383d667b15b6d4b87aa3a055a9fa5051 (patch)
tree4bce57892e2f657934cb149107e8d423327ad99a /src/wallet/scriptpubkeyman.cpp
parent9716bbe0f8081814cbf052e8211d1c6a838e5262 (diff)
Refactor: Move GetMetadata code out of getaddressinfo
Easier to review ignoring whitespace: git log -p -n1 -w This commit does not change behavior.
Diffstat (limited to 'src/wallet/scriptpubkeyman.cpp')
-rw-r--r--src/wallet/scriptpubkeyman.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/wallet/scriptpubkeyman.cpp b/src/wallet/scriptpubkeyman.cpp
index 5641ef7b12..8041a28d69 100644
--- a/src/wallet/scriptpubkeyman.cpp
+++ b/src/wallet/scriptpubkeyman.cpp
@@ -382,6 +382,21 @@ size_t LegacyScriptPubKeyMan::KeypoolCountExternalKeys()
return setExternalKeyPool.size() + set_pre_split_keypool.size();
}
+const CKeyMetadata* LegacyScriptPubKeyMan::GetMetadata(uint160 id) const
+{
+ AssertLockHeld(cs_wallet);
+ auto it = mapKeyMetadata.find(CKeyID(id));
+ if (it != mapKeyMetadata.end()) {
+ return &it->second;
+ } else {
+ auto it2 = m_script_metadata.find(CScriptID(id));
+ if (it2 != m_script_metadata.end()) {
+ return &it2->second;
+ }
+ }
+ return nullptr;
+}
+
/**
* Update wallet first key creation time. This should be called whenever keys
* are added to the wallet, with the oldest key creation time.