fix array out of bound exception

This commit is contained in:
Maxksim Fomenkov
2022-09-01 18:10:08 +03:00
parent ca343d40df
commit 09ff044b67

View File

@@ -174,7 +174,7 @@ class EthereumBlockValidator : BlockValidator {
private fun BigInteger.asUint64() = this.toByteArray().let { bytes ->
ByteArray(8) {
val index = bytes.size - it - 1
if (index < bytes.size) bytes[index] else 0
if (index < bytes.size && index >= 0) bytes[index] else 0
}
}