mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-03 09:56:38 -05:00
wallet: Use scriptPubKeyCache in GetSolvingProvider
This commit is contained in:
parent
b410f68791
commit
39640dd34e
1 changed files with 10 additions and 4 deletions
|
@ -3467,11 +3467,17 @@ std::unique_ptr<SigningProvider> CWallet::GetSolvingProvider(const CScript& scri
|
||||||
|
|
||||||
std::unique_ptr<SigningProvider> CWallet::GetSolvingProvider(const CScript& script, SignatureData& sigdata) const
|
std::unique_ptr<SigningProvider> CWallet::GetSolvingProvider(const CScript& script, SignatureData& sigdata) const
|
||||||
{
|
{
|
||||||
for (const auto& spk_man_pair : m_spk_managers) {
|
// Search the cache for relevant SPKMs instead of iterating m_spk_managers
|
||||||
if (spk_man_pair.second->CanProvide(script, sigdata)) {
|
const auto& it = m_cached_spks.find(script);
|
||||||
return spk_man_pair.second->GetSolvingProvider(script);
|
if (it != m_cached_spks.end()) {
|
||||||
}
|
// All spkms for a given script must already be able to make a SigningProvider for the script, so just return the first one.
|
||||||
|
Assume(it->second.at(0)->CanProvide(script, sigdata));
|
||||||
|
return it->second.at(0)->GetSolvingProvider(script);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Legacy wallet
|
||||||
|
if (IsLegacy() && GetLegacyScriptPubKeyMan()->CanProvide(script, sigdata)) return GetLegacyScriptPubKeyMan()->GetSolvingProvider(script);
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue