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.
This commit is contained in:
Jeffrey Wilcke 2015-10-02 12:20:18 +02:00
parent 9666db2a44
commit b527c9c718
1 changed files with 3 additions and 1 deletions

View File

@ -804,7 +804,9 @@ func (self *ChainManager) reorg(oldBlock, newBlock *types.Block) error {
DeleteReceipt(self.chainDb, tx.Hash())
DeleteTransaction(self.chainDb, tx.Hash())
}
self.eventMux.Post(RemovedTransactionEvent{diff})
// Must be posted in a goroutine because of the transaction pool trying
// to acquire the chain manager lock
go self.eventMux.Post(RemovedTransactionEvent{diff})
return nil
}