@ -193,6 +193,7 @@ type Node struct {
stateSync bool // whether the node should state sync on startup
stateSyncReactor * statesync . Reactor // for hosting and restoring state sync snapshots
stateSyncProvider statesync . StateProvider // provides state data for bootstrapping a node
stateSyncGenesis sm . State // provides the genesis state for state sync
consensusState * cs . State // latest consensus state
consensusReactor * cs . Reactor // for participating in the consensus
pexReactor * pex . Reactor // for exchanging peer addresses
@ -558,10 +559,9 @@ func createPEXReactorAndAddToSwitch(addrBook pex.AddrBook, config *cfg.Config,
// startStateSync starts an asynchronous state sync process, then switches to fast sync mode.
func startStateSync ( ssR * statesync . Reactor , bcR fastSyncReactor , conR * cs . Reactor ,
stateProvider statesync . StateProvider , config * cfg . StateSyncConfig , fastSync bool ,
stateDB dbm . DB , blockStore * store . BlockStore ) error {
stateDB dbm . DB , blockStore * store . BlockStore , state sm . State ) error {
ssR . Logger . Info ( "Starting state sync" )
state := sm . LoadState ( stateDB )
if stateProvider == nil {
var err error
stateProvider , err = statesync . NewLightClientStateProvider (
@ -813,6 +813,7 @@ func NewNode(config *cfg.Config,
consensusReactor : consensusReactor ,
stateSyncReactor : stateSyncReactor ,
stateSync : stateSync ,
stateSyncGenesis : state , // Shouldn't be necessary, but need a way to pass the genesis state
pexReactor : pexReactor ,
evidencePool : evidencePool ,
proxyApp : proxyApp ,
@ -893,7 +894,7 @@ func (n *Node) OnStart() error {
return fmt . Errorf ( "this blockchain reactor does not support switching from state sync" )
}
err := startStateSync ( n . stateSyncReactor , bcR , n . consensusReactor , n . stateSyncProvider ,
n . config . StateSync , n . config . FastSyncMode , n . stateDB , n . blockStore )
n . config . StateSync , n . config . FastSyncMode , n . stateDB , n . blockStore , n . stateSyncGenesis )
if err != nil {
return fmt . Errorf ( "failed to start state sync: %w" , err )
}