Skip to content

Commit 414a231

Browse files
committed
problem: hardcoded methods are not available by default
fix: #295
1 parent 21cb0f0 commit 414a231

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/main/kotlin/io/emeraldpay/dshackle/upstream/VerifyingReader.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class VerifyingReader(
1919
}
2020

2121
override fun read(key: DshackleRequest): Mono<DshackleResponse> {
22-
if (!methods.get().isCallable(key.method)) {
22+
if (!methods.get().isAvailable(key.method)) {
2323
return Mono.error(RpcException(RpcResponseError.CODE_METHOD_NOT_EXIST, "Unsupported method: ${key.method}"))
2424
}
2525
return Mono.empty()

src/test/kotlin/io/emeraldpay/dshackle/upstream/VerifyingReaderTest.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,19 @@ class VerifyingReaderTest : ShouldSpec({
1818

1919
should("Return empty for allowed method") {
2020
val methods = mockk<CallMethods>()
21-
every { methods.isCallable("test_foo") } returns true
21+
every { methods.isAvailable("test_foo") } returns true
2222
val reader = VerifyingReader(AtomicReference(methods))
2323

2424
val act = reader.read(DshackleRequest("test_foo", emptyList()))
2525
.block(Duration.ofSeconds(1))
2626

2727
act shouldBe null
28-
verify(exactly = 1) { methods.isCallable(any()) }
28+
verify(exactly = 1) { methods.isAvailable(any()) }
2929
}
3030

3131
should("Return error for allowed method") {
3232
val methods = mockk<CallMethods>()
33-
every { methods.isCallable("test_foo") } returns false
33+
every { methods.isAvailable("test_foo") } returns false
3434
val reader = VerifyingReader(AtomicReference(methods))
3535

3636
val t = shouldThrow<RpcException> {
@@ -41,6 +41,6 @@ class VerifyingReaderTest : ShouldSpec({
4141
t shouldNotBe null
4242
t.message!! should contain("Unsupported method: test_foo")
4343

44-
verify(exactly = 1) { methods.isCallable(any()) }
44+
verify(exactly = 1) { methods.isAvailable(any()) }
4545
}
4646
})

0 commit comments

Comments
 (0)