mirror of
				https://github.com/Qortal/altcoinj.git
				synced 2025-11-03 22:17:17 +00:00 
			
		
		
		
	PeerGroup: fix a bug that'd leave maxConnections == 0 if setRequiredServices was used without configuring any other discovery (a typical use case).
This commit is contained in:
		@@ -831,14 +831,14 @@ public class PeerGroup implements TransactionBroadcaster {
 | 
			
		||||
    /**
 | 
			
		||||
     * Convenience for connecting only to peers that can serve specific services. It will configure suitable peer
 | 
			
		||||
     * discoveries.
 | 
			
		||||
     * @param services Required services as a bitmask, e.g. {@link VersionMessage#NODE_NETWORK}.
 | 
			
		||||
     * @param requiredServices Required services as a bitmask, e.g. {@link VersionMessage#NODE_NETWORK}.
 | 
			
		||||
     */
 | 
			
		||||
    public void setRequiredServices(long requiredServices) {
 | 
			
		||||
        lock.lock();
 | 
			
		||||
        try {
 | 
			
		||||
            this.requiredServices = requiredServices;
 | 
			
		||||
            peerDiscoverers.clear();
 | 
			
		||||
            peerDiscoverers.add(MultiplexingDiscovery.forServices(params, requiredServices));
 | 
			
		||||
            addPeerDiscovery(MultiplexingDiscovery.forServices(params, requiredServices));
 | 
			
		||||
        } finally {
 | 
			
		||||
            lock.unlock();
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user