File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -3467,11 +3467,17 @@ std::unique_ptr<SigningProvider> CWallet::GetSolvingProvider(const CScript& scri
34673467
34683468std::unique_ptr<SigningProvider> CWallet::GetSolvingProvider (const CScript& script, SignatureData& sigdata) const
34693469{
3470- for (const auto & spk_man_pair : m_spk_managers) {
3471- if (spk_man_pair.second ->CanProvide (script, sigdata)) {
3472- return spk_man_pair.second ->GetSolvingProvider (script);
3473- }
3470+ // Search the cache for relevant SPKMs instead of iterating m_spk_managers
3471+ const auto & it = m_cached_spks.find (script);
3472+ if (it != m_cached_spks.end ()) {
3473+ // All spkms for a given script must already be able to make a SigningProvider for the script, so just return the first one.
3474+ Assume (it->second .at (0 )->CanProvide (script, sigdata));
3475+ return it->second .at (0 )->GetSolvingProvider (script);
34743476 }
3477+
3478+ // Legacy wallet
3479+ if (IsLegacy () && GetLegacyScriptPubKeyMan ()->CanProvide (script, sigdata)) return GetLegacyScriptPubKeyMan ()->GetSolvingProvider (script);
3480+
34753481 return nullptr ;
34763482}
34773483
You can’t perform that action at this time.
0 commit comments