Refinement of the Workaround put in place to keep the performance of legacy tests.

Until all the legacy tests are refactored, we change slightly the ALL_VERIFY_FLAGS Collection to remove those Flags that are not compatible(SIGHASH_FORKID and PUBKEYTYPE).
parent 783a10bc
......@@ -22,9 +22,6 @@
package org.bitcoinj.script;
import com.chain.bitcoinj.utilities.ScriptLogListener;
import com.chain.bitcoinj.utilities.ScriptLogManager;
import org.bitcoinj.core.*;
import org.bitcoinj.core.VerificationException.*;
......@@ -94,36 +91,16 @@ public class Script {
PUBKEYTYPE // June 26, 29018.
// After the commits from (June-July 2018), the Script engine supports now much more Verifications (MinimalData,
// DER encoding, Public key compression, etc). As a side effects, some tests which transaction used to be valid,
// are NOT anymore due to the new verifications. So until all those tests scenarios are revised and changed, we
// used a workaround, declaring an additional Enum with the Verification Flags used in the tests, to make them
// pass until the test data is changed.
// This is the "old" ALL_VERIFY_FLAGS, containing all the possible verifications:
public static final EnumSet<VerifyFlag> COMPLETE_VERIFY_FLAGS = EnumSet.allOf(VerifyFlag.class);
// This is now the "new" ALL_VERIFY_FLAGS", same as the old one but without the Verifications that make some of the
// legacy tests fail.
public static final EnumSet<VerifyFlag> ALL_VERIFY_FLAGS = EnumSet.of( VerifyFlag.P2SH,
// NOTE:
// Some of the new verifications implemented in the Script are not compatible with legacy tests:
// - SIGHASH_FORKID: forces the Script to verify the ForkID flag in the SIGHASH_BYTE is enabled
// - PUBKETTYPE: forces the Script to checkh if the public key compression is OK
// Some legacy tests are not compilant with the previous 2 flags. The "ALL_VERIFY_FLAGS" Set
// (Which is used by those tests) includes all the Flags, so in order to keep the legacy behaviour of those tests,
// we redefine this collection so it does NOT include them. Temporary solution.
public static final EnumSet<VerifyFlag> ALL_VERIFY_FLAGS = EnumSet.complementOf(EnumSet.of(VerifyFlag.SIGHASH_FORKID, VerifyFlag.PUBKEYTYPE));
private static final Logger log = LoggerFactory.getLogger(Script.class);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment