mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-04 04:04:00 +00:00
node+consensus: handshaker initialization (#7283)
This mostly just pushes more of initialization out of the node package.
This commit is contained in:
@@ -224,7 +224,10 @@ func makeNode(cfg *config.Config,
|
||||
// Create the handshaker, which calls RequestInfo, sets the AppVersion on the state,
|
||||
// and replays any blocks as necessary to sync tendermint with the app.
|
||||
if !stateSync {
|
||||
if err := doHandshake(stateStore, state, blockStore, genDoc, eventBus, proxyApp, logger); err != nil {
|
||||
if err := consensus.NewHandshaker(
|
||||
logger.With("module", "handshaker"),
|
||||
stateStore, state, blockStore, eventBus, genDoc,
|
||||
).Handshake(proxyApp); err != nil {
|
||||
return nil, combineCloseError(err, makeCloser(closers))
|
||||
}
|
||||
|
||||
|
||||
@@ -134,26 +134,6 @@ func createAndStartIndexerService(
|
||||
return indexerService, eventSinks, nil
|
||||
}
|
||||
|
||||
func doHandshake(
|
||||
stateStore sm.Store,
|
||||
state sm.State,
|
||||
blockStore sm.BlockStore,
|
||||
genDoc *types.GenesisDoc,
|
||||
eventBus types.BlockEventPublisher,
|
||||
proxyApp proxy.AppConns,
|
||||
logger log.Logger,
|
||||
) error {
|
||||
|
||||
handshaker := consensus.NewHandshaker(stateStore, state, blockStore, genDoc)
|
||||
handshaker.SetLogger(logger.With("module", "handshaker"))
|
||||
handshaker.SetEventBus(eventBus)
|
||||
|
||||
if err := handshaker.Handshake(proxyApp); err != nil {
|
||||
return fmt.Errorf("error during handshake: %v", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func logNodeStartupInfo(state sm.State, pubKey crypto.PubKey, logger log.Logger, mode string) {
|
||||
// Log the version info.
|
||||
logger.Info("Version info",
|
||||
|
||||
Reference in New Issue
Block a user