From 662f341ad3bfe729cee26689521bc69165a9f325 Mon Sep 17 00:00:00 2001 From: nicksavers Date: Thu, 15 May 2014 14:12:58 +0200 Subject: [PATCH] Fix for encodeLength() fix --- ethereumj-core/src/main/java/org/ethereum/util/RLP.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 {