| 495 | const SigningProvider& DUMMY_SIGNING_PROVIDER = SigningProvider(); |
| 496 | |
| 497 | bool 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 | |
| 515 | PartiallySignedTransaction::PartiallySignedTransaction(const CTransaction& tx) : tx(tx) |
| 516 | { |