ForwardingService: limit the number of peer connections required

Nowadays on testnet or signet it takes a long time to discover enough bloom-enabled peers.
This commit is contained in:
Andreas Schildbach 2022-07-17 19:42:57 +02:00
parent 50f46651b4
commit 691cd46267

View file

@ -42,6 +42,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
public class ForwardingService {
static final String usage = "Usage: address-to-send-back-to [mainnet|testnet|signet|regtest]";
static final int requiredConfirmations = 1;
static final int MAX_CONNECTIONS = 4;
private final BitcoinNetwork network;
private final Address forwardingAddress;
private final WalletAppKit kit;
@ -118,6 +119,7 @@ public class ForwardingService {
// Download the blockchain and wait until it's done.
kit.startAsync();
kit.awaitRunning();
kit.peerGroup().setMaxConnections(MAX_CONNECTIONS);
}
/**