Peer: Deprecate a redundant constructor.

This commit is contained in:
Andreas Schildbach 2020-03-04 17:23:51 +01:00
parent 57f53f038c
commit 7d9f109ee1
3 changed files with 6 additions and 14 deletions

View File

@ -175,18 +175,8 @@ public class Peer extends PeerSocketHandler {
}
}, MoreExecutors.directExecutor());
/**
* <p>Construct a peer that reads/writes from the given block chain.</p>
*
* <p>Note that this does <b>NOT</b> make a connection to the given remoteAddress, it only creates a handler for a
* connection. If you want to create a one-off connection, create a Peer and pass it to
* {@link NioClientManager#openConnection(SocketAddress, StreamConnection)}
* or
* {@link NioClient#NioClient(SocketAddress, StreamConnection, int)}.</p>
*
* <p>The remoteAddress provided should match the remote address of the peer which is being connected to, and is
* used to keep track of which peers relayed transactions and offer more descriptive logging.</p>
*/
/** @deprecated Use {@link #Peer(NetworkParameters, VersionMessage, PeerAddress, AbstractBlockChain)}. */
@Deprecated
public Peer(NetworkParameters params, VersionMessage ver, @Nullable AbstractBlockChain chain, PeerAddress remoteAddress) {
this(params, ver, remoteAddress, chain);
}

View File

@ -77,7 +77,8 @@ public class BitcoindComparisonTool {
VersionMessage ver = new VersionMessage(PARAMS, 42);
ver.appendToSubVer("BlockAcceptanceComparisonTool", "1.1", null);
ver.localServices = VersionMessage.NODE_NETWORK;
final Peer bitcoind = new Peer(PARAMS, ver, new BlockChain(PARAMS, new MemoryBlockStore(PARAMS)), new PeerAddress(PARAMS, InetAddress.getLocalHost()));
final Peer bitcoind = new Peer(PARAMS, ver, new PeerAddress(PARAMS, InetAddress.getLocalHost()),
new BlockChain(PARAMS, new MemoryBlockStore(PARAMS)));
Preconditions.checkState(bitcoind.getVersionMessage().hasBlockChain());
final BlockWrapper currentBlock = new BlockWrapper();

View File

@ -81,7 +81,8 @@ public class PrintPeers {
NioClientManager clientManager = new NioClientManager();
for (final InetAddress addr : addrs) {
InetSocketAddress address = new InetSocketAddress(addr, params.getPort());
final Peer peer = new Peer(params, new VersionMessage(params, 0), null, new PeerAddress(params, address));
final Peer peer = new Peer(params, new VersionMessage(params, 0),
new PeerAddress(params, address), null);
final SettableFuture<Void> future = SettableFuture.create();
// Once the connection has completed version handshaking ...
peer.addConnectedEventListener(new PeerConnectedEventListener() {