From 0ed5b4ebfc6425d4e911465aef995abfb5bb0b37 Mon Sep 17 00:00:00 2001 From: Chris Beams Date: Tue, 31 Mar 2020 10:36:00 +0200 Subject: [PATCH] Avoid startup failure when bannedSeedNodes arg is empty This commit fixes #4103, where it was demonstrated that a bisq.properties file containing the following entries would cause Bisq to fail at startup: baseCurrencyNetwork=BTC_MAINNET bannedSeedNodes= bannedBtcNodes= bannedPriceRelayNodes=5bmpx76qllutpcyp The source of the problem was that the jOptSimple argument parsing library converts the empty value of bannedSeedNodes to a List of size 1 where the 0th element of the list is an empty string. This empty string was then attempted to be converted into a new NodeAddress, causing a validation error. This conversion happened during Guice wiring, and manifested as a blank white screen appearing as wiring errors often do in Bisq. The fix is simple and surgical. We now filter out any empty string elements before attempting to convert the banned seed node value to a new node address. I have reviewed the other related options, such as bannedPriceRelayNodes and bannedBtcNodes, and they do not cause the problem described above, so no filtering or other changes have been made to the way they work. --- .../core/network/p2p/seed/DefaultSeedNodeRepository.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/bisq/core/network/p2p/seed/DefaultSeedNodeRepository.java b/core/src/main/java/bisq/core/network/p2p/seed/DefaultSeedNodeRepository.java index f526cd0d5e8..ec4f70ef59a 100644 --- a/core/src/main/java/bisq/core/network/p2p/seed/DefaultSeedNodeRepository.java +++ b/core/src/main/java/bisq/core/network/p2p/seed/DefaultSeedNodeRepository.java @@ -81,7 +81,11 @@ private void reload() { }); // filter - cache.removeAll(config.bannedSeedNodes.stream().map(NodeAddress::new).collect(Collectors.toSet())); + cache.removeAll( + config.bannedSeedNodes.stream() + .filter(n -> !n.isEmpty()) + .map(NodeAddress::new) + .collect(Collectors.toSet())); log.info("Seed nodes: {}", cache); } catch (Throwable t) {