startNode starts a Tendermint node running the application directly. It assumes the Tendermint configuration is in $TMHOME/config/tendermint.toml. FIXME There is no way to simply load the configuration from a file, so we need to pull in Viper.
(cfg *Config)
| 120 | // |
| 121 | // FIXME There is no way to simply load the configuration from a file, so we need to pull in Viper. |
| 122 | func startNode(cfg *Config) error { |
| 123 | app, err := app.NewApplication(cfg.App()) |
| 124 | if err != nil { |
| 125 | return err |
| 126 | } |
| 127 | |
| 128 | tmcfg, nodeLogger, nodeKey, err := setupNode() |
| 129 | if err != nil { |
| 130 | return fmt.Errorf("failed to setup config: %w", err) |
| 131 | } |
| 132 | |
| 133 | n, err := node.NewNode(tmcfg, |
| 134 | privval.LoadOrGenFilePV(tmcfg.PrivValidatorKeyFile(), tmcfg.PrivValidatorStateFile()), |
| 135 | nodeKey, |
| 136 | proxy.NewLocalClientCreator(app), |
| 137 | node.DefaultGenesisDocProviderFunc(tmcfg), |
| 138 | node.DefaultDBProvider, |
| 139 | node.DefaultMetricsProvider(tmcfg.Instrumentation), |
| 140 | nodeLogger, |
| 141 | ) |
| 142 | if err != nil { |
| 143 | return err |
| 144 | } |
| 145 | return n.Start() |
| 146 | } |
| 147 | |
| 148 | func startLightClient(cfg *Config) error { |
| 149 | tmcfg, nodeLogger, _, err := setupNode() |
no test coverage detected