3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-02-07 23:03:04 +00:00

Minor comments improvements in Message, EmptyMessage and NetworkParameters.

This commit is contained in:
Piotr Włodarek 2014-05-29 17:25:46 +02:00 committed by Mike Hearn
parent 422053cfec
commit a95c2ed826
3 changed files with 6 additions and 9 deletions

View File

@ -20,9 +20,7 @@ import java.io.OutputStream;
/** /**
* Parent class for header only messages that don't have a payload. * 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 * Currently this includes getaddr, verack and special bitcoinj class UnknownMessage.
*
* @author git
*/ */
public abstract class EmptyMessage extends Message { public abstract class EmptyMessage extends Message {
private static final long serialVersionUID = 8240801253854151802L; private static final long serialVersionUID = 8240801253854151802L;

View File

@ -34,7 +34,7 @@ public abstract class Message implements Serializable {
private static final Logger log = LoggerFactory.getLogger(Message.class); private static final Logger log = LoggerFactory.getLogger(Message.class);
private static final long serialVersionUID = -3561053461717079135L; 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; 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 * as the length will be provided as part of the header. If unknown then set to Message.UNKNOWN_LENGTH
* @throws ProtocolException * @throws ProtocolException
*/ */
Message(NetworkParameters params, byte[] msg, int offset, int protocolVersion, final boolean parseLazy, Message(NetworkParameters params, byte[] msg, int offset, int protocolVersion, boolean parseLazy, boolean parseRetain, int length) throws ProtocolException {
final boolean parseRetain, int length) throws ProtocolException {
this.parseLazy = parseLazy; this.parseLazy = parseLazy;
this.parseRetain = parseRetain; this.parseRetain = parseRetain;
this.protocolVersion = protocolVersion; this.protocolVersion = protocolVersion;
@ -146,7 +145,7 @@ public abstract class Message implements Serializable {
this(params, msg, offset, NetworkParameters.PROTOCOL_VERSION, false, false, UNKNOWN_LENGTH); 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); 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. * 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. * into the constructor.
* <p/> * <p/>
* Implementations should adhere to the following contract: If parseLazy = true the 'length' * Implementations should adhere to the following contract: If parseLazy = true the 'length'

View File

@ -67,7 +67,7 @@ public abstract class NetworkParameters implements Serializable {
protected Block genesisBlock; protected Block genesisBlock;
protected BigInteger maxTarget; protected BigInteger maxTarget;
protected int port; 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 addressHeader;
protected int p2shHeader; protected int p2shHeader;
protected int dumpedPrivateKeyHeader; protected int dumpedPrivateKeyHeader;