[#607] *: Use keys.PublicKeys.Copy() where possible
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:
parent
e604a3d749
commit
127c676786
2 changed files with 2 additions and 4 deletions
|
@ -104,8 +104,7 @@ func initializeWallets(v *viper.Viper, walletDir string, size int) ([]string, er
|
||||||
bftCount := smartcontract.GetDefaultHonestNodeCount(size)
|
bftCount := smartcontract.GetDefaultHonestNodeCount(size)
|
||||||
for i := range wallets {
|
for i := range wallets {
|
||||||
i := i
|
i := i
|
||||||
ps := make(keys.PublicKeys, len(pubs))
|
ps := pubs.Copy()
|
||||||
copy(ps, pubs)
|
|
||||||
errG.Go(func() error {
|
errG.Go(func() error {
|
||||||
if err := addMultisigAccount(wallets[i], majCount, committeeAccountName, passwords[i], ps); err != nil {
|
if err := addMultisigAccount(wallets[i], majCount, committeeAccountName, passwords[i], ps); err != nil {
|
||||||
return fmt.Errorf("can't create committee account: %w", err)
|
return fmt.Errorf("can't create committee account: %w", err)
|
||||||
|
|
|
@ -60,8 +60,7 @@ func TestNewAlphabetList(t *testing.T) {
|
||||||
orig := keys.PublicKeys{k[1], k[2], k[3], k[4]}
|
orig := keys.PublicKeys{k[1], k[2], k[3], k[4]}
|
||||||
main := keys.PublicKeys{k[1], k[2], k[5], k[4]}
|
main := keys.PublicKeys{k[1], k[2], k[5], k[4]}
|
||||||
|
|
||||||
exp := make(keys.PublicKeys, len(main))
|
exp := main.Copy()
|
||||||
copy(exp, main)
|
|
||||||
sort.Sort(exp)
|
sort.Sort(exp)
|
||||||
|
|
||||||
got, err := newAlphabetList(orig, main)
|
got, err := newAlphabetList(orig, main)
|
||||||
|
|
Loading…
Reference in a new issue