fix array out of bound exception
This commit is contained in:
@@ -174,7 +174,7 @@ class EthereumBlockValidator : BlockValidator {
|
|||||||
private fun BigInteger.asUint64() = this.toByteArray().let { bytes ->
|
private fun BigInteger.asUint64() = this.toByteArray().let { bytes ->
|
||||||
ByteArray(8) {
|
ByteArray(8) {
|
||||||
val index = bytes.size - it - 1
|
val index = bytes.size - it - 1
|
||||||
if (index < bytes.size) bytes[index] else 0
|
if (index < bytes.size && index >= 0) bytes[index] else 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user