Skip to content

Commit b527c9c

Browse files
committed
core: deadlock in chainmanager after posting RemovedTransactionEvent
This PR solves an issue with the chain manager posting a `RemovedTransactionEvent`, the tx pool will try to acquire the chainmanager lock which has previously been locked prior to posting `RemovedTransactionEvent`. This results in a deadlock in the core.
1 parent 9666db2 commit b527c9c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

core/chain_manager.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,9 @@ func (self *ChainManager) reorg(oldBlock, newBlock *types.Block) error {
804804
DeleteReceipt(self.chainDb, tx.Hash())
805805
DeleteTransaction(self.chainDb, tx.Hash())
806806
}
807-
self.eventMux.Post(RemovedTransactionEvent{diff})
807+
// Must be posted in a goroutine because of the transaction pool trying
808+
// to acquire the chain manager lock
809+
go self.eventMux.Post(RemovedTransactionEvent{diff})
808810

809811
return nil
810812
}

0 commit comments

Comments
 (0)