MCPcopy Create free account
hub / github.com/DNAProject/DNA / NewConsensusService

Function NewConsensusService

consensus/consensus.go:45–61  ·  view source on GitHub ↗
(consensusType string, account *account.Account, txpool *actor.PID, ledger *actor.PID, p2p *actor.PID)

Source from the content-addressed store, hash-verified

43)
44
45func NewConsensusService(consensusType string, account *account.Account, txpool *actor.PID, ledger *actor.PID, p2p *actor.PID) (ConsensusService, error) {
46 if consensusType == "" {
47 consensusType = CONSENSUS_DBFT
48 }
49 var consensus ConsensusService
50 var err error
51 switch consensusType {
52 case CONSENSUS_DBFT:
53 consensus, err = dbft.NewDbftService(account, txpool, p2p)
54 case CONSENSUS_SOLO:
55 consensus, err = solo.NewSoloService(account, txpool)
56 case CONSENSUS_VBFT:
57 consensus, err = vbft.NewVbftServer(account, txpool, p2p)
58 }
59 log.Infof("ConsensusType:%s", consensusType)
60 return consensus, err
61}

Callers 1

initConsensusFunction · 0.92

Calls 4

NewDbftServiceFunction · 0.92
NewSoloServiceFunction · 0.92
NewVbftServerFunction · 0.92
InfofFunction · 0.92

Tested by

no test coverage detected