core: add skip in AddChildIndexer() to avoid double lock

This commit is contained in:
BurtonQin 2020-04-26 03:46:06 -04:00
parent 1aa83290f5
commit 78c3e5f42e

View file

@ -439,6 +439,9 @@ func (c *ChainIndexer) Sections() (uint64, uint64, common.Hash) {
// AddChildIndexer adds a child ChainIndexer that can use the output of this one
func (c *ChainIndexer) AddChildIndexer(indexer *ChainIndexer) {
if c == indexer {
return
}
c.lock.Lock()
defer c.lock.Unlock()