From a95c2ed82677715d811ceb0963fdf9cfc12a0261 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20W=C5=82odarek?= Date: Thu, 29 May 2014 17:25:46 +0200 Subject: [PATCH] Minor comments improvements in Message, EmptyMessage and NetworkParameters. --- .../main/java/com/google/bitcoin/core/EmptyMessage.java | 4 +--- core/src/main/java/com/google/bitcoin/core/Message.java | 9 ++++----- .../java/com/google/bitcoin/core/NetworkParameters.java | 2 +- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/core/src/main/java/com/google/bitcoin/core/EmptyMessage.java b/core/src/main/java/com/google/bitcoin/core/EmptyMessage.java index 489579d7..fbfa85c0 100644 --- a/core/src/main/java/com/google/bitcoin/core/EmptyMessage.java +++ b/core/src/main/java/com/google/bitcoin/core/EmptyMessage.java @@ -20,9 +20,7 @@ import java.io.OutputStream; /** * Parent class for header only messages that don't have a payload. - * Currently this includes getaddr, ping, verack as well as the special bitcoinj class UnknownMessage - * - * @author git + * Currently this includes getaddr, verack and special bitcoinj class UnknownMessage. */ public abstract class EmptyMessage extends Message { private static final long serialVersionUID = 8240801253854151802L; diff --git a/core/src/main/java/com/google/bitcoin/core/Message.java b/core/src/main/java/com/google/bitcoin/core/Message.java index 7bb4ee84..0300a2d8 100644 --- a/core/src/main/java/com/google/bitcoin/core/Message.java +++ b/core/src/main/java/com/google/bitcoin/core/Message.java @@ -34,7 +34,7 @@ public abstract class Message implements Serializable { private static final Logger log = LoggerFactory.getLogger(Message.class); private static final long serialVersionUID = -3561053461717079135L; - public static final int MAX_SIZE = 0x02000000; + public static final int MAX_SIZE = 0x02000000; // 32MB public static final int UNKNOWN_LENGTH = Integer.MIN_VALUE; @@ -98,8 +98,7 @@ public abstract class Message implements Serializable { * as the length will be provided as part of the header. If unknown then set to Message.UNKNOWN_LENGTH * @throws ProtocolException */ - Message(NetworkParameters params, byte[] msg, int offset, int protocolVersion, final boolean parseLazy, - final boolean parseRetain, int length) throws ProtocolException { + Message(NetworkParameters params, byte[] msg, int offset, int protocolVersion, boolean parseLazy, boolean parseRetain, int length) throws ProtocolException { this.parseLazy = parseLazy; this.parseRetain = parseRetain; this.protocolVersion = protocolVersion; @@ -146,7 +145,7 @@ public abstract class Message implements Serializable { this(params, msg, offset, NetworkParameters.PROTOCOL_VERSION, false, false, UNKNOWN_LENGTH); } - Message(NetworkParameters params, byte[] msg, int offset, final boolean parseLazy, final boolean parseRetain, int length) throws ProtocolException { + Message(NetworkParameters params, byte[] msg, int offset, boolean parseLazy, boolean parseRetain, int length) throws ProtocolException { this(params, msg, offset, NetworkParameters.PROTOCOL_VERSION, parseLazy, parseRetain, length); } @@ -158,7 +157,7 @@ public abstract class Message implements Serializable { /** * Perform the most minimal parse possible to calculate the length of the message. - * This is only required for subclasses of ChildClass as root level messages will have their length passed + * This is only required for subclasses of ChildMessage as root level messages will have their length passed * into the constructor. *

* Implementations should adhere to the following contract: If parseLazy = true the 'length' diff --git a/core/src/main/java/com/google/bitcoin/core/NetworkParameters.java b/core/src/main/java/com/google/bitcoin/core/NetworkParameters.java index 202494a8..0182eb1f 100644 --- a/core/src/main/java/com/google/bitcoin/core/NetworkParameters.java +++ b/core/src/main/java/com/google/bitcoin/core/NetworkParameters.java @@ -67,7 +67,7 @@ public abstract class NetworkParameters implements Serializable { protected Block genesisBlock; protected BigInteger maxTarget; protected int port; - protected long packetMagic; + protected long packetMagic; // Indicates message origin network and is used to seek to the next message when stream state is unknown. protected int addressHeader; protected int p2shHeader; protected int dumpedPrivateKeyHeader;