diff --git a/core-test/src/test/scala/org/bitcoins/core/util/ScriptProgramTestUtil.scala b/core-test/src/test/scala/org/bitcoins/core/util/ScriptProgramTestUtil.scala index 0281212cda..4bb49ccf8b 100644 --- a/core-test/src/test/scala/org/bitcoins/core/util/ScriptProgramTestUtil.scala +++ b/core-test/src/test/scala/org/bitcoins/core/util/ScriptProgramTestUtil.scala @@ -3,7 +3,6 @@ package org.bitcoins.core.util import org.bitcoins.core.script.{ ExecutedScriptProgram, ExecutionInProgressScriptProgram, - PreExecutionScriptProgram, StartedScriptProgram } @@ -17,7 +16,7 @@ trait ScriptProgramTestUtil { def toExecutedScriptProgram(p: StartedScriptProgram): ExecutedScriptProgram = p match { case e: ExecutedScriptProgram => e - case _: PreExecutionScriptProgram | _: ExecutionInProgressScriptProgram => + case _: ExecutionInProgressScriptProgram => throw new RuntimeException("Should be an executed script program") } @@ -26,7 +25,7 @@ trait ScriptProgramTestUtil { p: StartedScriptProgram): ExecutionInProgressScriptProgram = p match { case e: ExecutionInProgressScriptProgram => e - case _: PreExecutionScriptProgram | _: ExecutedScriptProgram => + case _: ExecutedScriptProgram => throw new RuntimeException( "Must be an execution in progress script program") } diff --git a/core/src/main/scala/org/bitcoins/core/script/interpreter/ScriptInterpreter.scala b/core/src/main/scala/org/bitcoins/core/script/interpreter/ScriptInterpreter.scala index 84fb63bfb2..1125edeece 100644 --- a/core/src/main/scala/org/bitcoins/core/script/interpreter/ScriptInterpreter.scala +++ b/core/src/main/scala/org/bitcoins/core/script/interpreter/ScriptInterpreter.scala @@ -1248,8 +1248,7 @@ sealed abstract class ScriptInterpreter { case newProgram: ExecutedScriptProgram => //script was marked invalid for other reasons, don't need to update the opcount (newProgram, opCount) - case newProgram @ (_: ExecutionInProgressScriptProgram | - _: PreExecutionScriptProgram) => + case newProgram: ExecutionInProgressScriptProgram => val programOrError = newProgram val newOpCount = calcOpCount(opCount, OP_CHECKMULTISIG) + BitcoinScriptUtil @@ -1263,8 +1262,7 @@ sealed abstract class ScriptInterpreter { case newProgram: ExecutedScriptProgram => //script was marked invalid for other reasons, don't need to update the opcount (newProgram, opCount) - case newProgram @ (_: ExecutionInProgressScriptProgram | - _: PreExecutionScriptProgram) => + case newProgram: ExecutionInProgressScriptProgram => val programOrError = newProgram val newOpCount = calcOpCount(opCount, OP_CHECKMULTISIGVERIFY) + BitcoinScriptUtil diff --git a/inThisBuild.sbt b/inThisBuild.sbt index 84213782a9..ddefd59c04 100644 --- a/inThisBuild.sbt +++ b/inThisBuild.sbt @@ -2,7 +2,7 @@ import sbt.Keys.excludeLintKeys import scala.util.Properties -val scala2_13 = "2.13.12" +val scala2_13 = "2.13.13" ThisBuild / scalafmtOnCompile := !Properties.envOrNone("CI").contains("true") diff --git a/testkit-core/src/main/scala/org/bitcoins/testkitcore/gen/ScriptGenerators.scala b/testkit-core/src/main/scala/org/bitcoins/testkitcore/gen/ScriptGenerators.scala index 9d071d0778..ffec01f8cf 100644 --- a/testkit-core/src/main/scala/org/bitcoins/testkitcore/gen/ScriptGenerators.scala +++ b/testkit-core/src/main/scala/org/bitcoins/testkitcore/gen/ScriptGenerators.scala @@ -857,12 +857,9 @@ sealed abstract class ScriptGenerators { Some(0), hashType) (cltvScriptSig.asInstanceOf[CLTVScriptSignature], cltv, privKeys) - case _: UnassignedWitnessScriptPubKey | _: WitnessScriptPubKeyV0 => - throw new IllegalArgumentException( - "Cannot created a witness scriptPubKey for a CSVScriptSig since we do not have a witness") - case _: P2SHScriptPubKey | _: CLTVScriptPubKey | - _: P2PKWithTimeoutScriptPubKey | _: CSVScriptPubKey | - _: NonStandardScriptPubKey | _: WitnessCommitment => + case _: CLTVScriptPubKey | _: P2PKWithTimeoutScriptPubKey | + _: CSVScriptPubKey | _: NonStandardScriptPubKey | + _: WitnessCommitment => throw new IllegalArgumentException( "We only " + "want to generate P2PK, P2PKH, and MultiSig ScriptSignatures when creating a CSVScriptSignature") @@ -910,12 +907,9 @@ sealed abstract class ScriptGenerators { val csvScriptSig = lockTimeHelper(None, sequence, csv, privKeys, Some(0), hashType) (csvScriptSig.asInstanceOf[CSVScriptSignature], csv, privKeys) - case _: UnassignedWitnessScriptPubKey | _: WitnessScriptPubKeyV0 => - throw new IllegalArgumentException( - "Cannot created a witness scriptPubKey for a CSVScriptSig since we do not have a witness") - case _: P2SHScriptPubKey | _: CLTVScriptPubKey | - _: P2PKWithTimeoutScriptPubKey | _: CSVScriptPubKey | - _: NonStandardScriptPubKey | _: WitnessCommitment => + case _: CLTVScriptPubKey | _: P2PKWithTimeoutScriptPubKey | + _: CSVScriptPubKey | _: NonStandardScriptPubKey | + _: WitnessCommitment => throw new IllegalArgumentException( "We only " + "want to generate P2PK, P2PKH, and MultiSig ScriptSignatures when creating a CLTVScriptSignature.") @@ -1108,14 +1102,10 @@ sealed abstract class ScriptGenerators { ConditionalScriptSignature(scriptSig, true) case EmptyScriptPubKey => CSVScriptSignature(TrivialTrueScriptSignature) - case _: WitnessScriptPubKeyV0 | _: UnassignedWitnessScriptPubKey => - //bare segwit always has an empty script sig, see BIP141 - CSVScriptSignature(EmptyScriptSignature) case _: LockTimeScriptPubKey | _: P2PKWithTimeoutScriptPubKey => throw new IllegalArgumentException( "Cannot have a nested locktimeScriptPubKey inside a lockTimeScriptPubKey") - case x @ (_: NonStandardScriptPubKey | _: P2SHScriptPubKey | - _: WitnessCommitment) => + case x @ (_: NonStandardScriptPubKey | _: WitnessCommitment) => throw new IllegalArgumentException( "A NonStandardScriptPubKey/P2SHScriptPubKey/WitnessCommitment cannot be" + "the underlying scriptSig in a CSVScriptSignature. Got: " + x)