core: Use splitAt() rather than duplicitvely slicing in ScriptParser.sliceConstant() (#5927)

This commit is contained in:
Chris Stewart 2025-02-12 11:01:42 -06:00 committed by GitHub
parent 31fbadaeb3
commit b291e6d31a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -183,9 +183,7 @@ sealed abstract class ScriptParser
private def sliceConstant(
bytesToPushOntoStack: BytesToPushOntoStack,
data: ByteVector): (ByteVector, ByteVector) = {
val finalIndex = bytesToPushOntoStack.opCode
val dataConstant = data.slice(0, finalIndex)
(dataConstant, data.slice(finalIndex, data.size))
data.splitAt(bytesToPushOntoStack.opCode)
}
/** Parses the bytes in string format, an example input would look like this