diff --git a/src/main/scala/org/scalacoin/protocol/transaction/Transaction.scala b/src/main/scala/org/scalacoin/protocol/transaction/Transaction.scala index 73367f8841..9a5f6a1a56 100644 --- a/src/main/scala/org/scalacoin/protocol/transaction/Transaction.scala +++ b/src/main/scala/org/scalacoin/protocol/transaction/Transaction.scala @@ -9,24 +9,16 @@ import org.scalacoin.protocol.{NetworkVarInt, VarInt} trait Transaction { + def txId : String def version : Long - def txInCount : VarInt - def txIn : Seq[TransactionInput] - def txOutCount : VarInt - def txOut : Seq[TransactionOutput] + def inputs : Seq[TransactionInput] + def outputs : Seq[TransactionOutput] def lockTime : Long } -case class NetworkTx(serialization : String ) extends Transaction { - require(!serialization.contains(" "), "Your network transaction contains whitespace") - override def version = java.lang.Long.parseLong(serialization.slice(0,8),16) - override def txInCount : VarInt = NetworkVarInt("FF") - override def txIn : Seq[TransactionInput] = Seq() - override def txOutCount : VarInt = NetworkVarInt("FF") - override def txOut : Seq[TransactionOutput] = Seq(TransactionOutputImpl(Satoshis(1),NetworkVarInt("FF"), Seq())) - override def lockTime : Long = 0 - -} +case class TransactionImpl(txId : String, version : Long, inputs : Seq[TransactionInput], + outputs : Seq[TransactionOutput], lockTime : Long) extends Transaction + diff --git a/src/test/scala/org/scalacoin/protocol/transaction/TransactionTest.scala b/src/test/scala/org/scalacoin/protocol/transaction/TransactionTest.scala index b10436c11c..f42b2d8e6e 100644 --- a/src/test/scala/org/scalacoin/protocol/transaction/TransactionTest.scala +++ b/src/test/scala/org/scalacoin/protocol/transaction/TransactionTest.scala @@ -7,11 +7,4 @@ import org.scalatest.{FlatSpec, MustMatchers} */ class TransactionTest extends FlatSpec with MustMatchers { - "Tx" must "be instanstiated from a serialized tx on the network" in { - val tx = NetworkTx("01000000") - //00000001000000000000000000000000 - tx.version must be (16777216) - - } - }