Browse Source

node: don't attempt fast sync when InitChain sets self as only validator (#5211)

Fixes #5178.
pull/5214/head
Erik Grinaker 4 years ago
committed by GitHub
parent
commit
3413a0dbd8
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions
  1. +1
    -0
      CHANGELOG_PENDING.md
  2. +5
    -3
      node/node.go

+ 1
- 0
CHANGELOG_PENDING.md View File

@ -17,3 +17,4 @@ Friendly reminder, we have a [bug bounty program](https://hackerone.com/tendermi
### BUG FIXES:
- [evidence] [\#5170](https://github.com/tendermint/tendermint/pull/5170) change abci evidence time to the time the infraction happened not the time the evidence was committed on the block (@cmwaters)
- [node] Don't attempt fast sync when the ABCI application specifies ourself as the only validator via `InitChain` (@erikgrinaker)

+ 5
- 3
node/node.go View File

@ -666,9 +666,7 @@ func NewNode(config *cfg.Config,
return nil, fmt.Errorf("can't get pubkey: %w", err)
}
// Determine whether we should do state and/or fast sync.
// We don't fast-sync when the only validator is us.
fastSync := config.FastSyncMode && !onlyValidatorIsUs(state, pubKey)
// Determine whether we should attempt state sync.
stateSync := config.StateSync.Enable && !onlyValidatorIsUs(state, pubKey)
if stateSync && state.LastBlockHeight > 0 {
logger.Info("Found local state with non-zero height, skipping state sync")
@ -689,6 +687,10 @@ func NewNode(config *cfg.Config,
state = sm.LoadState(stateDB)
}
// Determine whether we should do fast sync. This must happen after the handshake, since the
// app may modify the validator set, specifying ourself as the only validator.
fastSync := config.FastSyncMode && !onlyValidatorIsUs(state, pubKey)
logNodeStartupInfo(state, pubKey, logger, consensusLogger)
csMetrics, p2pMetrics, memplMetrics, smMetrics := metricsProvider(genDoc.ChainID)


Loading…
Cancel
Save