mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-02-19 15:23:35 +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"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"sort"
|
"sort"
|
||||||
|
"slices"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/nspcc-dev/neo-go/pkg/config"
|
"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)
|
return len(md.Parameters) > len(desc.Parameters)
|
||||||
})
|
})
|
||||||
c.methods = append(c.methods, MethodAndPrice{})
|
c.methods = slices.Insert(c.methods, index, *md)
|
||||||
copy(c.methods[index+1:], c.methods[index:])
|
|
||||||
c.methods[index] = *md
|
|
||||||
|
|
||||||
if md.ActiveFrom != nil {
|
if md.ActiveFrom != nil {
|
||||||
c.ActiveHFs[*md.ActiveFrom] = struct{}{}
|
c.ActiveHFs[*md.ActiveFrom] = struct{}{}
|
||||||
|
|
Loading…
Add table
Reference in a new issue