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,
TxIn: []*btcwire.TxIn{
{
PreviousOutpoint: btcwire.OutPoint{
PreviousOutPoint: btcwire.OutPoint{
Hash: btcwire.ShaHash{},
Index: 0xffffffff,
},

View file

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

View file

@ -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
}

View file

@ -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,
},