v31.1-roots.1 · Commit 6: [PATCH 06/17] feat(wallet): preserve Roots signing and spend controls on v31
src/wallet/scriptpubkeyman.cpp
Before: src/wallet/scriptpubkeyman.cpp · After: src/wallet/scriptpubkeyman.cpp
File metadata
index 8a1c0a45a56673eeeeaa5e1a3f4ae55eae510c3b..95820f80cd1d8faf44ff12c614a7404f5d9cac91 100644
Download original patch · Release notes
Diff rows 1–26 of 26. Line numbers refer to the original before/after files.
+ Added− RemovedUnmarked lines are context.
Scroll the code area horizontally to read long lines. Before is on the left; after is on the right. Unified view fits narrow screens more easily.
src/wallet/scriptpubkeyman.cpp
CHANGED
|
@@ -965,6 +965,26 @@ bool DescriptorScriptPubKeyMan::HasPrivKey(const CKeyID& keyid) const
|
|
| 965 |
return m_map_keys.contains(keyid) || m_map_crypted_keys.contains(keyid);
|
| 966 |
}
|
| 967 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 968 |
std::optional<CKey> DescriptorScriptPubKeyMan::GetKey(const CKeyID& keyid) const
|
| 969 |
{
|
| 970 |
AssertLockHeld(cs_desc_man);
|
|
|
|
| 965 |
return m_map_keys.contains(keyid) || m_map_crypted_keys.contains(keyid);
|
| 966 |
}
|
| 967 |
|
| 968 |
+
std::set<CKeyID> DescriptorScriptPubKeyMan::GetAvailableKeys(const CScript& script) const
|
| 969 |
+
{
|
| 970 |
+
LOCK(cs_desc_man);
|
| 971 |
+
const auto it{m_map_script_pub_keys.find(script)};
|
| 972 |
+
if (it == m_map_script_pub_keys.end()) return {};
|
| 973 |
+
class AvailableKeys final : public SigningProvider {
|
| 974 |
+
const DescriptorScriptPubKeyMan& m_manager;
|
| 975 |
+
public:
|
| 976 |
+
explicit AvailableKeys(const DescriptorScriptPubKeyMan& manager) : m_manager(manager) {}
|
| 977 |
+
bool HaveKey(const CKeyID& keyid) const override
|
| 978 |
+
{
|
| 979 |
+
LOCK(m_manager.cs_desc_man);
|
| 980 |
+
return m_manager.HasPrivKey(keyid);
|
| 981 |
+
}
|
| 982 |
+
} provider{*this};
|
| 983 |
+
std::set<CKeyID> keys;
|
| 984 |
+
m_wallet_descriptor.descriptor->GetAvailableKeys(it->second, m_wallet_descriptor.cache, provider, keys);
|
| 985 |
+
return keys;
|
| 986 |
+
}
|
| 987 |
+
|
| 988 |
std::optional<CKey> DescriptorScriptPubKeyMan::GetKey(const CKeyID& keyid) const
|
| 989 |
{
|
| 990 |
AssertLockHeld(cs_desc_man);
|