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

Function newRandomNode

sqlchain/xxx_test.go:62–83  ·  view source on GitHub ↗
(chain *Chain, isLeader bool)

Source from the content-addressed store, hash-verified

60}
61
62func newRandomNode(chain *Chain, isLeader bool) (node *nodeProfile, err error) {
63 priv, pub, err := asymmetric.GenSecp256k1KeyPair()
64
65 if err != nil {
66 return
67 }
68
69 h := &hash.Hash{}
70 rand.Read(h[:])
71
72 node = &nodeProfile{
73 NodeID: proto.NodeID(h.String()),
74 PrivateKey: priv,
75 PublicKey: pub,
76 ConnectionID: atomic.AddUint64(&testConnIDSeed, 1),
77 SeqNo: rand.Uint64(),
78 Chain: chain,
79 IsLeader: isLeader,
80 }
81
82 return
83}
84
85func createRandomString(offset, length int, s *string) {
86 buff := make([]byte, rand.Intn(length)+offset)

Callers 1

TestMultiChainFunction · 0.85

Calls 4

StringMethod · 0.95
GenSecp256k1KeyPairFunction · 0.92
NodeIDTypeAlias · 0.92
ReadMethod · 0.65

Tested by

no test coverage detected