problem: gets block from cache without transaction data when it requested
This commit is contained in:
@@ -44,14 +44,19 @@ open class CachingEthereumApi(
|
|||||||
|
|
||||||
override fun execute(id: Int, method: String, params: List<Any>): Mono<ByteArray> {
|
override fun execute(id: Int, method: String, params: List<Any>): Mono<ByteArray> {
|
||||||
return when (method) {
|
return when (method) {
|
||||||
"eth_blockNumber" -> head.getFlux().next()
|
"eth_blockNumber" ->
|
||||||
|
head.getFlux().next()
|
||||||
.map { HexQuantity.from(it.number).toHex() }
|
.map { HexQuantity.from(it.number).toHex() }
|
||||||
.map(toJson(id))
|
.map(toJson(id))
|
||||||
"eth_getBlockByHash" -> Mono.just(params[0])
|
"eth_getBlockByHash" ->
|
||||||
.map { BlockHash.from(it as String) }
|
if (params.size == 2 && (params[1] == "false" || params[1] == false))
|
||||||
.flatMap(cache::read)
|
Mono.just(params[0])
|
||||||
.map(toJson(id))
|
.map { BlockHash.from(it as String) }
|
||||||
else -> Mono.empty()
|
.flatMap(cache::read)
|
||||||
|
.map(toJson(id))
|
||||||
|
else Mono.empty()
|
||||||
|
else ->
|
||||||
|
Mono.empty()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user