forked from TrueCloudLab/frostfs-node
[#732] neofs-adm: fetch single accounts during the initialization
Simplify code and perform error checking before the actual work. Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
018256def8
commit
8e71773c4a
6 changed files with 19 additions and 41 deletions
|
@ -26,6 +26,8 @@ type initializeContext struct {
|
|||
// ConsensusAcc is used for retrieving committee address and verification script.
|
||||
ConsensusAcc *wallet.Account
|
||||
Wallets []*wallet.Wallet
|
||||
// Accounts contains simple signature accounts in the same order as in Wallets.
|
||||
Accounts []*wallet.Account
|
||||
Hashes []util.Uint256
|
||||
WaitDuration time.Duration
|
||||
PollInterval time.Duration
|
||||
|
@ -134,11 +136,21 @@ func newInitializeContext(cmd *cobra.Command, v *viper.Viper) (*initializeContex
|
|||
nativeHashes[ns[i].Manifest.Name] = ns[i].Hash
|
||||
}
|
||||
|
||||
accounts := make([]*wallet.Account, len(wallets))
|
||||
for i, w := range wallets {
|
||||
acc, err := getWalletAccount(w, singleAccountName)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("wallet %s is invalid (no single account): %w", w.Path(), err)
|
||||
}
|
||||
accounts[i] = acc
|
||||
}
|
||||
|
||||
initCtx := &initializeContext{
|
||||
Client: c,
|
||||
ConsensusAcc: consensusAcc,
|
||||
CommitteeAcc: committeeAcc,
|
||||
Wallets: wallets,
|
||||
Accounts: accounts,
|
||||
WaitDuration: time.Second * 30,
|
||||
PollInterval: time.Second,
|
||||
Command: cmd,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue