diff options
author | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-07-20 19:27:10 +0800 |
---|---|---|
committer | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-07-20 19:27:10 +0800 |
commit | 02c5022742e2bf6d2aadca06a6a1655214ba9d55 (patch) | |
tree | 318bfae73e0e3b392381e7bf2a50019f79fb8fa4 | |
parent | 12bb743b3541c3ce038d26a7f2fc4e28208e5c1f (diff) | |
parent | 3642441ca3a0afe94e581612ff99aef7f0e66a44 (diff) | |
download | dexon-02c5022742e2bf6d2aadca06a6a1655214ba9d55.tar dexon-02c5022742e2bf6d2aadca06a6a1655214ba9d55.tar.gz dexon-02c5022742e2bf6d2aadca06a6a1655214ba9d55.tar.bz2 dexon-02c5022742e2bf6d2aadca06a6a1655214ba9d55.tar.lz dexon-02c5022742e2bf6d2aadca06a6a1655214ba9d55.tar.xz dexon-02c5022742e2bf6d2aadca06a6a1655214ba9d55.tar.zst dexon-02c5022742e2bf6d2aadca06a6a1655214ba9d55.zip |
Merge pull request #1496 from karalabe/fix-xeth-races
xeth: fix #1485, data race in fiilter creation and event firing
-rw-r--r-- | xeth/xeth.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/xeth/xeth.go b/xeth/xeth.go index 19d9c0ad4..34409a148 100644 --- a/xeth/xeth.go +++ b/xeth/xeth.go @@ -518,6 +518,9 @@ func (self *XEth) UninstallFilter(id int) bool { } func (self *XEth) NewLogFilter(earliest, latest int64, skip, max int, address []string, topics [][]string) int { + self.logMu.Lock() + defer self.logMu.Unlock() + var id int filter := core.NewFilter(self.backend) filter.SetEarliestBlock(earliest) @@ -539,6 +542,9 @@ func (self *XEth) NewLogFilter(earliest, latest int64, skip, max int, address [] } func (self *XEth) NewTransactionFilter() int { + self.transactionMu.Lock() + defer self.transactionMu.Unlock() + var id int filter := core.NewFilter(self.backend) filter.TransactionCallback = func(tx *types.Transaction) { @@ -553,6 +559,9 @@ func (self *XEth) NewTransactionFilter() int { } func (self *XEth) NewBlockFilter() int { + self.blockMu.Lock() + defer self.blockMu.Unlock() + var id int filter := core.NewFilter(self.backend) filter.BlockCallback = func(block *types.Block, logs state.Logs) { |