consensus: exit if wrong password is provided in configuration

This commit is contained in:
Evgenii Stratonikov 2020-08-13 12:01:18 +03:00 committed by Roman Khimov
parent 0c264b1486
commit fc77f8b5b2

View file

@ -133,6 +133,19 @@ func NewService(cfg Config) (Service, error) {
return nil, err
}
// Check that wallet password is correct for at least one account.
var ok bool
for _, acc := range srv.wallet.Accounts {
err := acc.Decrypt(srv.Config.Wallet.Password)
if err == nil {
ok = true
break
}
}
if !ok {
return nil, errors.New("no account with provided password was found")
}
defer srv.wallet.Close()
srv.dbft = dbft.New(