setAddPeersFromAddressMessage

This commit is contained in:
Manfred Karrer 2017-03-17 00:44:32 -05:00
parent 60c1394b22
commit 524a176305
2 changed files with 16 additions and 7 deletions

View File

@ -152,7 +152,13 @@ public class WalletsSetup {
//We are here in the btcj thread Thread[ STARTING,5,main]
super.onSetupCompleted();
walletConfig.peerGroup().addEventListener(new PeerEventListener() {
final PeerGroup peerGroup = walletConfig.peerGroup();
// We don't want to get our node white list polluted with nodes from AddressMessage calls.
if (preferences.getBitcoinNodes() != null && !preferences.getBitcoinNodes().isEmpty())
peerGroup.setAddPeersFromAddressMessage(false);
peerGroup.addEventListener(new PeerEventListener() {
@Override
public void onPeersDiscovered(Set<PeerAddress> peerAddresses) {
}
@ -169,14 +175,14 @@ public class WalletsSetup {
public void onPeerConnected(Peer peer, int peerCount) {
// We get called here on our user thread
numPeers.set(peerCount);
connectedPeers.set(walletConfig.peerGroup().getConnectedPeers());
connectedPeers.set(peerGroup.getConnectedPeers());
}
@Override
public void onPeerDisconnected(Peer peer, int peerCount) {
// We get called here on our user thread
numPeers.set(peerCount);
connectedPeers.set(walletConfig.peerGroup().getConnectedPeers());
connectedPeers.set(peerGroup.getConnectedPeers());
}
@Override

View File

@ -315,9 +315,6 @@ public final class Preferences implements Persistable {
if (btcNodesFromOptions != null && !btcNodesFromOptions.isEmpty())
setBitcoinNodes(btcNodesFromOptions);
if (bitcoinNodes.equals("127.0.0.1") || bitcoinNodes.equals("localhost"))
setUseTorForBitcoinJ(false);
}
public void dontShowAgain(String key, boolean dontShowAgain) {
@ -603,7 +600,13 @@ public final class Preferences implements Persistable {
}
public boolean getUseTorForBitcoinJ() {
return useTorForBitcoinJ;
// We override the useTorForBitcoinJ and set to false if we have bitcoinNodes set
// Atm we don't support onion addresses there
// This check includes localhost, so we also override useTorForBitcoinJ
if (bitcoinNodes != null && !bitcoinNodes.isEmpty())
return false;
else
return useTorForBitcoinJ;
}
public boolean getShowOwnOffersInOfferBook() {