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

Function startDNA

main.go:146–200  ·  view source on GitHub ↗
(ctx *cli.Context)

Source from the content-addressed store, hash-verified

144}
145
146func startDNA(ctx *cli.Context) {
147 initLog(ctx)
148
149 log.Infof("version %s", config.Version)
150
151 setMaxOpenFiles()
152
153 cfg, err := initConfig(ctx)
154 if err != nil {
155 log.Errorf("initConfig error: %s", err)
156 return
157 }
158 acc, err := initAccount(ctx)
159 if err != nil {
160 log.Errorf("initWallet error: %s", err)
161 return
162 }
163 stateHashHeight := config.GetStateHashCheckHeight(cfg.P2PNode.NetworkId)
164 ldg, err := initLedger(ctx, stateHashHeight)
165 if err != nil {
166 log.Errorf("%s", err)
167 return
168 }
169 txpool, err := initTxPool(ctx)
170 if err != nil {
171 log.Errorf("initTxPool error: %s", err)
172 return
173 }
174 p2pSvr, p2pPid, err := initP2PNode(ctx, txpool)
175 if err != nil {
176 log.Errorf("initP2PNode error: %s", err)
177 return
178 }
179 _, err = initConsensus(ctx, p2pPid, txpool, acc)
180 if err != nil {
181 log.Errorf("initConsensus error: %s", err)
182 return
183 }
184 err = initRpc(ctx)
185 if err != nil {
186 log.Errorf("initRpc error: %s", err)
187 return
188 }
189 err = initLocalRpc(ctx)
190 if err != nil {
191 log.Errorf("initLocalRpc error: %s", err)
192 return
193 }
194 initRestful(ctx)
195 initWs(ctx)
196 initNodeInfo(ctx, p2pSvr)
197
198 go logCurrBlockHeight()
199 waitToExit(ldg)
200}
201
202func initLog(ctx *cli.Context) {
203 //init log module

Callers

nothing calls this directly

Calls 15

GetStateHashCheckHeightFunction · 0.92
initLogFunction · 0.85
setMaxOpenFilesFunction · 0.85
initConfigFunction · 0.85
initAccountFunction · 0.85
initLedgerFunction · 0.85
initTxPoolFunction · 0.85
initP2PNodeFunction · 0.85
initConsensusFunction · 0.85
initRpcFunction · 0.85
initLocalRpcFunction · 0.85
initRestfulFunction · 0.85

Tested by

no test coverage detected