com.google.bitcoin.core
Class VersionMessage

java.lang.Object
  extended by com.google.bitcoin.core.Message
      extended by com.google.bitcoin.core.VersionMessage
All Implemented Interfaces:
Serializable

public class VersionMessage
extends Message

See Also:
Serialized Form

Field Summary
 long bestHeight
          How many blocks are in the chain, according to the other side.
 int clientVersion
          The version number of the protocol spoken.
 long localServices
          Flags defining what is supported.
 PeerAddress myAddr
          What the other side believes the address of this program is.
static int NODE_NETWORK
          A services flag that denotes whether the peer has a copy of the block chain or not.
 String subVer
          An additional string that today the official client sets to the empty string.
 PeerAddress theirAddr
          What the other side believes their own address is.
 long time
          What the other side believes the current time to be, in seconds.
 
Fields inherited from class com.google.bitcoin.core.Message
bytes, cursor, MAX_SIZE, offset, params, protocolVersion
 
Constructor Summary
VersionMessage(NetworkParameters params, byte[] msg)
           
VersionMessage(NetworkParameters params, int newBestHeight)
           
 
Method Summary
 void bitcoinSerializeToStream(OutputStream buf)
          Serializes this message to the provided stream.
 boolean hasBlockChain()
          Returns true if the version message indicates the sender has a full copy of the block chain, or if it's running in client mode (only has the headers).
 void parse()
           
 
Methods inherited from class com.google.bitcoin.core.Message
bitcoinSerialize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NODE_NETWORK

public static final int NODE_NETWORK
A services flag that denotes whether the peer has a copy of the block chain or not.

See Also:
Constant Field Values

clientVersion

public int clientVersion
The version number of the protocol spoken.


localServices

public long localServices
Flags defining what is supported. Right now NODE_NETWORK is the only flag defined.


time

public long time
What the other side believes the current time to be, in seconds.


myAddr

public PeerAddress myAddr
What the other side believes the address of this program is. Not used.


theirAddr

public PeerAddress theirAddr
What the other side believes their own address is. Not used.


subVer

public String subVer
An additional string that today the official client sets to the empty string. We treat it as something like an HTTP User-Agent header.


bestHeight

public long bestHeight
How many blocks are in the chain, according to the other side.

Constructor Detail

VersionMessage

public VersionMessage(NetworkParameters params,
                      byte[] msg)
               throws ProtocolException
Throws:
ProtocolException

VersionMessage

public VersionMessage(NetworkParameters params,
                      int newBestHeight)
Method Detail

parse

public void parse()
           throws ProtocolException
Throws:
ProtocolException

bitcoinSerializeToStream

public void bitcoinSerializeToStream(OutputStream buf)
                              throws IOException
Description copied from class: Message
Serializes this message to the provided stream. If you just want the raw bytes use bitcoinSerialize().

Throws:
IOException

hasBlockChain

public boolean hasBlockChain()
Returns true if the version message indicates the sender has a full copy of the block chain, or if it's running in client mode (only has the headers).



Copyright © 2011. All Rights Reserved.