Add NotNull quorum for block methods (#265)

This commit is contained in:
KirillPamPam
2023-08-02 14:09:28 +04:00
committed by GitHub
parent 4a94058bc8
commit d10b3fb4b0
2 changed files with 8 additions and 9 deletions

View File

@@ -124,20 +124,20 @@ class DefaultEthereumMethods(
private val possibleNotIndexedMethods = listOf(
"eth_getTransactionByHash",
"eth_getTransactionReceipt"
)
private val firstValueMethods = listOf(
"eth_call",
"eth_getTransactionReceipt",
"eth_getBlockTransactionCountByHash",
"eth_getUncleCountByBlockHash",
"eth_getBlockByHash",
"eth_getBlockByNumber",
"eth_getTransactionByBlockHashAndIndex",
"eth_getTransactionByBlockNumberAndIndex",
"eth_getUncleByBlockHashAndIndex",
"eth_getUncleCountByBlockHash"
)
private val firstValueMethods = listOf(
"eth_call",
"eth_getStorageAt",
"eth_getCode",
"eth_getUncleByBlockHashAndIndex",
"eth_getLogs",
"eth_maxPriorityFeePerGas",
"eth_getProof"

View File

@@ -60,6 +60,7 @@ class EthereumLocalReader(
return Mono.empty()
}
val common = commonRequests(key)
?.switchIfEmpty { Mono.just(nullValue to null) }
if (common != null) {
return common.map { JsonRpcResponse(it.first, null, it.second) }
}
@@ -88,7 +89,6 @@ class EthereumLocalReader(
reader.txByHashAsCont()
.read(hash)
.map { it.data.json!! to it.upstreamId }
.switchIfEmpty { Mono.just(nullValue to null) }
}
method == "eth_getBlockByHash" -> {
if (params.size != 2) {
@@ -123,7 +123,6 @@ class EthereumLocalReader(
reader.receipts()
.read(hash)
.map { it.data to it.upstreamId }
.switchIfEmpty { Mono.just(nullValue to null) }
}
else -> null
}