| 605 | const BaseSignatureCreator& DUMMY_MAXIMUM_SIGNATURE_CREATOR = DummySignatureCreator(33, 32); |
| 606 | |
| 607 | bool 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 | |
| 626 | bool IsSegWitOutput(const SigningProvider& provider, const CScript& script) |
| 627 | { |