Changed TxIn.PreviousOutpoint to TxIn.PreviousOutPoint for consistency.

This commit is contained in:
Jonathan Gillham 2014-10-01 13:43:37 +01:00
parent 8733b9c8df
commit ccee51a0be
4 changed files with 12 additions and 12 deletions

View file

@ -18,7 +18,7 @@ var genesisCoinbaseTx = btcwire.MsgTx{
Version: 1, Version: 1,
TxIn: []*btcwire.TxIn{ TxIn: []*btcwire.TxIn{
{ {
PreviousOutpoint: btcwire.OutPoint{ PreviousOutPoint: btcwire.OutPoint{
Hash: btcwire.ShaHash{}, Hash: btcwire.ShaHash{},
Index: 0xffffffff, Index: 0xffffffff,
}, },

View file

@ -503,7 +503,7 @@ var blockOne = btcwire.MsgBlock{
Version: 1, Version: 1,
TxIn: []*btcwire.TxIn{ TxIn: []*btcwire.TxIn{
{ {
PreviousOutpoint: btcwire.OutPoint{ PreviousOutPoint: btcwire.OutPoint{
Hash: btcwire.ShaHash{}, Hash: btcwire.ShaHash{},
Index: 0xffffffff, Index: 0xffffffff,
}, },

View file

@ -77,7 +77,7 @@ func NewOutPoint(hash *ShaHash, index uint32) *OutPoint {
// TxIn defines a bitcoin transaction input. // TxIn defines a bitcoin transaction input.
type TxIn struct { type TxIn struct {
PreviousOutpoint OutPoint PreviousOutPoint OutPoint
SignatureScript []byte SignatureScript []byte
Sequence uint32 Sequence uint32
} }
@ -97,7 +97,7 @@ func (t *TxIn) SerializeSize() int {
// MaxTxInSequenceNum. // MaxTxInSequenceNum.
func NewTxIn(prevOut *OutPoint, signatureScript []byte) *TxIn { func NewTxIn(prevOut *OutPoint, signatureScript []byte) *TxIn {
return &TxIn{ return &TxIn{
PreviousOutpoint: *prevOut, PreviousOutPoint: *prevOut,
SignatureScript: signatureScript, SignatureScript: signatureScript,
Sequence: MaxTxInSequenceNum, Sequence: MaxTxInSequenceNum,
} }
@ -183,7 +183,7 @@ func (msg *MsgTx) Copy() *MsgTx {
// Deep copy the old TxIn data. // Deep copy the old TxIn data.
for _, oldTxIn := range msg.TxIn { for _, oldTxIn := range msg.TxIn {
// Deep copy the old previous outpoint. // Deep copy the old previous outpoint.
oldOutPoint := oldTxIn.PreviousOutpoint oldOutPoint := oldTxIn.PreviousOutPoint
newOutPoint := OutPoint{} newOutPoint := OutPoint{}
newOutPoint.Hash.SetBytes(oldOutPoint.Hash[:]) newOutPoint.Hash.SetBytes(oldOutPoint.Hash[:])
newOutPoint.Index = oldOutPoint.Index 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 // Create new txIn with the deep copied data and append it to
// new Tx. // new Tx.
newTxIn := TxIn{ newTxIn := TxIn{
PreviousOutpoint: newOutPoint, PreviousOutPoint: newOutPoint,
SignatureScript: newScript, SignatureScript: newScript,
Sequence: oldTxIn.Sequence, Sequence: oldTxIn.Sequence,
} }
@ -468,7 +468,7 @@ func readTxIn(r io.Reader, pver uint32, version int32, ti *TxIn) error {
if err != nil { if err != nil {
return err return err
} }
ti.PreviousOutpoint = op ti.PreviousOutPoint = op
ti.SignatureScript, err = readVarBytes(r, pver, MaxMessagePayload, ti.SignatureScript, err = readVarBytes(r, pver, MaxMessagePayload,
"transaction input signature script") "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 // writeTxIn encodes ti to the bitcoin protocol encoding for a transaction
// input (TxIn) to w. // input (TxIn) to w.
func writeTxIn(w io.Writer, pver uint32, version int32, ti *TxIn) error { 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 { if err != nil {
return err return err
} }

View file

@ -58,9 +58,9 @@ func TestTx(t *testing.T) {
// Ensure we get the same transaction input back out. // Ensure we get the same transaction input back out.
sigScript := []byte{0x04, 0x31, 0xdc, 0x00, 0x1b, 0x01, 0x62} sigScript := []byte{0x04, 0x31, 0xdc, 0x00, 0x1b, 0x01, 0x62}
txIn := btcwire.NewTxIn(prevOut, sigScript) 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", t.Errorf("NewTxIn: wrong prev outpoint - got %v, want %v",
spew.Sprint(&txIn.PreviousOutpoint), spew.Sprint(&txIn.PreviousOutPoint),
spew.Sprint(prevOut)) spew.Sprint(prevOut))
} }
if !bytes.Equal(txIn.SignatureScript, sigScript) { if !bytes.Equal(txIn.SignatureScript, sigScript) {
@ -133,7 +133,7 @@ func TestTxSha(t *testing.T) {
// First transaction from block 113875. // First transaction from block 113875.
msgTx := btcwire.NewMsgTx() msgTx := btcwire.NewMsgTx()
txIn := btcwire.TxIn{ txIn := btcwire.TxIn{
PreviousOutpoint: btcwire.OutPoint{ PreviousOutPoint: btcwire.OutPoint{
Hash: btcwire.ShaHash{}, Hash: btcwire.ShaHash{},
Index: 0xffffffff, Index: 0xffffffff,
}, },
@ -622,7 +622,7 @@ var multiTx = &btcwire.MsgTx{
Version: 1, Version: 1,
TxIn: []*btcwire.TxIn{ TxIn: []*btcwire.TxIn{
{ {
PreviousOutpoint: btcwire.OutPoint{ PreviousOutPoint: btcwire.OutPoint{
Hash: btcwire.ShaHash{}, Hash: btcwire.ShaHash{},
Index: 0xffffffff, Index: 0xffffffff,
}, },