evidence: manage and initialize state objects more clearly in the pool (#8080)

This commit is contained in:
Sam Kleinman
2022-03-07 14:26:58 -05:00
committed by GitHub
parent 2df5c85a8d
commit 01266881b8
8 changed files with 269 additions and 255 deletions

View File

@@ -62,7 +62,8 @@ type nodeImpl struct {
// services
eventSinks []indexer.EventSink
stateStore sm.Store
blockStore *store.BlockStore // store the blockchain to disk
blockStore *store.BlockStore // store the blockchain to disk
evPool *evidence.Pool
stateSync bool // whether the node should state sync on startup
stateSyncReactor *statesync.Reactor // for hosting and restoring state sync snapshots
@@ -388,6 +389,7 @@ func makeNode(
blockStore: blockStore,
stateSyncReactor: stateSyncReactor,
stateSync: stateSync,
evPool: evPool,
shutdownOps: makeCloser(closers),
@@ -462,6 +464,14 @@ func (n *nodeImpl) OnStart(ctx context.Context) error {
}
}
state, err := n.stateStore.Load()
if err != nil {
return err
}
if err := n.evPool.Start(state); err != nil {
return err
}
n.rpcEnv.NodeInfo = n.nodeInfo
// Start the RPC server before the P2P server
// so we can eg. receive txs for the first block