Esempio n. 1
0
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()
}
Esempio n. 2
0
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)
	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()

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

	return id
}