|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.google.bitcoin.core.Peer
public class Peer
A Peer handles the high level communication with a BitCoin node. It requires a NetworkConnection to be set up for it. After that it takes ownership of the connection, creates and manages its own thread used for communication with the network. All these threads synchronize on the block chain.
Constructor Summary | |
---|---|
Peer(NetworkParameters params,
NetworkConnection conn,
BlockChain blockChain)
Construct a peer that handles the given network connection and reads/writes from the given block chain. |
Method Summary | |
---|---|
void |
disconnect()
Terminates the network connection and stops the background thread. |
Future<Block> |
getBlock(byte[] blockHash)
Asks the connected peer for the block of the given hash, and returns a Future representing the answer. |
void |
start()
Starts the background thread that processes messages. |
CountDownLatch |
startBlockChainDownload()
Starts an asynchronous download of the block chain. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Peer(NetworkParameters params, NetworkConnection conn, BlockChain blockChain)
Method Detail |
---|
public void start()
public Future<Block> getBlock(byte[] blockHash) throws IOException
blockHash
- Hash of the block you wareare requesting.
IOException
public CountDownLatch startBlockChainDownload() throws IOException
CountDownLatch
that can be used to track progress and wait for completion.
IOException
public void disconnect()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |