problem: hardcoded methods are not called
This commit is contained in:
@@ -40,7 +40,7 @@ class AggregatedCallMethods(
|
||||
*/
|
||||
override fun getQuorumFor(method: String): CallQuorum {
|
||||
return delegates.find {
|
||||
it.isAllowed(method)
|
||||
it.isAllowed(method) || it.isHardcoded(method)
|
||||
}?.getQuorumFor(method) ?: throw IllegalStateException("No quorum for $method")
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ class AggregatedCallMethods(
|
||||
* @return true if there is at least one delegate that allows the method and it's hardcoded on that delegate
|
||||
*/
|
||||
override fun isHardcoded(method: String): Boolean {
|
||||
return delegates.any { it.isAllowed(method) && it.isHardcoded(method) }
|
||||
return delegates.any { it.isHardcoded(method) }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -70,7 +70,7 @@ class AggregatedCallMethods(
|
||||
*/
|
||||
override fun executeHardcoded(method: String): ByteArray {
|
||||
return delegates.find {
|
||||
it.isAllowed(method) && it.isHardcoded(method)
|
||||
it.isHardcoded(method)
|
||||
}?.executeHardcoded(method) ?: throw IllegalStateException("No hardcoded for $method")
|
||||
}
|
||||
}
|
||||
@@ -47,18 +47,18 @@ class NativeCallRouter(
|
||||
)
|
||||
|
||||
override fun read(key: JsonRpcRequest): Mono<JsonRpcResponse> {
|
||||
if (!methods.isAllowed(key.method)) {
|
||||
return Mono.error(RpcException(RpcResponseError.CODE_METHOD_NOT_EXIST, "Unsupported method"))
|
||||
}
|
||||
if (methods.isHardcoded(key.method)) {
|
||||
return Mono.just(methods.executeHardcoded(key.method))
|
||||
.map { JsonRpcResponse(it, null) }
|
||||
}
|
||||
if (!methods.isAllowed(key.method)) {
|
||||
return Mono.error(RpcException(RpcResponseError.CODE_METHOD_NOT_EXIST, "Unsupported method"))
|
||||
}
|
||||
val common = commonRequests(key)
|
||||
if (common != null) {
|
||||
return common.map { JsonRpcResponse(it, null) }
|
||||
}
|
||||
return directApi.read(key)
|
||||
return Mono.empty()
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user