MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / InitKMS

Function InitKMS

route/dns.go:186–217  ·  view source on GitHub ↗

InitKMS inits nasty stuff, only for testing.

(PubKeyStoreFile string)

Source from the content-addressed store, hash-verified

184
185// InitKMS inits nasty stuff, only for testing.
186func InitKMS(PubKeyStoreFile string) {
187 initResolver()
188 kms.InitPublicKeyStore(PubKeyStoreFile, nil)
189 if conf.GConf.KnownNodes != nil {
190 for _, n := range conf.GConf.KnownNodes {
191 rawNodeID := n.ID.ToRawNodeID()
192
193 log.WithFields(log.Fields{
194 "node": rawNodeID.String(),
195 "addr": n.Addr,
196 }).Debug("set node addr")
197 SetNodeAddrCache(rawNodeID, n.Addr)
198 node := &proto.Node{
199 ID: n.ID,
200 Addr: n.Addr,
201 DirectAddr: n.DirectAddr,
202 PublicKey: n.PublicKey,
203 Nonce: n.Nonce,
204 Role: n.Role,
205 }
206 log.WithField("node", node).Debug("known node to set")
207 err := kms.SetNode(node)
208 if err != nil {
209 log.WithField("node", node).WithError(err).Error("set node failed")
210 }
211 if n.ID == conf.GConf.ThisNodeID {
212 kms.SetLocalNodeIDNonce(rawNodeID.CloneBytes(), &n.Nonce)
213 }
214 }
215 }
216 log.Debugf("AllNodes:\n %#v\n", conf.GConf.KnownNodes)
217}

Callers 15

setupFunction · 0.92
TestMetaStateFunction · 0.92
InitFunction · 0.92
initNodeFunction · 0.92
initNodeChainBusServiceFunction · 0.92
initNodeFunction · 0.92
TestCQLDFunction · 0.92
TestStartBP_CallRPCFunction · 0.92
initNodeFunction · 0.92
setupFunction · 0.92
TestCaller_CallNodeFunction · 0.92

Calls 14

InitPublicKeyStoreFunction · 0.92
WithFieldsFunction · 0.92
WithFieldFunction · 0.92
SetNodeFunction · 0.92
SetLocalNodeIDNonceFunction · 0.92
DebugfFunction · 0.92
initResolverFunction · 0.85
SetNodeAddrCacheFunction · 0.85
ToRawNodeIDMethod · 0.80
DebugMethod · 0.80
ErrorMethod · 0.80
WithErrorMethod · 0.80

Tested by 15

setupFunction · 0.74
TestMetaStateFunction · 0.74
initNodeFunction · 0.74
initNodeChainBusServiceFunction · 0.74
initNodeFunction · 0.74
TestCQLDFunction · 0.74
TestStartBP_CallRPCFunction · 0.74
setupFunction · 0.74
TestCaller_CallNodeFunction · 0.74
TestNewPersistentCallerFunction · 0.74