mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-12 02:05:53 +00:00
BitCoin -> Bitcoin. Add a Peer c'tor that lets you specify useragent instead of a full VersionMessage.
This commit is contained in:
parent
f018e2956e
commit
6a2139f681
@ -32,7 +32,7 @@ import java.util.*;
|
|||||||
import java.util.concurrent.*;
|
import java.util.concurrent.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Peer handles the high level communication with a BitCoin node.
|
* A Peer handles the high level communication with a Bitcoin node.
|
||||||
*
|
*
|
||||||
* <p>{@link Peer#getHandler()} is part of a Netty Pipeline with a Bitcoin serializer downstream of it.
|
* <p>{@link Peer#getHandler()} is part of a Netty Pipeline with a Bitcoin serializer downstream of it.
|
||||||
*/
|
*/
|
||||||
@ -91,6 +91,16 @@ public class Peer {
|
|||||||
this.handler = new PeerHandler();
|
this.handler = new PeerHandler();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct a peer that reads/writes from the given chain. Automatically creates a VersionMessage for you from the
|
||||||
|
* given software name/version strings, which should be something like "MySimpleTool", "1.0"
|
||||||
|
*/
|
||||||
|
public Peer(NetworkParameters params, BlockChain blockChain, String thisSoftwareName, String thisSoftwareVersion) {
|
||||||
|
this(params, blockChain, null);
|
||||||
|
this.versionMessage = new VersionMessage(params, blockChain.getBestChainHeight());
|
||||||
|
this.versionMessage.appendToSubVer(thisSoftwareName, thisSoftwareVersion, null);
|
||||||
|
}
|
||||||
|
|
||||||
public synchronized void addEventListener(PeerEventListener listener) {
|
public synchronized void addEventListener(PeerEventListener listener) {
|
||||||
eventListeners.add(listener);
|
eventListeners.add(listener);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user