Skip to content

Commit

Permalink
Rename ChangeToOutput -> ChangeToExistingOutput
Browse files Browse the repository at this point in the history
avoid confusing with ChangeToAddress
  • Loading branch information
jadwahab committed May 14, 2021
1 parent 248cff4 commit f0de9a9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions txchange.go
Original file line number Diff line number Diff line change
Expand Up @@ -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).
// ChangeToSpecificOutput 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) ChangeToSpecificOutput(index uint, f []*Fee) error {
if int(index) > len(tx.Outputs)-1 {
return errors.New("index is greater than number of inputs in transaction")
}
Expand Down
2 changes: 1 addition & 1 deletion txchange_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.ChangeToSpecificOutput(test.index, test.fees)
if test.err != nil {
assert.Error(t, err)
assert.Equal(t, test.err, err)
Expand Down

0 comments on commit f0de9a9

Please sign in to comment.