MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / IsSolvable

Function IsSolvable

src/script/sign.cpp:497–513  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

495const SigningProvider& DUMMY_SIGNING_PROVIDER = SigningProvider();
496
497bool IsSolvable(const SigningProvider& provider, const CScript& script)
498{
499 // This check is to make sure that the script we created can actually be solved for and signed by us
500 // if we were to have the private keys. This is just to make sure that the script is valid and that,
501 // if found in a transaction, we would still accept and relay that transaction. In particular,
502 // it will reject witness outputs that require signing with an uncompressed public key.
503 SignatureData sigs;
504 // Make sure that STANDARD_SCRIPT_VERIFY_FLAGS includes SCRIPT_VERIFY_WITNESS_PUBKEYTYPE, the most
505 // important property this function is designed to test for.
506 static_assert(STANDARD_SCRIPT_VERIFY_FLAGS & SCRIPT_VERIFY_WITNESS_PUBKEYTYPE, "IsSolvable requires standard script flags to include WITNESS_PUBKEYTYPE");
507 if (ProduceSignature(provider, DUMMY_SIGNATURE_CREATOR, script, sigs, true)) {
508 // VerifyScript check is just defensive, and should never fail.
509 assert(VerifyScript(sigs.scriptSig, script, &sigs.scriptWitness, STANDARD_SCRIPT_VERIFY_FLAGS | SCRIPT_FORKID_DISABLED, DUMMY_CHECKER));
510 return true;
511 }
512 return false;
513}
514
515PartiallySignedTransaction::PartiallySignedTransaction(const CTransaction& tx) : tx(tx)
516{

Callers 5

operator()Method · 0.85
AvailableCoinsMethod · 0.85
LearnRelatedScriptsMethod · 0.85
CheckFunction · 0.85

Calls 2

ProduceSignatureFunction · 0.85
VerifyScriptFunction · 0.85

Tested by 1

CheckFunction · 0.68