mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2024-11-19 09:52:09 +01:00
Upgrade to scala 2.13.13, fix compiler errors (#5428)
This commit is contained in:
parent
8a0c00637c
commit
3ed78b5270
@ -3,7 +3,6 @@ package org.bitcoins.core.util
|
|||||||
import org.bitcoins.core.script.{
|
import org.bitcoins.core.script.{
|
||||||
ExecutedScriptProgram,
|
ExecutedScriptProgram,
|
||||||
ExecutionInProgressScriptProgram,
|
ExecutionInProgressScriptProgram,
|
||||||
PreExecutionScriptProgram,
|
|
||||||
StartedScriptProgram
|
StartedScriptProgram
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -17,7 +16,7 @@ trait ScriptProgramTestUtil {
|
|||||||
def toExecutedScriptProgram(p: StartedScriptProgram): ExecutedScriptProgram =
|
def toExecutedScriptProgram(p: StartedScriptProgram): ExecutedScriptProgram =
|
||||||
p match {
|
p match {
|
||||||
case e: ExecutedScriptProgram => e
|
case e: ExecutedScriptProgram => e
|
||||||
case _: PreExecutionScriptProgram | _: ExecutionInProgressScriptProgram =>
|
case _: ExecutionInProgressScriptProgram =>
|
||||||
throw new RuntimeException("Should be an executed script program")
|
throw new RuntimeException("Should be an executed script program")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -26,7 +25,7 @@ trait ScriptProgramTestUtil {
|
|||||||
p: StartedScriptProgram): ExecutionInProgressScriptProgram =
|
p: StartedScriptProgram): ExecutionInProgressScriptProgram =
|
||||||
p match {
|
p match {
|
||||||
case e: ExecutionInProgressScriptProgram => e
|
case e: ExecutionInProgressScriptProgram => e
|
||||||
case _: PreExecutionScriptProgram | _: ExecutedScriptProgram =>
|
case _: ExecutedScriptProgram =>
|
||||||
throw new RuntimeException(
|
throw new RuntimeException(
|
||||||
"Must be an execution in progress script program")
|
"Must be an execution in progress script program")
|
||||||
}
|
}
|
||||||
|
@ -1248,8 +1248,7 @@ sealed abstract class ScriptInterpreter {
|
|||||||
case newProgram: ExecutedScriptProgram =>
|
case newProgram: ExecutedScriptProgram =>
|
||||||
//script was marked invalid for other reasons, don't need to update the opcount
|
//script was marked invalid for other reasons, don't need to update the opcount
|
||||||
(newProgram, opCount)
|
(newProgram, opCount)
|
||||||
case newProgram @ (_: ExecutionInProgressScriptProgram |
|
case newProgram: ExecutionInProgressScriptProgram =>
|
||||||
_: PreExecutionScriptProgram) =>
|
|
||||||
val programOrError = newProgram
|
val programOrError = newProgram
|
||||||
val newOpCount =
|
val newOpCount =
|
||||||
calcOpCount(opCount, OP_CHECKMULTISIG) + BitcoinScriptUtil
|
calcOpCount(opCount, OP_CHECKMULTISIG) + BitcoinScriptUtil
|
||||||
@ -1263,8 +1262,7 @@ sealed abstract class ScriptInterpreter {
|
|||||||
case newProgram: ExecutedScriptProgram =>
|
case newProgram: ExecutedScriptProgram =>
|
||||||
//script was marked invalid for other reasons, don't need to update the opcount
|
//script was marked invalid for other reasons, don't need to update the opcount
|
||||||
(newProgram, opCount)
|
(newProgram, opCount)
|
||||||
case newProgram @ (_: ExecutionInProgressScriptProgram |
|
case newProgram: ExecutionInProgressScriptProgram =>
|
||||||
_: PreExecutionScriptProgram) =>
|
|
||||||
val programOrError = newProgram
|
val programOrError = newProgram
|
||||||
val newOpCount =
|
val newOpCount =
|
||||||
calcOpCount(opCount, OP_CHECKMULTISIGVERIFY) + BitcoinScriptUtil
|
calcOpCount(opCount, OP_CHECKMULTISIGVERIFY) + BitcoinScriptUtil
|
||||||
|
@ -2,7 +2,7 @@ import sbt.Keys.excludeLintKeys
|
|||||||
|
|
||||||
import scala.util.Properties
|
import scala.util.Properties
|
||||||
|
|
||||||
val scala2_13 = "2.13.12"
|
val scala2_13 = "2.13.13"
|
||||||
|
|
||||||
ThisBuild / scalafmtOnCompile := !Properties.envOrNone("CI").contains("true")
|
ThisBuild / scalafmtOnCompile := !Properties.envOrNone("CI").contains("true")
|
||||||
|
|
||||||
|
@ -857,12 +857,9 @@ sealed abstract class ScriptGenerators {
|
|||||||
Some(0),
|
Some(0),
|
||||||
hashType)
|
hashType)
|
||||||
(cltvScriptSig.asInstanceOf[CLTVScriptSignature], cltv, privKeys)
|
(cltvScriptSig.asInstanceOf[CLTVScriptSignature], cltv, privKeys)
|
||||||
case _: UnassignedWitnessScriptPubKey | _: WitnessScriptPubKeyV0 =>
|
case _: CLTVScriptPubKey | _: P2PKWithTimeoutScriptPubKey |
|
||||||
throw new IllegalArgumentException(
|
_: CSVScriptPubKey | _: NonStandardScriptPubKey |
|
||||||
"Cannot created a witness scriptPubKey for a CSVScriptSig since we do not have a witness")
|
_: WitnessCommitment =>
|
||||||
case _: P2SHScriptPubKey | _: CLTVScriptPubKey |
|
|
||||||
_: P2PKWithTimeoutScriptPubKey | _: CSVScriptPubKey |
|
|
||||||
_: NonStandardScriptPubKey | _: WitnessCommitment =>
|
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"We only " +
|
"We only " +
|
||||||
"want to generate P2PK, P2PKH, and MultiSig ScriptSignatures when creating a CSVScriptSignature")
|
"want to generate P2PK, P2PKH, and MultiSig ScriptSignatures when creating a CSVScriptSignature")
|
||||||
@ -910,12 +907,9 @@ sealed abstract class ScriptGenerators {
|
|||||||
val csvScriptSig =
|
val csvScriptSig =
|
||||||
lockTimeHelper(None, sequence, csv, privKeys, Some(0), hashType)
|
lockTimeHelper(None, sequence, csv, privKeys, Some(0), hashType)
|
||||||
(csvScriptSig.asInstanceOf[CSVScriptSignature], csv, privKeys)
|
(csvScriptSig.asInstanceOf[CSVScriptSignature], csv, privKeys)
|
||||||
case _: UnassignedWitnessScriptPubKey | _: WitnessScriptPubKeyV0 =>
|
case _: CLTVScriptPubKey | _: P2PKWithTimeoutScriptPubKey |
|
||||||
throw new IllegalArgumentException(
|
_: CSVScriptPubKey | _: NonStandardScriptPubKey |
|
||||||
"Cannot created a witness scriptPubKey for a CSVScriptSig since we do not have a witness")
|
_: WitnessCommitment =>
|
||||||
case _: P2SHScriptPubKey | _: CLTVScriptPubKey |
|
|
||||||
_: P2PKWithTimeoutScriptPubKey | _: CSVScriptPubKey |
|
|
||||||
_: NonStandardScriptPubKey | _: WitnessCommitment =>
|
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"We only " +
|
"We only " +
|
||||||
"want to generate P2PK, P2PKH, and MultiSig ScriptSignatures when creating a CLTVScriptSignature.")
|
"want to generate P2PK, P2PKH, and MultiSig ScriptSignatures when creating a CLTVScriptSignature.")
|
||||||
@ -1108,14 +1102,10 @@ sealed abstract class ScriptGenerators {
|
|||||||
ConditionalScriptSignature(scriptSig, true)
|
ConditionalScriptSignature(scriptSig, true)
|
||||||
case EmptyScriptPubKey =>
|
case EmptyScriptPubKey =>
|
||||||
CSVScriptSignature(TrivialTrueScriptSignature)
|
CSVScriptSignature(TrivialTrueScriptSignature)
|
||||||
case _: WitnessScriptPubKeyV0 | _: UnassignedWitnessScriptPubKey =>
|
|
||||||
//bare segwit always has an empty script sig, see BIP141
|
|
||||||
CSVScriptSignature(EmptyScriptSignature)
|
|
||||||
case _: LockTimeScriptPubKey | _: P2PKWithTimeoutScriptPubKey =>
|
case _: LockTimeScriptPubKey | _: P2PKWithTimeoutScriptPubKey =>
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"Cannot have a nested locktimeScriptPubKey inside a lockTimeScriptPubKey")
|
"Cannot have a nested locktimeScriptPubKey inside a lockTimeScriptPubKey")
|
||||||
case x @ (_: NonStandardScriptPubKey | _: P2SHScriptPubKey |
|
case x @ (_: NonStandardScriptPubKey | _: WitnessCommitment) =>
|
||||||
_: WitnessCommitment) =>
|
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"A NonStandardScriptPubKey/P2SHScriptPubKey/WitnessCommitment cannot be" +
|
"A NonStandardScriptPubKey/P2SHScriptPubKey/WitnessCommitment cannot be" +
|
||||||
"the underlying scriptSig in a CSVScriptSignature. Got: " + x)
|
"the underlying scriptSig in a CSVScriptSignature. Got: " + x)
|
||||||
|
Loading…
Reference in New Issue
Block a user