Skip to content

Commit

Permalink
Add NotNull quorum for block methods (#265)
Browse files Browse the repository at this point in the history
  • Loading branch information
KirillPamPam authored Aug 2, 2023
1 parent 4a94058 commit d10b3fb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
}
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -123,7 +123,6 @@ class EthereumLocalReader(
reader.receipts()
.read(hash)
.map { it.data to it.upstreamId }
.switchIfEmpty { Mono.just(nullValue to null) }
}
else -> null
}
Expand Down

0 comments on commit d10b3fb

Please sign in to comment.