[#749] neofs-adm: make alphabet size check more robust
We can now store wallet for signing manifest groups in the same dir. Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
40b51b3586
commit
ca894fee23
1 changed files with 12 additions and 1 deletions
|
@ -5,6 +5,7 @@ import (
|
|||
"fmt"
|
||||
"io/ioutil"
|
||||
"path"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/native/nativenames"
|
||||
|
@ -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)")
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue