Applying stash

This commit is contained in:
Chris Stewart 2016-02-19 12:21:56 -06:00
parent 578e18f53d
commit 9fe50e670d

View File

@ -1,6 +1,7 @@
package org.scalacoin.crypto package org.scalacoin.crypto
import org.scalacoin.marshallers.RawBitcoinSerializerHelper import org.scalacoin.marshallers.RawBitcoinSerializerHelper
import org.scalacoin.marshallers.transaction.RawTransactionOutputParser
import org.scalacoin.protocol.script.{ScriptPubKeyFactory, ScriptPubKey} import org.scalacoin.protocol.script.{ScriptPubKeyFactory, ScriptPubKey}
import org.scalacoin.protocol.transaction.{Transaction, TransactionOutput, TransactionInput} import org.scalacoin.protocol.transaction.{Transaction, TransactionOutput, TransactionInput}
import org.scalacoin.script.constant.ScriptToken import org.scalacoin.script.constant.ScriptToken
@ -20,10 +21,8 @@ trait TransactionSignatureSerializer extends RawBitcoinSerializerHelper {
* @param script * @param script
* @return * @return
*/ */
def serializeScriptCode(script : Seq[ScriptToken]) : String = { def serializeScriptCode(script : Seq[ScriptToken]) : String = removeOpCodeSeparators(script)
val serializedScript : String = removeOpCodeSeparators(script)
serializedScript
}
def serializeInput(input : TransactionInput, nType : Int, nVersion : Int) : String = ??? def serializeInput(input : TransactionInput, nType : Int, nVersion : Int) : String = ???
@ -35,7 +34,23 @@ trait TransactionSignatureSerializer extends RawBitcoinSerializerHelper {
* @param nVersion * @param nVersion
* @return * @return
*/ */
def serializeOutput(output : TransactionOutput, nType : Int, nVersion : Int) : String = ??? def serializeOutput(output : TransactionOutput, nType : Int, nVersion : Int,
hashType : HashType, inputIndex : Int, outputIndex : Int ) : String = {
//check if it is a SIGHASH_SINGLE
//check if the output index is not the same as the input index
//
if (hashType == SIGHASH_SINGLE && inputIndex != outputIndex) {
// Do not lock-in the txout payee at other indices as txin
//::Serialize(s, CTxOut(), nType, nVersion)
//need to write an empty output i think
} else {
//::Serialize(s, txTo.vout[nOutput], nType, nVersion);
RawTransactionOutputParser.write(output)
}
}
def serialize(spendingTransaction : Transaction, nIn : Int, nType : Int, nVersion : Int, nHashTypeIn : HashType) : String = { def serialize(spendingTransaction : Transaction, nIn : Int, nType : Int, nVersion : Int, nHashTypeIn : HashType) : String = {
val serializedVersion =spendingTransaction.version.toHexString val serializedVersion =spendingTransaction.version.toHexString