aboutsummaryrefslogtreecommitdiffstats
path: root/xeth/xeth.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2015-07-20 19:02:02 +0800
committerJeffrey Wilcke <geffobscura@gmail.com>2015-07-26 19:11:51 +0800
commit56edaa1653d3d3c9e1535e3552fd9b49724c42a7 (patch)
treee826538c7fac26254ad83a6ab44041c4892cb5e3 /xeth/xeth.go
parent8865fda872e9cf5eb7ca1fa89ba226d0d3c19ee6 (diff)
downloadgo-tangerine-56edaa1653d3d3c9e1535e3552fd9b49724c42a7.tar
go-tangerine-56edaa1653d3d3c9e1535e3552fd9b49724c42a7.tar.gz
go-tangerine-56edaa1653d3d3c9e1535e3552fd9b49724c42a7.tar.bz2
go-tangerine-56edaa1653d3d3c9e1535e3552fd9b49724c42a7.tar.lz
go-tangerine-56edaa1653d3d3c9e1535e3552fd9b49724c42a7.tar.xz
go-tangerine-56edaa1653d3d3c9e1535e3552fd9b49724c42a7.tar.zst
go-tangerine-56edaa1653d3d3c9e1535e3552fd9b49724c42a7.zip
xeth: fix #1485, data race in fiilter creation and event firing
Diffstat (limited to 'xeth/xeth.go')
-rw-r--r--xeth/xeth.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/xeth/xeth.go b/xeth/xeth.go
index a566279ab..3bc22a43d 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) {