aboutsummaryrefslogtreecommitdiffstats
path: root/core/chain_indexer.go
diff options
context:
space:
mode:
authorFelföldi Zsolt <zsfelfoldi@gmail.com>2018-10-03 22:25:25 +0800
committerPéter Szilágyi <peterke@gmail.com>2018-10-03 22:25:25 +0800
commit9d06b2c5f3e97e49466da3d5c7cfba9206a2052c (patch)
tree7e6a41997cf9e211f46fc8d687bb76e21dabc83f /core/chain_indexer.go
parente5677114dc7461fe39ebe353a4657aa4cb03fde4 (diff)
downloadgo-tangerine-9d06b2c5f3e97e49466da3d5c7cfba9206a2052c.tar.gz
go-tangerine-9d06b2c5f3e97e49466da3d5c7cfba9206a2052c.tar.zst
go-tangerine-9d06b2c5f3e97e49466da3d5c7cfba9206a2052c.zip
core: use ChainHeadEvent subscription in the chain indexer (#17826)
Diffstat (limited to 'core/chain_indexer.go')
-rw-r--r--core/chain_indexer.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/core/chain_indexer.go b/core/chain_indexer.go
index 28dc47668..1adde1fcb 100644
--- a/core/chain_indexer.go
+++ b/core/chain_indexer.go
@@ -53,14 +53,14 @@ type ChainIndexerChain interface {
// CurrentHeader retrieves the latest locally known header.
CurrentHeader() *types.Header
- // SubscribeChainEvent subscribes to new head header notifications.
- SubscribeChainEvent(ch chan<- ChainEvent) event.Subscription
+ // SubscribeChainHeadEvent subscribes to new head header notifications.
+ SubscribeChainHeadEvent(ch chan<- ChainHeadEvent) event.Subscription
}
// ChainIndexer does a post-processing job for equally sized sections of the
// canonical chain (like BlooomBits and CHT structures). A ChainIndexer is
// connected to the blockchain through the event system by starting a
-// ChainEventLoop in a goroutine.
+// ChainHeadEventLoop in a goroutine.
//
// Further child ChainIndexers can be added which use the output of the parent
// section indexer. These child indexers receive new head notifications only
@@ -142,8 +142,8 @@ func (c *ChainIndexer) AddCheckpoint(section uint64, shead common.Hash) {
// cascading background processing. Children do not need to be started, they
// are notified about new events by their parents.
func (c *ChainIndexer) Start(chain ChainIndexerChain) {
- events := make(chan ChainEvent, 10)
- sub := chain.SubscribeChainEvent(events)
+ events := make(chan ChainHeadEvent, 10)
+ sub := chain.SubscribeChainHeadEvent(events)
go c.eventLoop(chain.CurrentHeader(), events, sub)
}
@@ -190,7 +190,7 @@ func (c *ChainIndexer) Close() error {
// eventLoop is a secondary - optional - event loop of the indexer which is only
// started for the outermost indexer to push chain head events into a processing
// queue.
-func (c *ChainIndexer) eventLoop(currentHeader *types.Header, events chan ChainEvent, sub event.Subscription) {
+func (c *ChainIndexer) eventLoop(currentHeader *types.Header, events chan ChainHeadEvent, sub event.Subscription) {
// Mark the chain indexer as active, requiring an additional teardown
atomic.StoreUint32(&c.active, 1)