MCPcopy Create free account
hub / github.com/ElementsProject/elements / IsSolvable

Function IsSolvable

src/script/sign.cpp:607–624  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

605const BaseSignatureCreator& DUMMY_MAXIMUM_SIGNATURE_CREATOR = DummySignatureCreator(33, 32);
606
607bool IsSolvable(const SigningProvider& provider, const CScript& script)
608{
609 // This check is to make sure that the script we created can actually be solved for and signed by us
610 // if we were to have the private keys. This is just to make sure that the script is valid and that,
611 // if found in a transaction, we would still accept and relay that transaction. In particular,
612 // it will reject witness outputs that require signing with an uncompressed public key.
613 SignatureData sigs;
614 // Make sure that STANDARD_SCRIPT_VERIFY_FLAGS includes SCRIPT_VERIFY_WITNESS_PUBKEYTYPE, the most
615 // important property this function is designed to test for.
616 static_assert(STANDARD_SCRIPT_VERIFY_FLAGS & SCRIPT_VERIFY_WITNESS_PUBKEYTYPE, "IsSolvable requires standard script flags to include WITNESS_PUBKEYTYPE");
617 if (ProduceSignature(provider, DUMMY_SIGNATURE_CREATOR, script, sigs)) {
618 // VerifyScript check is just defensive, and should never fail.
619 bool verified = VerifyScript(sigs.scriptSig, script, &sigs.scriptWitness, STANDARD_SCRIPT_VERIFY_FLAGS, DUMMY_CHECKER);
620 assert(verified);
621 return true;
622 }
623 return false;
624}
625
626bool IsSegWitOutput(const SigningProvider& provider, const CScript& script)
627{

Callers 7

LearnRelatedScriptsMethod · 0.85
spend.cppFile · 0.85
getaddressinfoFunction · 0.85
DoCheckFunction · 0.85
FUZZ_TARGET_INITFunction · 0.85
FUZZ_TARGET_INITFunction · 0.85

Calls 2

ProduceSignatureFunction · 0.85
VerifyScriptFunction · 0.85

Tested by 3

DoCheckFunction · 0.68
FUZZ_TARGET_INITFunction · 0.68
FUZZ_TARGET_INITFunction · 0.68