コード例 #1
0
ファイル: xeth.go プロジェクト: NikonMcFly/go-ethereum
func (self *XEth) NewLogFilter(earliest, latest int64, skip, max int, address []string, topics [][]string) int {
	self.logMu.Lock()
	defer self.logMu.Unlock()

	filter := core.NewFilter(self.backend)
	id := self.filterManager.InstallFilter(filter)
	self.logQueue[id] = &logQueue{timeout: time.Now()}

	filter.SetEarliestBlock(earliest)
	filter.SetLatestBlock(latest)
	filter.SetSkip(skip)
	filter.SetMax(max)
	filter.SetAddress(cAddress(address))
	filter.SetTopics(cTopics(topics))
	filter.LogsCallback = func(logs state.Logs) {
		self.logMu.Lock()
		defer self.logMu.Unlock()

		if queue := self.logQueue[id]; queue != nil {
			queue.add(logs...)
		}
	}

	return id
}
コード例 #2
0
ファイル: xeth.go プロジェクト: GrimDerp/go-ethereum
func (self *XEth) AllLogs(earliest, latest int64, skip, max int, address []string, topics [][]string) state.Logs {
	filter := core.NewFilter(self.backend)
	filter.SetEarliestBlock(earliest)
	filter.SetLatestBlock(latest)
	filter.SetSkip(skip)
	filter.SetMax(max)
	filter.SetAddress(cAddress(address))
	filter.SetTopics(cTopics(topics))

	return filter.Find()
}
コード例 #3
0
ファイル: xeth.go プロジェクト: CedarLogic/go-ethereum
func (self *XEth) RegisterFilter(earliest, latest int64, skip, max int, address []string, topics [][]string) int {
	var id int
	filter := core.NewFilter(self.backend)
	filter.SetEarliestBlock(earliest)
	filter.SetLatestBlock(latest)
	filter.SetSkip(skip)
	filter.SetMax(max)
	filter.SetAddress(cAddress(address))
	filter.SetTopics(cTopics(topics))
	filter.LogsCallback = func(logs state.Logs) {
		self.logMut.Lock()
		defer self.logMut.Unlock()

		self.logs[id].add(logs...)
	}
	id = self.filterManager.InstallFilter(filter)
	self.logs[id] = &logFilter{timeout: time.Now()}

	return id
}