mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-22 09:29:38 +00:00
interop: simplify code with slices.Insert
It's not performance-critical for sure. Signed-off-by: Roman Khimov <roman@nspcc.ru>
This commit is contained in:
parent
a0553f740d
commit
6581bd47fc
1 changed files with 2 additions and 3 deletions
|
@ -6,6 +6,7 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"sort"
|
||||
"slices"
|
||||
"strings"
|
||||
|
||||
"github.com/nspcc-dev/neo-go/pkg/config"
|
||||
|
@ -368,9 +369,7 @@ func (c *ContractMD) AddMethod(md *MethodAndPrice, desc *manifest.Method) {
|
|||
}
|
||||
return len(md.Parameters) > len(desc.Parameters)
|
||||
})
|
||||
c.methods = append(c.methods, MethodAndPrice{})
|
||||
copy(c.methods[index+1:], c.methods[index:])
|
||||
c.methods[index] = *md
|
||||
c.methods = slices.Insert(c.methods, index, *md)
|
||||
|
||||
if md.ActiveFrom != nil {
|
||||
c.ActiveHFs[*md.ActiveFrom] = struct{}{}
|
||||
|
|
Loading…
Reference in a new issue