// Create new signing node that incorporates a given private key func NewKeyedNode(hn coconet.Host, suite abstract.Suite, PrivKey abstract.Secret) *Node { sn := &Node{Host: hn, suite: suite, PrivKey: PrivKey} sn.PubKey = suite.Point().Mul(nil, sn.PrivKey) sn.peerKeys = make(map[string]abstract.Point) sn.closed = make(chan error, 20) sn.done = make(chan int, 10) sn.commitsDone = make(chan int, 10) sn.viewChangeCh = make(chan string, 0) sn.RoundCommits = make(map[int][]*SigningMessage) sn.RoundResponses = make(map[int][]*SigningMessage) sn.FailureRate = 0 h := fnv.New32a() h.Write([]byte(hn.Name())) seed := h.Sum32() sn.Rand = rand.New(rand.NewSource(int64(seed))) sn.Host.SetSuite(suite) sn.VoteLog = NewVoteLog() sn.Actions = make(map[int][]*Vote) sn.RoundsPerView = 0 sn.Rounds = make(map[int]Round) sn.MaxWait = 50 * time.Second return sn }
func NewNode(hn coconet.Host, suite abstract.Suite, random cipher.Stream) *Node { sn := &Node{Host: hn, suite: suite} msgSuite = suite sn.PrivKey = suite.Secret().Pick(random) sn.PubKey = suite.Point().Mul(nil, sn.PrivKey) sn.peerKeys = make(map[string]abstract.Point) sn.Rounds = make(map[int]*Round) sn.closed = make(chan error, 20) sn.done = make(chan int, 10) sn.commitsDone = make(chan int, 10) sn.viewChangeCh = make(chan string, 0) sn.FailureRate = 0 h := fnv.New32a() h.Write([]byte(hn.Name())) seed := h.Sum32() sn.Rand = rand.New(rand.NewSource(int64(seed))) sn.Host.SetSuite(suite) sn.VoteLog = NewVoteLog() sn.Actions = make(map[int][]*Vote) sn.RoundsPerView = 100 return sn }