From b16f93caddcd3254eaf3dc43e09adf2142a9c40a Mon Sep 17 00:00:00 2001 From: Antoine Poinsot Date: Wed, 20 Jul 2022 12:42:08 +0200 Subject: script/sign: remove needless IsSolvable() utility It was used back when we didn't have a concept of descriptor. Now we can check for solvability using descriptors. --- src/script/sign.cpp | 19 ------------------- src/script/sign.h | 6 ------ 2 files changed, 25 deletions(-) (limited to 'src/script') diff --git a/src/script/sign.cpp b/src/script/sign.cpp index 3b8071d9d1..a63b042ccc 100644 --- a/src/script/sign.cpp +++ b/src/script/sign.cpp @@ -627,25 +627,6 @@ public: const BaseSignatureCreator& DUMMY_SIGNATURE_CREATOR = DummySignatureCreator(32, 32); const BaseSignatureCreator& DUMMY_MAXIMUM_SIGNATURE_CREATOR = DummySignatureCreator(33, 32); -bool IsSolvable(const SigningProvider& provider, const CScript& script) -{ - // This check is to make sure that the script we created can actually be solved for and signed by us - // if we were to have the private keys. This is just to make sure that the script is valid and that, - // if found in a transaction, we would still accept and relay that transaction. In particular, - // it will reject witness outputs that require signing with an uncompressed public key. - SignatureData sigs; - // Make sure that STANDARD_SCRIPT_VERIFY_FLAGS includes SCRIPT_VERIFY_WITNESS_PUBKEYTYPE, the most - // important property this function is designed to test for. - static_assert(STANDARD_SCRIPT_VERIFY_FLAGS & SCRIPT_VERIFY_WITNESS_PUBKEYTYPE, "IsSolvable requires standard script flags to include WITNESS_PUBKEYTYPE"); - if (ProduceSignature(provider, DUMMY_SIGNATURE_CREATOR, script, sigs)) { - // VerifyScript check is just defensive, and should never fail. - bool verified = VerifyScript(sigs.scriptSig, script, &sigs.scriptWitness, STANDARD_SCRIPT_VERIFY_FLAGS, DUMMY_CHECKER); - assert(verified); - return true; - } - return false; -} - bool IsSegWitOutput(const SigningProvider& provider, const CScript& script) { int version; diff --git a/src/script/sign.h b/src/script/sign.h index 5e58272154..958d673b9f 100644 --- a/src/script/sign.h +++ b/src/script/sign.h @@ -97,12 +97,6 @@ bool SignSignature(const SigningProvider &provider, const CTransaction& txFrom, SignatureData DataFromTransaction(const CMutableTransaction& tx, unsigned int nIn, const CTxOut& txout); void UpdateInput(CTxIn& input, const SignatureData& data); -/* Check whether we know how to sign for an output like this, assuming we - * have all private keys. While this function does not need private keys, the passed - * provider is used to look up public keys and redeemscripts by hash. - * Solvability is unrelated to whether we consider this output to be ours. */ -bool IsSolvable(const SigningProvider& provider, const CScript& script); - /** Check whether a scriptPubKey is known to be segwit. */ bool IsSegWitOutput(const SigningProvider& provider, const CScript& script); -- cgit v1.2.3