node: always start blocksync and avoid misconfiguration (#8902)

This commit is contained in:
Sam Kleinman
2022-06-29 22:12:36 -04:00
committed by GitHub
parent 486370ac68
commit 204281fa66
2 changed files with 7 additions and 13 deletions

View File

@@ -700,10 +700,8 @@ func (n *nodeImpl) OnStart() error {
}
if n.config.Mode != config.ModeSeed {
if n.config.BlockSync.Version == config.BlockSyncV0 {
if err := n.bcReactor.Start(); err != nil {
return err
}
if err := n.bcReactor.Start(); err != nil {
return err
}
// Start the real consensus reactor separately since the switch uses the shim.
@@ -830,11 +828,10 @@ func (n *nodeImpl) OnStop() {
if n.config.Mode != config.ModeSeed {
// now stop the reactors
if n.config.BlockSync.Version == config.BlockSyncV0 {
// Stop the real blockchain reactor separately since the switch uses the shim.
if err := n.bcReactor.Stop(); err != nil {
n.Logger.Error("failed to stop the blockchain reactor", "err", err)
}
// Stop the real blockchain reactor separately since the switch uses the shim.
if err := n.bcReactor.Stop(); err != nil {
n.Logger.Error("failed to stop the blockchain reactor", "err", err)
}
// Stop the real consensus reactor separately since the switch uses the shim.

View File

@@ -17,7 +17,6 @@ import (
"github.com/tendermint/tendermint/config"
"github.com/tendermint/tendermint/crypto"
bcv0 "github.com/tendermint/tendermint/internal/blocksync/v0"
bcv2 "github.com/tendermint/tendermint/internal/blocksync/v2"
"github.com/tendermint/tendermint/internal/consensus"
"github.com/tendermint/tendermint/internal/evidence"
"github.com/tendermint/tendermint/internal/mempool"
@@ -746,10 +745,8 @@ func makeNodeInfo(
switch cfg.BlockSync.Version {
case config.BlockSyncV0:
bcChannel = byte(bcv0.BlockSyncChannel)
case config.BlockSyncV2:
bcChannel = bcv2.BlockchainChannel
return types.NodeInfo{}, fmt.Errorf("unsupported blocksync version %s", cfg.BlockSync.Version)
default:
return types.NodeInfo{}, fmt.Errorf("unknown blocksync version %s", cfg.BlockSync.Version)
}