-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
101 lines (80 loc) · 2.43 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
package forum
import (
"os"
"github.com/cometbft/cometbft/app"
"github.com/cometbft/cometbft/cmd"
"github.com/cometbft/cometbft/consensus"
"github.com/cometbft/cometbft/libs/log"
"github.com/cometbft/cometbft/p2p"
"github.com/cometbft/cometbft/proxy"
"github.com/cometbft/cometbft/rpc"
"github.com/cometbft/cometbft/state"
"github.com/cometbft/cometbft/store"
)
/*
This code is the entry point for a CometBFT application. It initializes various components of
the application such as the consensus engine, state machine, store, P2P layer, RPC layer,
proxy layer, and command-line interface. It then starts each of these components and waits
forever.
*/
func main() {
logger := log.NewTMLogger(log.NewSyncWriter(os.Stdout))
// Create the main CometBFT app
application := app.NewCometApp()
// Create the CometBFT consensus engine
consensus := consensus.NewCometConsensus()
// Create the CometBFT state machine
state := state.NewCometState()
// Create the CometBFT store
store := store.NewCometStore()
// Create the CometBFT P2P layer
p2p := p2p.NewCometP2P()
// Create the CometBFT RPC layer
rpc := rpc.NewCometRPC()
// Create the CometBFT proxy layer
proxy := proxy.NewCometProxy()
// Create the CometBFT command-line interface
cmd := cmd.NewCometCLI()
// Start the CometBFT app
if err := application.Start(); err != nil {
logger.Error("error starting application", "err", err)
return
}
// Start the CometBFT consensus engine
if err := consensus.Start(); err != nil {
logger.Error("error starting consensus engine", "err", err)
return
}
// Start the CometBFT state machine
if err := state.Start(); err != nil {
logger.Error("error starting state machine", "err", err)
return
}
// Start the CometBFT store
if err := store.Start(); err != nil {
logger.Error("error starting store", "err", err)
return
}
// Start the CometBFT P2P layer
if err := p2p.Start(); err != nil {
logger.Error("error starting p2p layer", "err", err)
return
}
// Start the CometBFT RPC layer
if err := rpc.Start(); err != nil {
logger.Error("error starting rpc layer", "err", err)
return
}
// Start the CometBFT proxy layer
if err := proxy.Start(); err != nil {
logger.Error("error starting proxy layer", "err", err)
return
}
// Start the CometBFT command-line interface
if err := cmd.Start(); err != nil {
logger.Error("error starting command-line interface", "err", err)
return
}
// Wait forever
select {}
}