AppendTags a function of Tags

This commit is contained in:
Christopher Goes 2018-05-10 17:14:46 +02:00
parent c0eb66b133
commit 2b707f6b0a
No known key found for this signature in database
GPG Key ID: E828D98232D328D3
3 changed files with 6 additions and 6 deletions

View File

@ -21,8 +21,8 @@ func (t Tags) AppendTag(k string, v []byte) Tags {
}
// Append two lists of tags
func AppendTags(a, b Tags) Tags {
return append(a, b...)
func (t Tags) AppendTags(a Tags) Tags {
return append(t, a...)
}
// New variadic tags, must be k string, v []byte repeating

View File

@ -9,7 +9,7 @@ import (
func TestAppendTags(t *testing.T) {
a := NewTags("a", []byte("1"))
b := NewTags("b", []byte("2"))
c := AppendTags(a, b)
c := a.AppendTags(b)
require.Equal(t, c, Tags{MakeTag("a", []byte("1")), MakeTag("b", []byte("2"))})
}

View File

@ -167,7 +167,7 @@ func sendCoins(ctx sdk.Context, am sdk.AccountMapper, fromAddr sdk.Address, toAd
return nil, err
}
return sdk.AppendTags(subTags, addTags), nil
return subTags.AppendTags(addTags), nil
}
// InputOutputCoins handles a list of inputs and outputs
@ -180,7 +180,7 @@ func inputOutputCoins(ctx sdk.Context, am sdk.AccountMapper, inputs []Input, out
if err != nil {
return nil, err
}
allTags = sdk.AppendTags(allTags, tags)
allTags = allTags.AppendTags(tags)
}
for _, out := range outputs {
@ -188,7 +188,7 @@ func inputOutputCoins(ctx sdk.Context, am sdk.AccountMapper, inputs []Input, out
if err != nil {
return nil, err
}
allTags = sdk.AppendTags(allTags, tags)
allTags = allTags.AppendTags(tags)
}
return allTags, nil