Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallet.cpp
Show First 20 Lines • Show All 1,490 Lines • ▼ Show 20 Lines | |||||
// or a max-sized low-S signature (e.g. 72 bytes) if use_max_sig is true | // or a max-sized low-S signature (e.g. 72 bytes) if use_max_sig is true | ||||
bool CWallet::DummySignInput(CTxIn &tx_in, const CTxOut &txout, | bool CWallet::DummySignInput(CTxIn &tx_in, const CTxOut &txout, | ||||
bool use_max_sig) const { | bool use_max_sig) const { | ||||
// Fill in dummy signatures for fee calculation. | // Fill in dummy signatures for fee calculation. | ||||
const CScript &scriptPubKey = txout.scriptPubKey; | const CScript &scriptPubKey = txout.scriptPubKey; | ||||
SignatureData sigdata; | SignatureData sigdata; | ||||
std::unique_ptr<SigningProvider> provider = | std::unique_ptr<SigningProvider> provider = | ||||
GetSigningProvider(scriptPubKey); | GetSolvingProvider(scriptPubKey); | ||||
if (!provider) { | if (!provider) { | ||||
// We don't know about this scriptpbuKey; | // We don't know about this scriptpbuKey; | ||||
return false; | return false; | ||||
} | } | ||||
if (!ProduceSignature(*provider, | if (!ProduceSignature(*provider, | ||||
use_max_sig ? DUMMY_MAXIMUM_SIGNATURE_CREATOR | use_max_sig ? DUMMY_MAXIMUM_SIGNATURE_CREATOR | ||||
: DUMMY_SIGNATURE_CREATOR, | : DUMMY_SIGNATURE_CREATOR, | ||||
▲ Show 20 Lines • Show All 868 Lines • ▼ Show 20 Lines | for (const auto &entry : mapWallet) { | ||||
continue; | continue; | ||||
} | } | ||||
if (!allow_used_addresses && IsUsedDestination(wtxid, i)) { | if (!allow_used_addresses && IsUsedDestination(wtxid, i)) { | ||||
continue; | continue; | ||||
} | } | ||||
std::unique_ptr<SigningProvider> provider = | std::unique_ptr<SigningProvider> provider = | ||||
GetSigningProvider(wtx.tx->vout[i].scriptPubKey); | GetSolvingProvider(wtx.tx->vout[i].scriptPubKey); | ||||
bool solvable = | bool solvable = | ||||
provider ? IsSolvable(*provider, wtx.tx->vout[i].scriptPubKey) | provider ? IsSolvable(*provider, wtx.tx->vout[i].scriptPubKey) | ||||
: false; | : false; | ||||
bool spendable = | bool spendable = | ||||
((mine & ISMINE_SPENDABLE) != ISMINE_NO) || | ((mine & ISMINE_SPENDABLE) != ISMINE_NO) || | ||||
(((mine & ISMINE_WATCH_ONLY) != ISMINE_NO) && | (((mine & ISMINE_WATCH_ONLY) != ISMINE_NO) && | ||||
(coinControl && coinControl->fAllowWatchOnly && solvable)); | (coinControl && coinControl->fAllowWatchOnly && solvable)); | ||||
▲ Show 20 Lines • Show All 2,438 Lines • ▼ Show 20 Lines | |||||
ScriptPubKeyMan *CWallet::GetScriptPubKeyMan(const uint256 &id) const { | ScriptPubKeyMan *CWallet::GetScriptPubKeyMan(const uint256 &id) const { | ||||
if (m_spk_managers.count(id) > 0) { | if (m_spk_managers.count(id) > 0) { | ||||
return m_spk_managers.at(id).get(); | return m_spk_managers.at(id).get(); | ||||
} | } | ||||
return nullptr; | return nullptr; | ||||
} | } | ||||
std::unique_ptr<SigningProvider> | std::unique_ptr<SigningProvider> | ||||
CWallet::GetSigningProvider(const CScript &script) const { | CWallet::GetSolvingProvider(const CScript &script) const { | ||||
SignatureData sigdata; | SignatureData sigdata; | ||||
return GetSigningProvider(script, sigdata); | return GetSolvingProvider(script, sigdata); | ||||
} | } | ||||
std::unique_ptr<SigningProvider> | std::unique_ptr<SigningProvider> | ||||
CWallet::GetSigningProvider(const CScript &script, | CWallet::GetSolvingProvider(const CScript &script, | ||||
SignatureData &sigdata) const { | SignatureData &sigdata) const { | ||||
for (const auto &spk_man_pair : m_spk_managers) { | for (const auto &spk_man_pair : m_spk_managers) { | ||||
if (spk_man_pair.second->CanProvide(script, sigdata)) { | if (spk_man_pair.second->CanProvide(script, sigdata)) { | ||||
return spk_man_pair.second->GetSigningProvider(script); | return spk_man_pair.second->GetSolvingProvider(script); | ||||
} | } | ||||
} | } | ||||
return nullptr; | return nullptr; | ||||
} | } | ||||
LegacyScriptPubKeyMan *CWallet::GetLegacyScriptPubKeyMan() const { | LegacyScriptPubKeyMan *CWallet::GetLegacyScriptPubKeyMan() const { | ||||
// Legacy wallets only have one ScriptPubKeyMan which is a | // Legacy wallets only have one ScriptPubKeyMan which is a | ||||
// LegacyScriptPubKeyMan. Everything in m_internal_spk_managers and | // LegacyScriptPubKeyMan. Everything in m_internal_spk_managers and | ||||
▲ Show 20 Lines • Show All 43 Lines • Show Last 20 Lines |