diff --git a/ethereumj-core/src/main/java/org/ethereum/util/RLP.java b/ethereumj-core/src/main/java/org/ethereum/util/RLP.java index 3af7befe..0a94942d 100644 --- a/ethereumj-core/src/main/java/org/ethereum/util/RLP.java +++ b/ethereumj-core/src/main/java/org/ethereum/util/RLP.java @@ -745,10 +745,10 @@ public class RLP { return new byte[] { firstByte }; } else if (length < MAX_ITEM_LENGTH) { byte[] binaryLength; - if(length < 0xFF) - binaryLength = new byte[] { (byte) length }; - else + if(length > 0xFF) binaryLength = BigInteger.valueOf(length).toByteArray(); + else + binaryLength = new byte[] { (byte) length }; byte firstByte = (byte) (binaryLength.length + offset + SIZE_THRESHOLD - 1 ); return concatenate(new byte[] { firstByte }, binaryLength); } else {