eth_filter fix lint and tests

This commit is contained in:
Maksim Fomenkov
2022-10-27 11:37:12 +03:00
parent cff0627020
commit 0826e647c4
3 changed files with 13 additions and 3 deletions

View File

@@ -413,6 +413,5 @@ class Selector {
if (other !is SameNodeMatcher) return false
return other.upstreamHash == upstreamHash
}
}
}

View File

@@ -69,7 +69,7 @@ class EthereumCallSelector(
return Mono.empty()
}
val filterId = list[0].toString()
if(filterId.length < 4) {
if (filterId.length < 4) {
return Mono.just(Selector.SameNodeMatcher(0.toByte()))
}
val hashHex = filterId.substring(filterId.length - 2)

View File

@@ -193,8 +193,19 @@ class EthereumCallSelectorSpec extends Specification {
param | hash
'["0xff09"]' | 9
'["0xff"]' | 255
'[]' | 0
'[""]' | 0
'["0x0"]' | 0
}
def "Get empty matcher for getFilterChanges method without params"() {
setup:
def callSelector = new EthereumCallSelector(Mock(Reader))
def head = Mock(Head)
when:
def act = callSelector.getMatcher("eth_getFilterChanges", "[]", head).block()
then:
act == null
}
}