/** * Sets information that identifies this software to remote nodes. This is a convenience wrapper for creating * a new {@link VersionMessage}, calling {@link VersionMessage#appendToSubVer(String, String, String)} on it, * and then calling {@link PeerGroup#setVersionMessage(VersionMessage)} on the result of that. See the docs for * {@link VersionMessage#appendToSubVer(String, String, String)} for information on what the fields should contain. */ public void setUserAgent(String name, String version) { setUserAgent(name, version, null); }
/** * Sets information that identifies this software to remote nodes. This is a convenience wrapper for creating * a new {@link VersionMessage}, calling {@link VersionMessage#appendToSubVer(String, String, String)} on it, * and then calling {@link PeerGroup#setVersionMessage(VersionMessage)} on the result of that. See the docs for * {@link VersionMessage#appendToSubVer(String, String, String)} for information on what the fields should contain. */ public void setUserAgent(String name, String version) { setUserAgent(name, version, null); }
/** * Sets information that identifies this software to remote nodes. This is a convenience wrapper for creating * a new {@link VersionMessage}, calling {@link VersionMessage#appendToSubVer(String, String, String)} on it, * and then calling {@link PeerGroup#setVersionMessage(VersionMessage)} on the result of that. See the docs for * {@link VersionMessage#appendToSubVer(String, String, String)} for information on what the fields should contain. */ public void setUserAgent(String name, String version) { setUserAgent(name, version, null); }
/** * Sets information that identifies this software to remote nodes. This is a convenience wrapper for creating * a new {@link VersionMessage}, calling {@link VersionMessage#appendToSubVer(String, String, String)} on it, * and then calling {@link PeerGroup#setVersionMessage(VersionMessage)} on the result of that. See the docs for * {@link VersionMessage#appendToSubVer(String, String, String)} for information on what the fields should contain. */ public void setUserAgent(String name, String version) { setUserAgent(name, version, null); }
@Inject public PeerGroupService(NetworkParameters params, PeerDiscovery peerDiscovery) { this.netParams = params; this.peerGroup = new PeerGroup(params); peerGroup.setUserAgent(userAgentName, appVersion); peerGroup.addPeerDiscovery(peerDiscovery); }
peerGroup.setDownloadTxDependencies(false); peerGroup.setUserAgent("TestWallet", "0.0.1");
vPeerGroup = createPeerGroup(); if (this.userAgent != null) vPeerGroup.setUserAgent(userAgent, version);
vPeerGroup = createPeerGroup(); if (this.userAgent != null) vPeerGroup.setUserAgent(userAgent, version);
vPeerGroup = createPeerGroup(); if (this.userAgent != null) vPeerGroup.setUserAgent(userAgent, version);
vPeerGroup = createPeerGroup(); if (this.userAgent != null) vPeerGroup.setUserAgent(userAgent, version);
peers = new PeerGroup(params, chain); peers.setUserAgent("WalletTool", "1.0"); if (params == RegTestParams.get()) peers.setMinBroadcastConnections(1);
private void setupNetwork() { params = MainNetParams.get(); peerGroup = new PeerGroup(params, null /* no chain */); peerGroup.setUserAgent("PeerMonitor", "1.0"); peerGroup.setMaxConnections(4); peerGroup.addPeerDiscovery(new DnsDiscovery(params)); peerGroup.addConnectedEventListener(new PeerConnectedEventListener() { @Override public void onPeerConnected(final Peer peer, int peerCount) { refreshUI(); lookupReverseDNS(peer); } }); peerGroup.addDisconnectedEventListener(new PeerDisconnectedEventListener() { @Override public void onPeerDisconnected(final Peer peer, int peerCount) { refreshUI(); synchronized (reverseDnsLookups) { reverseDnsLookups.remove(peer); } } }); }
/** * <p>Create a new peer group</p> * * @param wallet the wallet to add to the peer group after construction * @param useFastCatchup True if only block headers from genesis block is required */ private void createNewPeerGroup(Wallet wallet, boolean useFastCatchup) throws TimeoutException { String[] dnsSeeds = new String[]{ /* "seed.bitcoin.sipa.be", // Pieter Wuille - not reachable */ "dnsseed.bluematt.me", // Matt Corallo "dnsseed.bitcoin.dashjr.org", // Luke Dashjr "seed.bitcoinstats.com", // Chris Decker "seed.bitnodes.io", // Addy Yeow }; log.info("Creating new DNS peer group for '{}'", networkParameters); peerGroup = new PeerGroup(networkParameters, blockChain); peerGroup.addPeerDiscovery(new DnsDiscovery(dnsSeeds, networkParameters)); peerGroup.setConnectTimeoutMillis(CONNECTION_TIMEOUT); peerGroup.setUserAgent( InstallationManager.MBHD_APP_NAME, Configurations.currentConfiguration.getCurrentVersion()); peerGroup.setMaxConnections(MAXIMUM_NUMBER_OF_PEERS); peerGroup.setUseLocalhostPeerWhenPossible(true); peerEventListener = new MultiBitPeerEventListener(); peerGroup.addEventListener(peerEventListener); addWalletToPeerGroup(wallet, useFastCatchup); }
try { PackageInfo packageInfo = getPackageManager().getPackageInfo(getPackageName(), PackageManager.GET_ACTIVITIES); peerGroup.setUserAgent(USER_AGENT, packageInfo.versionName); } catch (PackageManager.NameNotFoundException e) { e.printStackTrace();