Skip to content

Commit

Permalink
[nspcc-dev#749] neofs-adm: make alphabet size check more robust
Browse files Browse the repository at this point in the history
We can now store wallet for signing manifest groups in the same dir.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
  • Loading branch information
fyrchik authored and aprasolova committed Mar 5, 2022
1 parent 7154cb0 commit d1c88ff
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion cmd/neofs-adm/internal/modules/morph/initialize.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"io/ioutil"
"path"
"strings"
"time"

"github.com/nspcc-dev/neo-go/pkg/core/native/nativenames"
Expand Down Expand Up @@ -174,7 +175,17 @@ func openAlphabetWallets(walletDir string) ([]*wallet.Wallet, error) {
return nil, fmt.Errorf("can't read alphabet wallets dir: %w", err)
}

size := len(walletFiles)
var size int
loop:
for i := range walletFiles {
for j := 0; j < len(walletFiles); j++ {
letter := innerring.GlagoliticLetter(j).String()
if strings.HasPrefix(walletFiles[i].Name(), letter) {
size++
continue loop
}
}
}
if size == 0 {
return nil, errors.New("alphabet wallets dir is empty (run `generate-alphabet` command first)")
}
Expand Down

0 comments on commit d1c88ff

Please sign in to comment.