Adding TransactionFactory

This commit is contained in:
Chris Stewart 2016-02-21 16:24:09 -06:00
parent 0f9a87f971
commit 4702de636f
3 changed files with 21 additions and 2 deletions

View file

@ -80,7 +80,14 @@ trait TransactionSignatureSerializer extends RawBitcoinSerializerHelper {
// already. Perhaps it felt safer to him in some way, or is another leftover from how the code was written. // already. Perhaps it felt safer to him in some way, or is another leftover from how the code was written.
val inputWithConnectedScript = inputToSign.factory(script) val inputWithConnectedScript = inputToSign.factory(script)
//check the hash type of //check the hash type
hashType match {
case SIGHASH_NONE =>
//means that no outputs are signed at all
val txWithNoOutputs = ???
}
???
} }

View file

@ -8,7 +8,7 @@ import org.scalacoin.util.{ScalacoinUtil, CryptoUtil}
*/ */
trait Transaction extends TransactionElement { trait Transaction extends TransactionElement with TransactionFactory {
def txId : String = ScalacoinUtil.encodeHex(CryptoUtil.doubleSHA256(hex).reverse) def txId : String = ScalacoinUtil.encodeHex(CryptoUtil.doubleSHA256(hex).reverse)
def version : Long def version : Long
def inputs : Seq[TransactionInput] def inputs : Seq[TransactionInput]

View file

@ -0,0 +1,12 @@
package org.scalacoin.protocol.transaction
/**
* Created by chris on 2/21/16.
*/
trait TransactionFactory { this : Transaction =>
def factory(outputs : Seq[TransactionOutput]) = {
TransactionImpl(version,inputs,outputs,lockTime)
}
}