| 258 | } |
| 259 | |
| 260 | bool 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 | |
| 283 | bool LegacyDataSPKM::LoadKey(const CKey& key, const CPubKey &pubkey) |
| 284 | { |
no test coverage detected