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

Function LoadNodeKey

p2p/key.go:72–83  ·  view source on GitHub ↗

LoadNodeKey loads NodeKey located in filePath.

(filePath string)

Source from the content-addressed store, hash-verified

70
71// LoadNodeKey loads NodeKey located in filePath.
72func LoadNodeKey(filePath string) (*NodeKey, error) {
73 jsonBytes, err := os.ReadFile(filePath)
74 if err != nil {
75 return nil, err
76 }
77 nodeKey := new(NodeKey)
78 err = tmjson.Unmarshal(jsonBytes, nodeKey)
79 if err != nil {
80 return nil, err
81 }
82 return nodeKey, nil
83}
84
85// SaveAs persists the NodeKey to filePath.
86func (nodeKey *NodeKey) SaveAs(filePath string) error {

Callers 4

showNodeIDFunction · 0.92
persistentPeersStringFunction · 0.92
TestLoadNodeKeyFunction · 0.85
LoadOrGenNodeKeyFunction · 0.85

Calls 2

ReadFileFunction · 0.92
UnmarshalMethod · 0.45

Tested by 1

TestLoadNodeKeyFunction · 0.68