Factoring out transaction components into their own scala files

This commit is contained in:
Chris Stewart 2015-12-26 21:03:43 -06:00
parent cd72cf8b60
commit 0c9d09b855
4 changed files with 42 additions and 11 deletions

View file

@ -12,7 +12,7 @@ trait Transaction {
def txInCount : VarInt
def txIn : Seq[TxIn]
def txOutCount : VarInt
def txOut : TxOut
def txOut : Seq[TxOut]
def lockTime : Long
}
@ -22,22 +22,16 @@ case class NetworkTx(serialization : String ) extends Transaction {
override def txInCount : VarInt = NetworkVarInt("FF")
override def txIn : Seq[TxIn] = Seq()
override def txOutCount : VarInt = NetworkVarInt("FF")
override def txOut : TxOut = TxOut(1,NetworkVarInt("FF"), Seq())
override def txOut : TxOut = (1,NetworkVarInt("FF"), Seq())
override def lockTime : Long = 0
}
trait TxIn {
def prevousOutput : OutPoint
def scriptLength : VarInt
def scriptSignature : Seq[Char]
def sequence : Long
}
case class OutPoint(hash : Seq[Char], index : Long)
case class TxOut(value : Long, pkScriptLength : VarInt, pkScript : Seq[Char])

View file

@ -0,0 +1,13 @@
package org.scalacoin.protocol.transaction
import org.scalacoin.protocol.VarInt
/**
* Created by chris on 12/26/15.
*/
trait TransactionInput {
def previousOutput : OutPoint
def scriptLength : VarInt
def scriptSignature : Seq[Char]
def sequence : Long
}

View file

@ -0,0 +1,9 @@
package org.scalacoin.protocol.transaction
/**
* Created by chris on 12/26/15.
*/
trait TransactionOutPoint {
def hash : Seq[Char]
def index : Long
}

View file

@ -0,0 +1,15 @@
package org.scalacoin.protocol.transaction
import org.scalacoin.currency.Satoshis
import org.scalacoin.protocol.VarInt
/**
* Created by chris on 12/26/15.
*/
trait TransactionOutput {
def value : Satoshis
def pkScriptLength : VarInt
def pkScript : Seq[Char]
}