|
|
@ -180,21 +180,24 @@ func (self *EthereumApi) NewFilterString(args *FilterStringArgs, reply *interfac |
|
|
|
var id int |
|
|
|
var id int |
|
|
|
filter := core.NewFilter(self.xeth().Backend()) |
|
|
|
filter := core.NewFilter(self.xeth().Backend()) |
|
|
|
|
|
|
|
|
|
|
|
callback := func(block *types.Block, logs state.Logs) { |
|
|
|
|
|
|
|
self.logMut.Lock() |
|
|
|
|
|
|
|
defer self.logMut.Unlock() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for _, log := range logs { |
|
|
|
|
|
|
|
self.logs[id].add(log) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
self.logs[id].add(&state.StateLog{}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch args.Word { |
|
|
|
switch args.Word { |
|
|
|
case "pending": |
|
|
|
case "pending": |
|
|
|
filter.PendingCallback = callback |
|
|
|
filter.PendingCallback = func(tx *types.Transaction) { |
|
|
|
|
|
|
|
self.logMut.Lock() |
|
|
|
|
|
|
|
defer self.logMut.Unlock() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self.logs[id].add(&state.StateLog{}) |
|
|
|
|
|
|
|
} |
|
|
|
case "latest": |
|
|
|
case "latest": |
|
|
|
filter.BlockCallback = callback |
|
|
|
filter.BlockCallback = func(block *types.Block, logs state.Logs) { |
|
|
|
|
|
|
|
self.logMut.Lock() |
|
|
|
|
|
|
|
defer self.logMut.Unlock() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for _, log := range logs { |
|
|
|
|
|
|
|
self.logs[id].add(log) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
self.logs[id].add(&state.StateLog{}) |
|
|
|
|
|
|
|
} |
|
|
|
default: |
|
|
|
default: |
|
|
|
return NewValidationError("Word", "Must be `latest` or `pending`") |
|
|
|
return NewValidationError("Word", "Must be `latest` or `pending`") |
|
|
|
} |
|
|
|
} |
|
|
|