Skip to content

Commit

Permalink
VM: update DataWord#getData() method
Browse files Browse the repository at this point in the history
  • Loading branch information
semux committed Aug 18, 2018
1 parent dcb7c49 commit 450af72
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
10 changes: 7 additions & 3 deletions src/main/java/org/ethereum/vm/DataWord.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
/**
* DataWord is the 32-byte array representation of a 256-bit number.
*
* NOTE: the underlying byte array is shared across dataword and should not be
* modified anywhere
* @ImplNote DataWord objects are immutable.
*/
public class DataWord implements Comparable<DataWord> {

Expand Down Expand Up @@ -73,8 +72,13 @@ public DataWord(byte[] data) {
}
}

/**
* Returns a clone of the underlying byte array.
*
* @return a byte array
*/
public byte[] getData() {
return data;
return data.clone();
}

public byte[] getLast20Bytes() {
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/org/ethereum/vm/LogInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("[");
for (DataWord topic : topics) {
String topicStr = HexUtil.toHexString(topic.getData());
sb.append(topicStr).append(" ");
sb.append(topic.toString()).append(" ");
}
sb.append("]");

Expand Down

0 comments on commit 450af72

Please sign in to comment.