diff --git a/core/src/main/java/org/bitcoinj/base/internal/ByteArray.java b/core/src/main/java/org/bitcoinj/base/internal/ByteArray.java index 5a6c47335..46b18000c 100644 --- a/core/src/main/java/org/bitcoinj/base/internal/ByteArray.java +++ b/core/src/main/java/org/bitcoinj/base/internal/ByteArray.java @@ -38,7 +38,9 @@ public class ByteArray implements Comparable { * @return the key bytes */ public byte[] bytes() { - return bytes; + byte[] copy = new byte[bytes.length]; + System.arraycopy(bytes, 0, copy, 0, bytes.length); + return copy; } /**