(chain *Chain, isLeader bool)
| 60 | } |
| 61 | |
| 62 | func 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 | |
| 85 | func createRandomString(offset, length int, s *string) { |
| 86 | buff := make([]byte, rand.Intn(length)+offset) |
no test coverage detected