Allow creating input info of simple OP_TRUE script pub key (#4450)

This commit is contained in:
benthecarman 2022-07-06 10:52:06 -05:00 committed by GitHub
parent 11f6c8f024
commit eae16a52f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,7 +5,7 @@ import org.bitcoins.core.number.UInt64
import org.bitcoins.core.protocol.CompactSizeUInt
import org.bitcoins.core.protocol.script._
import org.bitcoins.core.protocol.transaction._
import org.bitcoins.core.script.constant.ScriptConstant
import org.bitcoins.core.script.constant.{OP_TRUE, ScriptConstant}
import org.bitcoins.core.util.{BitcoinScriptUtil, BytesUtil}
import org.bitcoins.crypto.{
ECPublicKey,
@ -401,12 +401,16 @@ object RawInputInfo {
hashPreImages)
case EmptyScriptPubKey =>
EmptyInputInfo(outPoint, amount)
case _: NonStandardScriptPubKey | _: WitnessCommitment =>
case spk @ (_: NonStandardScriptPubKey | _: WitnessCommitment) =>
if (spk == ScriptPubKey.fromAsm(Vector(OP_TRUE))) {
EmptyInputInfo(outPoint, amount)
} else {
throw new UnsupportedOperationException(
s"Currently unsupported ScriptPubKey $scriptPubKey")
}
}
}
}
case class EmptyInputInfo(outPoint: TransactionOutPoint, amount: CurrencyUnit)
extends RawInputInfo {