mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2024-11-20 10:13:26 +01:00
Adding locktime operations
This commit is contained in:
parent
349ac1b1aa
commit
190992ee3b
@ -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
|
||||
}
|
@ -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)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user