reachMinConnection return whether net layer have enough link under different config
()
| 352 | |
| 353 | //reachMinConnection return whether net layer have enough link under different config |
| 354 | func (this *P2PServer) reachMinConnection() bool { |
| 355 | if !config.DefConfig.Consensus.EnableConsensus { |
| 356 | //just sync |
| 357 | return true |
| 358 | } |
| 359 | consensusType := strings.ToLower(config.DefConfig.Genesis.ConsensusType) |
| 360 | if consensusType == "" { |
| 361 | consensusType = "dbft" |
| 362 | } |
| 363 | minCount := config.DBFT_MIN_NODE_NUM |
| 364 | switch consensusType { |
| 365 | case "dbft": |
| 366 | case "solo": |
| 367 | minCount = config.SOLO_MIN_NODE_NUM |
| 368 | case "vbft": |
| 369 | minCount = config.VBFT_MIN_NODE_NUM |
| 370 | |
| 371 | } |
| 372 | return int(this.GetConnectionCnt())+1 >= minCount |
| 373 | } |
| 374 | |
| 375 | //getNode returns the peer with the id |
| 376 | func (this *P2PServer) getNode(id uint64) *peer.Peer { |
no test coverage detected