Browse Source

node: always sync with the application at startup

Since #8062, nodes no longer fetch or build state at construction, but instead
when the services are started up. However, some of the state depends on the app
handshake, which we hitherto did only when statesync is disabled.

This means, however, that empty non-validator nodes do not have enough state to
start up consensus. This leads to failures in the end-to-end tests on nodes
that are not initially in the validator set. This probably means the same error
would happen on a new non-active validator in production.
pull/8159/head
M. J. Fromberger 3 years ago
parent
commit
7c59863376
1 changed files with 14 additions and 16 deletions
  1. +14
    -16
      node/node.go

+ 14
- 16
node/node.go View File

@ -223,23 +223,21 @@ func makeNode(
// 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 := consensus.NewHandshaker(
logger.With("module", "handshaker"),
stateStore, state, blockStore, eventBus, genDoc,
).Handshake(ctx, proxyApp); err != nil {
return nil, combineCloseError(err, makeCloser(closers))
}
if err := consensus.NewHandshaker(
logger.With("module", "handshaker"),
stateStore, state, blockStore, eventBus, genDoc,
).Handshake(ctx, proxyApp); err != nil {
return nil, combineCloseError(err, makeCloser(closers))
}
// Reload the state. It will have the Version.Consensus.App set by the
// Handshake, and may have other modifications as well (ie. depending on
// what happened during block replay).
state, err = stateStore.Load()
if err != nil {
return nil, combineCloseError(
fmt.Errorf("cannot load state: %w", err),
makeCloser(closers))
}
// Reload the state. It will have the Version.Consensus.App set by the
// Handshake, and may have other modifications as well (ie. depending on
// what happened during block replay).
state, err = stateStore.Load()
if err != nil {
return nil, combineCloseError(
fmt.Errorf("cannot load state: %w", err),
makeCloser(closers))
}
logNodeStartupInfo(state, pubKey, logger, cfg.Mode)


Loading…
Cancel
Save