Adding locktime operations

This commit is contained in:
Chris Stewart 2016-01-06 13:19:44 -06:00
parent 349ac1b1aa
commit 190992ee3b
2 changed files with 34 additions and 0 deletions

View File

@ -0,0 +1,21 @@
package org.scalacoin.script.locktime
import org.scalacoin.script.ScriptOperation
/**
* Created by chris on 1/6/16.
*/
sealed trait LocktimeOperation extends ScriptOperation
/**
* Marks transaction as invalid if the top stack item is greater than the transaction's nLockTime field,
* otherwise script evaluation continues as though an OP_NOP was executed. Transaction is also invalid if
* 1. the stack is empty; or
* 2. the top stack item is negative; or
* 3. the top stack item is greater than or equal to 500000000 while the transaction's nLockTime field is less than 500000000,
* or vice versa; or 4. the input's nSequence field is equal to 0xffffffff.
* The precise semantics are described in BIP 0065
*/
case object OP_CHECKLOCKTIMEVERIFY extends ScriptOperation {
override def opCode = 177
}

View File

@ -0,0 +1,13 @@
package org.scalacoin.script.locktime
import org.scalatest.{FlatSpec, MustMatchers}
/**
* Created by chris on 1/6/16.
*/
class LocktimeOperationTest extends FlatSpec with MustMatchers {
"LocktimeOperations" must "define OP_CHECKLOCKTIMEVERIFY" in {
OP_CHECKLOCKTIMEVERIFY.opCode must be (177)
}
}