You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuweni.apache.org by to...@apache.org on 2020/06/07 06:46:10 UTC
[incubator-tuweni] branch master updated: fix compile warnings
This is an automated email from the ASF dual-hosted git repository.
toulmean pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-tuweni.git
The following commit(s) were added to refs/heads/master by this push:
new f233f5a fix compile warnings
f233f5a is described below
commit f233f5a8d618adabe203882935061fef92c41ded
Author: Antoine Toulme <an...@lunar-ocean.com>
AuthorDate: Sat Jun 6 23:45:58 2020 -0700
fix compile warnings
---
.../kotlin/org/apache/tuweni/devp2p/eth/EthClient.kt | 7 +++++--
.../org/apache/tuweni/devp2p/eth/EthController.kt | 17 +++++++----------
2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/devp2p-eth/src/main/kotlin/org/apache/tuweni/devp2p/eth/EthClient.kt b/devp2p-eth/src/main/kotlin/org/apache/tuweni/devp2p/eth/EthClient.kt
index 8894375..f2ab997 100644
--- a/devp2p-eth/src/main/kotlin/org/apache/tuweni/devp2p/eth/EthClient.kt
+++ b/devp2p-eth/src/main/kotlin/org/apache/tuweni/devp2p/eth/EthClient.kt
@@ -38,8 +38,9 @@ class EthClient(private val service: RLPxService) : EthRequestsManager, SubProto
override fun requestTransactionReceipts(blockHashes: List<Hash>): AsyncCompletion {
val conns = service.repository().asIterable(EthSubprotocol.ETH62)
val handle = AsyncCompletion.incomplete()
+ var done = false
conns.forEach { conn ->
- var done = false
+
transactionReceiptRequests.computeIfAbsent(conn.id()) {
service.send(
EthSubprotocol.ETH62,
@@ -50,7 +51,9 @@ class EthClient(private val service: RLPxService) : EthRequestsManager, SubProto
done = true
Request(conn.id(), handle, blockHashes)
}
- return handle
+ if (done) {
+ return handle
+ }
}
throw RuntimeException("No connection available")
}
diff --git a/devp2p-eth/src/main/kotlin/org/apache/tuweni/devp2p/eth/EthController.kt b/devp2p-eth/src/main/kotlin/org/apache/tuweni/devp2p/eth/EthController.kt
index 243608c..866f946 100644
--- a/devp2p-eth/src/main/kotlin/org/apache/tuweni/devp2p/eth/EthController.kt
+++ b/devp2p-eth/src/main/kotlin/org/apache/tuweni/devp2p/eth/EthController.kt
@@ -24,12 +24,9 @@ import org.apache.tuweni.eth.Hash
import org.apache.tuweni.eth.Transaction
import org.apache.tuweni.eth.TransactionReceipt
import org.apache.tuweni.eth.repository.BlockchainRepository
-import org.apache.tuweni.units.bigints.UInt256
class EthController(val repository: BlockchainRepository, val requestsManager: EthRequestsManager) {
- var highestTotalDifficulty: UInt256 = repository.retrieveChainHeadTotalDifficulty()
-
suspend fun findTransactionReceipts(hashes: List<Hash>): List<List<TransactionReceipt>> {
val receipts = ArrayList<List<TransactionReceipt>>()
hashes.forEach {
@@ -120,9 +117,9 @@ class EthController(val repository: BlockchainRepository, val requestsManager: E
suspend fun addNewBlockBodies(connectionId: String, bodies: List<BlockBody>) {
val request = requestsManager.wasRequested(connectionId, bodies)
if (request != null) {
- val hashes = request.data as List<Hash>
+ val hashes = request.data as List<*>
for (i in 0..hashes.size) {
- repository.storeBlockBody(hashes[i], bodies[i])
+ repository.storeBlockBody(hashes[i] as Hash, bodies[i])
}
}
}
@@ -139,11 +136,11 @@ class EthController(val repository: BlockchainRepository, val requestsManager: E
suspend fun addNewNodeData(connectionId: String, elements: List<Bytes?>) {
val request = requestsManager.nodeDataWasRequested(connectionId, elements)
if (request != null) {
- val hashes = request.data as List<Hash>
+ val hashes = request.data as List<*>
for (i in 0..hashes.size) {
val elt = elements[i]
if (elt != null) {
- repository.storeNodeData(hashes[i], elt)
+ repository.storeNodeData(hashes[i] as Hash, elt)
}
}
}
@@ -152,16 +149,16 @@ class EthController(val repository: BlockchainRepository, val requestsManager: E
suspend fun addNewTransactionReceipts(connectionId: String, transactionReceipts: List<List<TransactionReceipt>>) {
val request = requestsManager.transactionRequestsWasRequested(connectionId, transactionReceipts)
if (request != null) {
- val hashes = request.data as List<Hash>
+ val hashes = request.data as List<*>
for (i in 0..hashes.size) {
- val blockBody = repository.retrieveBlockBody(hashes[i])
+ val blockBody = repository.retrieveBlockBody(hashes[i] as Hash)
val blockReceipts = transactionReceipts[i]
for (j in 0..blockReceipts.size) {
repository.storeTransactionReceipt(
blockReceipts[j],
j,
blockBody?.transactions?.get(j)?.hash ?: Bytes.EMPTY,
- hashes[i]
+ hashes[i] as Hash
)
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tuweni.apache.org
For additional commands, e-mail: commits-help@tuweni.apache.org