core/rpc: fix for null entries in log filters. Closes #725
You can now specify `null` as a way of saying "not interested in this topic, match all". core.Filter assumes the zero'd address to be the wildcard. JSON rpc assumes empty strings to be wildcards.
This commit is contained in:
parent
093d6d5074
commit
ed0817c55d
@ -134,7 +134,8 @@ Logs:
|
|||||||
for i, topics := range self.topics {
|
for i, topics := range self.topics {
|
||||||
for _, topic := range topics {
|
for _, topic := range topics {
|
||||||
var match bool
|
var match bool
|
||||||
if log.Topics[i] == topic {
|
// common.Hash{} is a match all (wildcard)
|
||||||
|
if (topic == common.Hash{}) || log.Topics[i] == topic {
|
||||||
match = true
|
match = true
|
||||||
}
|
}
|
||||||
if !match {
|
if !match {
|
||||||
|
@ -739,10 +739,14 @@ func (args *BlockFilterArgs) UnmarshalJSON(b []byte) (err error) {
|
|||||||
for j, jv := range argarray {
|
for j, jv := range argarray {
|
||||||
if v, ok := jv.(string); ok {
|
if v, ok := jv.(string); ok {
|
||||||
topicdbl[i][j] = v
|
topicdbl[i][j] = v
|
||||||
|
} else if jv == nil {
|
||||||
|
topicdbl[i][j] = ""
|
||||||
} else {
|
} else {
|
||||||
return NewInvalidTypeError(fmt.Sprintf("topic[%d][%d]", i, j), "is not a string")
|
return NewInvalidTypeError(fmt.Sprintf("topic[%d][%d]", i, j), "is not a string")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if iv == nil {
|
||||||
|
topicdbl[i] = []string{""}
|
||||||
} else {
|
} else {
|
||||||
return NewInvalidTypeError(fmt.Sprintf("topic[%d]", i), "not a string or array")
|
return NewInvalidTypeError(fmt.Sprintf("topic[%d]", i), "not a string or array")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user