From c2eff6bd9335c0b20dee35e4e0a2fc8b9c345639 Mon Sep 17 00:00:00 2001 From: nicksavers Date: Thu, 9 Oct 2014 17:46:16 +0200 Subject: [PATCH] Fix to read 0x values for storage keys --- .../main/java/org/ethereum/jsontestsuite/AccountState.java | 6 +++++- ...{JSONTestSuiteTest.java => GitHubJSONTestSuiteTest.java} | 0 2 files changed, 5 insertions(+), 1 deletion(-) rename ethereumj-core/src/test/java/org/ethereum/jsontestsuite/{JSONTestSuiteTest.java => GitHubJSONTestSuiteTest.java} (100%) diff --git a/ethereumj-core/src/main/java/org/ethereum/jsontestsuite/AccountState.java b/ethereumj-core/src/main/java/org/ethereum/jsontestsuite/AccountState.java index 2dfc0ec7..9afdcf7f 100644 --- a/ethereumj-core/src/main/java/org/ethereum/jsontestsuite/AccountState.java +++ b/ethereumj-core/src/main/java/org/ethereum/jsontestsuite/AccountState.java @@ -57,7 +57,11 @@ public class AccountState { if (hexVal) { key = new ByteArrayWrapper(Hex.decode(keyS.substring(2))); } else { - byte[] data = ByteUtil.bigIntegerToBytes(new BigInteger(keyS)); + byte[] data; + if (keyS != null && keyS.length() > 2) + data = Hex.decode(keyS); + else + data = new byte[0]; key = new ByteArrayWrapper(data); } diff --git a/ethereumj-core/src/test/java/org/ethereum/jsontestsuite/JSONTestSuiteTest.java b/ethereumj-core/src/test/java/org/ethereum/jsontestsuite/GitHubJSONTestSuiteTest.java similarity index 100% rename from ethereumj-core/src/test/java/org/ethereum/jsontestsuite/JSONTestSuiteTest.java rename to ethereumj-core/src/test/java/org/ethereum/jsontestsuite/GitHubJSONTestSuiteTest.java