From a22cc7f69893f977e68477e4bca34fbbef1e7178 Mon Sep 17 00:00:00 2001 From: Mike Rosseel Date: Thu, 28 Nov 2013 17:32:19 +0100 Subject: [PATCH] mark didn't really make a mark --- .../java/com/google/bitcoin/core/BitcoinSerializer.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/core/src/main/java/com/google/bitcoin/core/BitcoinSerializer.java b/core/src/main/java/com/google/bitcoin/core/BitcoinSerializer.java index 54009048..0d85e049 100644 --- a/core/src/main/java/com/google/bitcoin/core/BitcoinSerializer.java +++ b/core/src/main/java/com/google/bitcoin/core/BitcoinSerializer.java @@ -293,16 +293,15 @@ public class BitcoinSerializer { // The command is a NULL terminated string, unless the command fills all twelve bytes // in which case the termination is implicit. - int mark = cursor; - for (; header[cursor] != 0 && cursor - mark < COMMAND_LEN; cursor++) ; - byte[] commandBytes = new byte[cursor - mark]; - System.arraycopy(header, mark, commandBytes, 0, cursor - mark); + for (; header[cursor] != 0 && cursor < COMMAND_LEN; cursor++) ; + byte[] commandBytes = new byte[cursor]; + System.arraycopy(header, 0, commandBytes, 0, cursor); try { command = new String(commandBytes, "US-ASCII"); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); // Cannot happen. } - cursor = mark + COMMAND_LEN; + cursor = COMMAND_LEN; size = (int) readUint32(header, cursor); cursor += 4;