mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
core: add skip in AddChildIndexer() to avoid double lock
This commit is contained in:
parent
1aa83290f5
commit
78c3e5f42e
1 changed files with 3 additions and 0 deletions
|
|
@ -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
|
// AddChildIndexer adds a child ChainIndexer that can use the output of this one
|
||||||
func (c *ChainIndexer) AddChildIndexer(indexer *ChainIndexer) {
|
func (c *ChainIndexer) AddChildIndexer(indexer *ChainIndexer) {
|
||||||
|
if c == indexer {
|
||||||
|
return
|
||||||
|
}
|
||||||
c.lock.Lock()
|
c.lock.Lock()
|
||||||
defer c.lock.Unlock()
|
defer c.lock.Unlock()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue