mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2025-02-22 22:36:34 +01:00
Factoring out transaction components into their own scala files
This commit is contained in:
parent
cd72cf8b60
commit
0c9d09b855
4 changed files with 42 additions and 11 deletions
|
@ -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])
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
|
@ -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
|
||||
}
|
|
@ -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]
|
||||
|
||||
}
|
Loading…
Add table
Reference in a new issue