State dump

+ storage dump fix
This commit is contained in:
romanman 2014-06-26 20:47:32 +01:00
parent 509f0d6ed7
commit 69819d79fe
2 changed files with 18 additions and 2 deletions

View File

@ -27,7 +27,8 @@ public class JSONHelper {
Map outMap = new LinkedHashMap();
for (DataWord key : storageKeys){
outMap.put(key.getNoLeadZeroesData(), storageMap.get(key).getNoLeadZeroesData());
outMap.put(Hex.toHexString(key.getNoLeadZeroesData()),
Hex.toHexString(storageMap.get(key).getNoLeadZeroesData()));
}
String mapString = JSONValue.toJSONString(outMap);

View File

@ -1,11 +1,13 @@
package org.ethereum.vm;
import org.ethereum.util.ByteUtil;
import org.ethereum.util.FastByteComparisons;
import org.spongycastle.util.Arrays;
import org.spongycastle.util.encoders.Hex;
import java.math.BigInteger;
import java.nio.ByteBuffer;
import java.util.Comparator;
/**
* DataWord is the 32-byte array representation of a 256-bit number
@ -15,7 +17,7 @@ import java.nio.ByteBuffer;
* @author: Roman Mandeleil
* Created on: 01/06/2014 10:45
*/
public class DataWord {
public class DataWord implements Comparable<DataWord>{
public static final DataWord ZERO = new DataWord(new byte[32]); // don't push it in to the stack
@ -289,4 +291,17 @@ public class DataWord {
public int hashCode() {
return java.util.Arrays.hashCode(data);
}
@Override
public int compareTo(DataWord o) {
if (o == null || o.getData() == null) return -1;
return FastByteComparisons.compareTo(
data, 0, data.length,
o.getData(), 0, o.getData().length);
}
}