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

Method Sign

src/test/miniscript_tests.cpp:218–232  ·  view source on GitHub ↗

Produce a signature for the given key.

Source from the content-addressed store, hash-verified

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 {

Callers 8

BOOST_AUTO_TEST_CASEFunction · 0.45
BOOST_FIXTURE_TEST_CASEFunction · 0.45
BOOST_FIXTURE_TEST_CASEFunction · 0.45
TestBuilderClass · 0.45
sign_multisigFunction · 0.45
BOOST_AUTO_TEST_CASEFunction · 0.45
sign_multisigFunction · 0.45
TestDataMethod · 0.45

Calls 5

ChallengeNumberFunction · 0.85
IsTapscriptFunction · 0.85
findMethod · 0.80
containsMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected