From d1392fc3431382b4131830d7ce408f93f56fcced Mon Sep 17 00:00:00 2001 From: EugeneDrpc Date: Wed, 30 Jul 2025 10:32:00 +0200 Subject: [PATCH] add method disabled check (#696) * add method disabled check * check only trace and debug methods --- src/main/kotlin/io/emeraldpay/dshackle/rpc/NativeCall.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/io/emeraldpay/dshackle/rpc/NativeCall.kt b/src/main/kotlin/io/emeraldpay/dshackle/rpc/NativeCall.kt index 6e1a9565..fd9e35ca 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/rpc/NativeCall.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/rpc/NativeCall.kt @@ -108,7 +108,11 @@ open class NativeCall( } .doOnNext { callRes -> - if (callRes.error?.message?.contains(Regex("method ([A-Za-z0-9_]+) does not exist/is not available")) == true) { + val isMethodNotAvailable = callRes.error?.message?.contains(Regex("method ([A-Za-z0-9_]+) does not exist/is not available")) == true + val isMethodDisabled = callRes.error?.message?.contains("method is disabled", ignoreCase = true) == true + val isTraceOrDebugMethod = it is ValidCallContext<*> && it.payload is ParsedCallDetails && (it.payload.method.startsWith("trace_") || it.payload.method.startsWith("debug_")) + + if (isMethodNotAvailable || (isMethodDisabled && isTraceOrDebugMethod)) { if (it is ValidCallContext<*>) { if (it.payload is ParsedCallDetails) { log.error("nativeCallResult method ${it.payload.method} of ${it.upstream.getId()} is not available, disabling")