AppendTags a function of Tags
This commit is contained in:
parent
c0eb66b133
commit
2b707f6b0a
|
@ -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
|
||||
|
|
|
@ -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"))})
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue