MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / CanProvide

Method CanProvide

src/wallet/scriptpubkeyman.cpp:260–281  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

258}
259
260bool LegacyDataSPKM::CanProvide(const CScript& script, SignatureData& sigdata)
261{
262 IsMineResult ismine = LegacyWalletIsMineInnerDONOTUSE(*this, script, IsMineSigVersion::TOP, /* recurse_scripthash= */ false);
263 if (ismine == IsMineResult::SPENDABLE || ismine == IsMineResult::WATCH_ONLY) {
264 // If ismine, it means we recognize keys or script ids in the script, or
265 // are watching the script itself, and we can at least provide metadata
266 // or solving information, even if not able to sign fully.
267 return true;
268 } else {
269 // If, given the stuff in sigdata, we could make a valid signature, then we can provide for this script
270 ProduceSignature(*this, DUMMY_SIGNATURE_CREATOR, script, sigdata);
271 if (!sigdata.signatures.empty()) {
272 // If we could make signatures, make sure we have a private key to actually make a signature
273 bool has_privkeys = false;
274 for (const auto& key_sig_pair : sigdata.signatures) {
275 has_privkeys |= HaveKey(key_sig_pair.first);
276 }
277 return has_privkeys;
278 }
279 return false;
280 }
281}
282
283bool LegacyDataSPKM::LoadKey(const CKey& key, const CPubKey &pubkey)
284{

Callers 3

SignMessageMethod · 0.45
GetScriptPubKeyMansMethod · 0.45
GetSolvingProviderMethod · 0.45

Calls 3

ProduceSignatureFunction · 0.85
emptyMethod · 0.45

Tested by

no test coverage detected