[#607] *: Use keys.PublicKeys.Copy() where possible
Some checks failed
Build / Build Components (1.21) (pull_request) Successful in 8m20s
DCO action / DCO (pull_request) Successful in 8m51s
Vulncheck / Vulncheck (pull_request) Successful in 10m9s
Build / Build Components (1.20) (pull_request) Successful in 11m29s
Tests and linters / Staticcheck (pull_request) Successful in 16m5s
Tests and linters / Tests (1.21) (pull_request) Failing after 16m26s
Tests and linters / Tests (1.20) (pull_request) Failing after 16m34s
Tests and linters / Lint (pull_request) Successful in 19m40s
Tests and linters / Tests with -race (pull_request) Failing after 19m40s

Semantic patch:
```
@@
var dst identifier
var src identifier
var keys identifier
@@
 import keys "github.com/nspcc-dev/neo-go/pkg/crypto/keys"

-dst := make(keys.PublicKeys, len(src))
-copy(dst, src)
+dst := src.Copy()
```

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
Evgenii Stratonikov 2023-08-14 14:17:45 +03:00
parent 6669494af4
commit 6d10e07565
2 changed files with 2 additions and 4 deletions

View file

@ -104,8 +104,7 @@ func initializeWallets(v *viper.Viper, walletDir string, size int) ([]string, er
bftCount := smartcontract.GetDefaultHonestNodeCount(size)
for i := range wallets {
i := i
ps := make(keys.PublicKeys, len(pubs))
copy(ps, pubs)
ps := pubs.Copy()
errG.Go(func() error {
if err := addMultisigAccount(wallets[i], majCount, committeeAccountName, passwords[i], ps); err != nil {
return fmt.Errorf("can't create committee account: %w", err)

View file

@ -60,8 +60,7 @@ func TestNewAlphabetList(t *testing.T) {
orig := keys.PublicKeys{k[1], k[2], k[3], k[4]}
main := keys.PublicKeys{k[1], k[2], k[5], k[4]}
exp := make(keys.PublicKeys, len(main))
copy(exp, main)
exp := main.Copy()
sort.Sort(exp)
got, err := newAlphabetList(orig, main)