diff --git a/txchange.go b/txchange.go index 2051b39e..5204554b 100644 --- a/txchange.go +++ b/txchange.go @@ -31,9 +31,9 @@ func (tx *Tx) Change(s *bscript.Script, f []*Fee) error { return nil } -// ChangeToOutput will calculate fees and add them to an output at the index specified (0 based). +// ChangeToExistingOutput will calculate fees and add them to an output at the index specified (0 based). // If an invalid index is supplied and error is returned. -func (tx *Tx) ChangeToOutput(index uint, f []*Fee) error { +func (tx *Tx) ChangeToExistingOutput(index uint, f []*Fee) error { if int(index) > len(tx.Outputs)-1 { return errors.New("index is greater than number of inputs in transaction") } diff --git a/txchange_test.go b/txchange_test.go index 285dbdb5..79c4eb6b 100644 --- a/txchange_test.go +++ b/txchange_test.go @@ -380,7 +380,7 @@ func TestTx_ChangeToOutput(t *testing.T) { } for name, test := range tests { t.Run(name, func(t *testing.T) { - err := test.tx.ChangeToOutput(test.index, test.fees) + err := test.tx.ChangeToExistingOutput(test.index, test.fees) if test.err != nil { assert.Error(t, err) assert.Equal(t, test.err, err)