aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet.cpp
diff options
context:
space:
mode:
authorS3RK <1466284+S3RK@users.noreply.github.com>2021-10-05 09:45:45 +0200
committerS3RK <1466284+S3RK@users.noreply.github.com>2021-10-05 09:50:38 +0200
commit456e350926adde5dabdbc85fc0f017fb29bdadb3 (patch)
treef0fc56857c3ada5f2dc08f680567fe7b94a23604 /src/wallet/wallet.cpp
parent69a66dcd0dacda54d813a61e9d4f61085c2268b2 (diff)
downloadbitcoin-456e350926adde5dabdbc85fc0f017fb29bdadb3.tar.xz
wallet: resolve ambiguity of two ScriptPubKey managers providing same script
Diffstat (limited to 'src/wallet/wallet.cpp')
-rw-r--r--src/wallet/wallet.cpp31
1 files changed, 10 insertions, 21 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index 6885499be2..a58f09b953 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -2253,16 +2253,15 @@ void ReserveDestination::ReturnDestination()
bool CWallet::DisplayAddress(const CTxDestination& dest)
{
CScript scriptPubKey = GetScriptForDestination(dest);
- const auto spk_man = GetScriptPubKeyMan(scriptPubKey);
- if (spk_man == nullptr) {
- return false;
- }
- auto signer_spk_man = dynamic_cast<ExternalSignerScriptPubKeyMan*>(spk_man);
- if (signer_spk_man == nullptr) {
- return false;
+ for (const auto& spk_man : GetScriptPubKeyMans(scriptPubKey)) {
+ auto signer_spk_man = dynamic_cast<ExternalSignerScriptPubKeyMan *>(spk_man);
+ if (signer_spk_man == nullptr) {
+ continue;
+ }
+ ExternalSigner signer = ExternalSignerScriptPubKeyMan::GetExternalSigner();
+ return signer_spk_man->DisplayAddress(scriptPubKey, signer);
}
- ExternalSigner signer = ExternalSignerScriptPubKeyMan::GetExternalSigner();
- return signer_spk_man->DisplayAddress(scriptPubKey, signer);
+ return false;
}
bool CWallet::LockCoin(const COutPoint& output, WalletBatch* batch)
@@ -3035,9 +3034,10 @@ ScriptPubKeyMan* CWallet::GetScriptPubKeyMan(const OutputType& type, bool intern
return it->second;
}
-std::set<ScriptPubKeyMan*> CWallet::GetScriptPubKeyMans(const CScript& script, SignatureData& sigdata) const
+std::set<ScriptPubKeyMan*> CWallet::GetScriptPubKeyMans(const CScript& script) const
{
std::set<ScriptPubKeyMan*> spk_mans;
+ SignatureData sigdata;
for (const auto& spk_man_pair : m_spk_managers) {
if (spk_man_pair.second->CanProvide(script, sigdata)) {
spk_mans.insert(spk_man_pair.second.get());
@@ -3046,17 +3046,6 @@ std::set<ScriptPubKeyMan*> CWallet::GetScriptPubKeyMans(const CScript& script, S
return spk_mans;
}
-ScriptPubKeyMan* CWallet::GetScriptPubKeyMan(const CScript& script) const
-{
- SignatureData sigdata;
- for (const auto& spk_man_pair : m_spk_managers) {
- if (spk_man_pair.second->CanProvide(script, sigdata)) {
- return spk_man_pair.second.get();
- }
- }
- return nullptr;
-}
-
ScriptPubKeyMan* CWallet::GetScriptPubKeyMan(const uint256& id) const
{
if (m_spk_managers.count(id) > 0) {