mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-08 23:18:15 -05:00
Fixes issues when running validator client with the --web flag and non existing validator.db file AND/OR prysm-wallet-v2 directory. (#13460)
* `getLegacyDatabaseLocation`: Add tests. * `getLegacyDatabaseLocation`: Handle `c.wallet == nil`. * `saveAuthToken`: Create parent directory if needed.
This commit is contained in:
@@ -149,7 +149,16 @@ func saveAuthToken(walletDirPath string, jwtKey []byte, token string) error {
|
||||
if _, err := bytesBuf.WriteString("\n"); err != nil {
|
||||
return err
|
||||
}
|
||||
return file.WriteFile(hashFilePath, bytesBuf.Bytes())
|
||||
|
||||
if err := file.MkdirAll(walletDirPath); err != nil {
|
||||
return errors.Wrapf(err, "could not create directory %s", walletDirPath)
|
||||
}
|
||||
|
||||
if err := file.WriteFile(hashFilePath, bytesBuf.Bytes()); err != nil {
|
||||
return errors.Wrapf(err, "could not write to file %s", hashFilePath)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func readAuthTokenFile(r io.Reader) (secret []byte, token string, err error) {
|
||||
|
||||
Reference in New Issue
Block a user