MCPcopy Create free account
hub / github.com/DeAI-Artist/Linkis / LoadOrGenFilePV

Function LoadOrGenFilePV

privval/file.go:228–237  ·  view source on GitHub ↗

LoadOrGenFilePV loads a FilePV from the given filePaths or else generates a new one and saves it to the filePaths.

(keyFilePath, stateFilePath string)

Source from the content-addressed store, hash-verified

226// LoadOrGenFilePV loads a FilePV from the given filePaths
227// or else generates a new one and saves it to the filePaths.
228func 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.

Callers 9

WALGenerateNBlocksFunction · 0.92
startNodeFunction · 0.92
NewTendermintFunction · 0.92
WALGenerateNBlocksFunction · 0.92
loadPrivValidatorFunction · 0.92
DefaultNewNodeFunction · 0.92
TestLoadOrGenValidatorFunction · 0.70

Calls 3

SaveMethod · 0.95
LoadFilePVFunction · 0.70
GenFilePVFunction · 0.70

Tested by 4

loadPrivValidatorFunction · 0.74
TestLoadOrGenValidatorFunction · 0.56