MCPcopy
hub / github.com/canopy-network/canopy / singleNodeNetwork

Method singleNodeNetwork

controller/consensus.go:691–706  ·  view source on GitHub ↗

singleNodeNetwork() returns true if there are no other participants in the committee besides self

()

Source from the content-addressed store, hash-verified

689
690// singleNodeNetwork() returns true if there are no other participants in the committee besides self
691func (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
709func (c *Controller) syncingDone(maxHeight, minVDFIterations uint64) bool {

Callers 1

SyncMethod · 0.95

Calls 7

LockMethod · 0.95
UnlockMethod · 0.95
EqualMethod · 0.80
FatalfMethod · 0.65
ErrorMethod · 0.65
GetValidatorSetMethod · 0.65
GetRootChainIdMethod · 0.45

Tested by

no test coverage detected