Produce a signature for the given key.
| 216 | |
| 217 | //! Produce a signature for the given key. |
| 218 | miniscript::Availability Sign(const CPubKey& key, std::vector<unsigned char>& sig) const { |
| 219 | if (supported.contains(Challenge(ChallengeType::PK, ChallengeNumber(key)))) { |
| 220 | if (!miniscript::IsTapscript(m_script_ctx)) { |
| 221 | auto it = g_testdata->signatures.find(key); |
| 222 | if (it == g_testdata->signatures.end()) return miniscript::Availability::NO; |
| 223 | sig = it->second; |
| 224 | } else { |
| 225 | auto it = g_testdata->schnorr_signatures.find(XOnlyPubKey{key}); |
| 226 | if (it == g_testdata->schnorr_signatures.end()) return miniscript::Availability::NO; |
| 227 | sig = it->second; |
| 228 | } |
| 229 | return miniscript::Availability::YES; |
| 230 | } |
| 231 | return miniscript::Availability::NO; |
| 232 | } |
| 233 | |
| 234 | //! Helper function for the various hash based satisfactions. |
| 235 | miniscript::Availability SatHash(const std::vector<unsigned char>& hash, std::vector<unsigned char>& preimage, ChallengeType chtype) const { |
no test coverage detected