mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-01 19:21:28 +02:00
wallet: resolve ambiguity of two ScriptPubKey managers providing same script
This commit is contained in:
@ -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;
|
||||
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);
|
||||
}
|
||||
auto signer_spk_man = dynamic_cast<ExternalSignerScriptPubKeyMan*>(spk_man);
|
||||
if (signer_spk_man == nullptr) {
|
||||
return false;
|
||||
}
|
||||
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) {
|
||||
|
Reference in New Issue
Block a user