From 7b6d5695d38f9c676378b3c6d0ef7b7c50b2ead4 Mon Sep 17 00:00:00 2001 From: Ivan Kuznetsov Date: Sun, 10 Sep 2017 14:11:21 +0700 Subject: [PATCH] Fix some initializations --- transaction.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/transaction.go b/transaction.go index 4102a22..598c65f 100644 --- a/transaction.go +++ b/transaction.go @@ -70,10 +70,10 @@ func (tx *Transaction) Sign(privKey ecdsa.PrivateKey, prevTXs map[string]Transac for inID, vin := range txCopy.Vin { prevTx := prevTXs[hex.EncodeToString(vin.Txid)] - txCopy.Vin[inID].Signature = []byte{} + txCopy.Vin[inID].Signature = nil txCopy.Vin[inID].PubKey = prevTx.Vout[vin.Vout].PubKeyHash txCopy.ID = txCopy.Hash() - txCopy.Vin[inID].PubKey = []byte{} + txCopy.Vin[inID].PubKey = nil r, s, err := ecdsa.Sign(rand.Reader, &privKey, txCopy.ID) if err != nil { @@ -115,7 +115,7 @@ func (tx *Transaction) TrimmedCopy() Transaction { var outputs []TXOutput for _, vin := range tx.Vin { - inputs = append(inputs, TXInput{vin.Txid, vin.Vout, []byte{}}) + inputs = append(inputs, TXInput{vin.Txid, vin.Vout, nil, nil}) } for _, vout := range tx.Vout { @@ -176,7 +176,7 @@ func NewCoinbaseTX(to, data string) *Transaction { data = fmt.Sprintf("Reward to '%s'", to) } - txin := TXInput{[]byte{}, -1, []byte(data)} + txin := TXInput{[]byte{}, -1, nil, []byte(data)} txout := NewTXOutput(subsidy, to) tx := Transaction{nil, []TXInput{txin}, []TXOutput{*txout}} tx.ID = tx.Hash() @@ -209,7 +209,7 @@ func NewUTXOTransaction(from, to string, amount int, bc *Blockchain) *Transactio } for _, out := range outs { - input := TXInput{txID, out, wallet.PublicKey} + input := TXInput{txID, out, nil, wallet.PublicKey} inputs = append(inputs, input) } }