LoadOrGenFilePV loads a FilePV from the given filePaths or else generates a new one and saves it to the filePaths.
(keyFilePath, stateFilePath string)
| 226 | // LoadOrGenFilePV loads a FilePV from the given filePaths |
| 227 | // or else generates a new one and saves it to the filePaths. |
| 228 | func LoadOrGenFilePV(keyFilePath, stateFilePath string) *FilePV { |
| 229 | var pv *FilePV |
| 230 | if tmos.FileExists(keyFilePath) { |
| 231 | pv = LoadFilePV(keyFilePath, stateFilePath) |
| 232 | } else { |
| 233 | pv = GenFilePV(keyFilePath, stateFilePath) |
| 234 | pv.Save() |
| 235 | } |
| 236 | return pv |
| 237 | } |
| 238 | |
| 239 | // GetAddress returns the address of the validator. |
| 240 | // Implements PrivValidator. |