eth_subscribe: fix preparing filter (#635)

This commit is contained in:
oke11o
2025-02-21 11:07:06 +01:00
committed by GitHub
parent 8c1649c48e
commit 60045d6511
2 changed files with 48 additions and 6 deletions

View File

@@ -88,6 +88,22 @@ class ConnectLogsSpec extends Specification {
"upstream"
)
def log5 = new LogMessage(
Address.from("0x63bc4a36c66c64acb3d695298d492e8c1d909d3f"),
BlockHash.empty(),
100L,
HexData.empty(),
1L,
[
Hex32.from("0x952ba7f163c4a11628f55a4df523b3efddf252ad1be2c89b69c2b068fc378daa"),
Hex32.from("0x00000000000000000000000088e6a0c2ddd26feeb64f039a2c41296fcb3f5640")
],
TransactionId.from("0xb5e554178a94fd993111f2ae64cb708cb0899d7b5182024e70d5c468164a8bec"),
1L,
false,
"upstream"
)
def "Filter is empty"() {
setup:
def connectLogs = new ConnectLogs(TestingCommons.emptyMultistream(), Schedulers.boundedElastic())
@@ -152,4 +168,26 @@ class ConnectLogsSpec extends Specification {
act.size() == 1
act[0] == log3
}
def "Filter by address and two topics"() {
setup:
def connectLogs = new ConnectLogs(TestingCommons.emptyMultistream(), Schedulers.boundedElastic())
when:
def input = Flux.fromIterable([
log1, log2, log3, log4, log5
])
def act = input.transform(connectLogs.filtered(
[Address.from("0x63bc4a36c66c64acb3d695298d492e8c1d909d3f")],
[
Hex32.from("0x952ba7f163c4a11628f55a4df523b3efddf252ad1be2c89b69c2b068fc378daa"),
Hex32.from("0x00000000000000000000000088e6a0c2ddd26feeb64f039a2c41296fcb3f5640"),
]
))
.collectList().block()
then:
act.size() == 1
act[0] == log5
}
}