This is an automated email from the ASF dual-hosted git repository.

toulmean pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-tuweni.git


The following commit(s) were added to refs/heads/main by this push:
     new 7d98769a fix integration tests
     new d0bb84a3 Merge pull request #436 from atoulme/fix_integration_tests
7d98769a is described below

commit 7d98769a26b0f7d7538184ff2ad6c2899d022e7c
Author: Antoine Toulme <anto...@lunar-ocean.com>
AuthorDate: Mon Sep 5 23:13:36 2022 -0700

    fix integration tests
---
 .../kotlin/org/apache/tuweni/devp2p/eth/BlockchainInformation.kt     | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git 
a/devp2p-eth/src/main/kotlin/org/apache/tuweni/devp2p/eth/BlockchainInformation.kt
 
b/devp2p-eth/src/main/kotlin/org/apache/tuweni/devp2p/eth/BlockchainInformation.kt
index c222e0e8..618448c0 100644
--- 
a/devp2p-eth/src/main/kotlin/org/apache/tuweni/devp2p/eth/BlockchainInformation.kt
+++ 
b/devp2p-eth/src/main/kotlin/org/apache/tuweni/devp2p/eth/BlockchainInformation.kt
@@ -108,12 +108,13 @@ class SimpleBlockchainInformation(
 
   private val forkIds: List<ForkInfo>
   private val forks: List<Long>
+  private val genesisHashCrc: Bytes
 
   init {
     this.forks = possibleForks.filter { it > 0 }.sorted().distinct()
     val crc = CRC32()
     crc.update(genesisHash.toArrayUnsafe())
-    val genesisHashCrc = Bytes.ofUnsignedInt(crc.value)
+    genesisHashCrc = Bytes.ofUnsignedInt(crc.value)
     val forkHashes = mutableListOf(genesisHashCrc)
     for (f in forks) {
       val byteRepresentationFork = Bytes.ofUnsignedLong(f).toArrayUnsafe()
@@ -150,6 +151,6 @@ class SimpleBlockchainInformation(
         return fork
       }
     }
-    return forkIds.last()
+    return forkIds.lastOrNull() ?: ForkInfo(0, genesisHashCrc)
   }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@tuweni.apache.org
For additional commands, e-mail: commits-h...@tuweni.apache.org

Reply via email to