From ccee51a0beff285382ea65ee8cddf5eb56c0903b Mon Sep 17 00:00:00 2001 From: Jonathan Gillham Date: Wed, 1 Oct 2014 13:43:37 +0100 Subject: [PATCH] Changed TxIn.PreviousOutpoint to TxIn.PreviousOutPoint for consistency. --- bench_test.go | 2 +- msgblock_test.go | 2 +- msgtx.go | 12 ++++++------ msgtx_test.go | 8 ++++---- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/bench_test.go b/bench_test.go index a1f31f60..69f97548 100644 --- a/bench_test.go +++ b/bench_test.go @@ -18,7 +18,7 @@ var genesisCoinbaseTx = btcwire.MsgTx{ Version: 1, TxIn: []*btcwire.TxIn{ { - PreviousOutpoint: btcwire.OutPoint{ + PreviousOutPoint: btcwire.OutPoint{ Hash: btcwire.ShaHash{}, Index: 0xffffffff, }, diff --git a/msgblock_test.go b/msgblock_test.go index 5965382d..215c3264 100644 --- a/msgblock_test.go +++ b/msgblock_test.go @@ -503,7 +503,7 @@ var blockOne = btcwire.MsgBlock{ Version: 1, TxIn: []*btcwire.TxIn{ { - PreviousOutpoint: btcwire.OutPoint{ + PreviousOutPoint: btcwire.OutPoint{ Hash: btcwire.ShaHash{}, Index: 0xffffffff, }, diff --git a/msgtx.go b/msgtx.go index 273bc8d1..394fc6ba 100644 --- a/msgtx.go +++ b/msgtx.go @@ -77,7 +77,7 @@ func NewOutPoint(hash *ShaHash, index uint32) *OutPoint { // TxIn defines a bitcoin transaction input. type TxIn struct { - PreviousOutpoint OutPoint + PreviousOutPoint OutPoint SignatureScript []byte Sequence uint32 } @@ -97,7 +97,7 @@ func (t *TxIn) SerializeSize() int { // MaxTxInSequenceNum. func NewTxIn(prevOut *OutPoint, signatureScript []byte) *TxIn { return &TxIn{ - PreviousOutpoint: *prevOut, + PreviousOutPoint: *prevOut, SignatureScript: signatureScript, Sequence: MaxTxInSequenceNum, } @@ -183,7 +183,7 @@ func (msg *MsgTx) Copy() *MsgTx { // Deep copy the old TxIn data. for _, oldTxIn := range msg.TxIn { // Deep copy the old previous outpoint. - oldOutPoint := oldTxIn.PreviousOutpoint + oldOutPoint := oldTxIn.PreviousOutPoint newOutPoint := OutPoint{} newOutPoint.Hash.SetBytes(oldOutPoint.Hash[:]) newOutPoint.Index = oldOutPoint.Index @@ -200,7 +200,7 @@ func (msg *MsgTx) Copy() *MsgTx { // Create new txIn with the deep copied data and append it to // new Tx. newTxIn := TxIn{ - PreviousOutpoint: newOutPoint, + PreviousOutPoint: newOutPoint, SignatureScript: newScript, Sequence: oldTxIn.Sequence, } @@ -468,7 +468,7 @@ func readTxIn(r io.Reader, pver uint32, version int32, ti *TxIn) error { if err != nil { return err } - ti.PreviousOutpoint = op + ti.PreviousOutPoint = op ti.SignatureScript, err = readVarBytes(r, pver, MaxMessagePayload, "transaction input signature script") @@ -489,7 +489,7 @@ func readTxIn(r io.Reader, pver uint32, version int32, ti *TxIn) error { // writeTxIn encodes ti to the bitcoin protocol encoding for a transaction // input (TxIn) to w. func writeTxIn(w io.Writer, pver uint32, version int32, ti *TxIn) error { - err := writeOutPoint(w, pver, version, &ti.PreviousOutpoint) + err := writeOutPoint(w, pver, version, &ti.PreviousOutPoint) if err != nil { return err } diff --git a/msgtx_test.go b/msgtx_test.go index bce99f20..bfaf650e 100644 --- a/msgtx_test.go +++ b/msgtx_test.go @@ -58,9 +58,9 @@ func TestTx(t *testing.T) { // Ensure we get the same transaction input back out. sigScript := []byte{0x04, 0x31, 0xdc, 0x00, 0x1b, 0x01, 0x62} txIn := btcwire.NewTxIn(prevOut, sigScript) - if !reflect.DeepEqual(&txIn.PreviousOutpoint, prevOut) { + if !reflect.DeepEqual(&txIn.PreviousOutPoint, prevOut) { t.Errorf("NewTxIn: wrong prev outpoint - got %v, want %v", - spew.Sprint(&txIn.PreviousOutpoint), + spew.Sprint(&txIn.PreviousOutPoint), spew.Sprint(prevOut)) } if !bytes.Equal(txIn.SignatureScript, sigScript) { @@ -133,7 +133,7 @@ func TestTxSha(t *testing.T) { // First transaction from block 113875. msgTx := btcwire.NewMsgTx() txIn := btcwire.TxIn{ - PreviousOutpoint: btcwire.OutPoint{ + PreviousOutPoint: btcwire.OutPoint{ Hash: btcwire.ShaHash{}, Index: 0xffffffff, }, @@ -622,7 +622,7 @@ var multiTx = &btcwire.MsgTx{ Version: 1, TxIn: []*btcwire.TxIn{ { - PreviousOutpoint: btcwire.OutPoint{ + PreviousOutPoint: btcwire.OutPoint{ Hash: btcwire.ShaHash{}, Index: 0xffffffff, },