singleNodeNetwork() returns true if there are no other participants in the committee besides self
()
| 689 | |
| 690 | // singleNodeNetwork() returns true if there are no other participants in the committee besides self |
| 691 | func (c *Controller) singleNodeNetwork() bool { |
| 692 | c.Lock() |
| 693 | defer c.Unlock() |
| 694 | // get the root chain id from state |
| 695 | id, err := c.FSM.GetRootChainId() |
| 696 | if err != nil { |
| 697 | c.log.Fatalf(err.Error()) |
| 698 | } |
| 699 | // get the validator set |
| 700 | v, err := c.RCManager.GetValidatorSet(id, c.Config.ChainId, 0) |
| 701 | if err != nil { |
| 702 | c.log.Fatalf(err.Error()) |
| 703 | } |
| 704 | // if self is the only validator, return true |
| 705 | return v.NumValidators == 0 || (v.NumValidators == 1 && bytes.Equal(v.ValidatorSet.ValidatorSet[0].PublicKey, c.PublicKey)) |
| 706 | } |
| 707 | |
| 708 | // syncingDone() checks if the syncing loop may complete for a specific chainId |
| 709 | func (c *Controller) syncingDone(maxHeight, minVDFIterations uint64) bool { |
no test coverage detected