diff --git a/core/src/main/java/io/bitsquare/btc/WalletService.java b/core/src/main/java/io/bitsquare/btc/WalletService.java index 913f527a63..c13956e582 100644 --- a/core/src/main/java/io/bitsquare/btc/WalletService.java +++ b/core/src/main/java/io/bitsquare/btc/WalletService.java @@ -231,10 +231,21 @@ public class WalletService { // Calculation is derived from: https://www.reddit.com/r/Bitcoin/comments/2vrx6n/privacy_in_bitcoinj_android_wallet_multibit_hive/coknjuz // Nr of false positives (56M keys in the blockchain): + // First attempt for FP rate: // FP rate = 0,0001; Nr of false positives: 0,0001 * 56 000 000 = 5600 - // We have 1333keys: 1333 / 5600 = 0.23 -> 23 % probability that a pub key is in our wallet - // With higher fp rate values it fails to download the svp chain - seems it triggers Bitcoins DDoS protection ? - walletAppKit.setBloomFilterFalsePositiveRate(0.0001); + // We have 1333keys: 1333 / (5600 + 1333) = 0.19 -> 19 % probability that a pub key is in our wallet + // After tests I found out that the bandwidth consumption varies widely related to the generated filter. + // About 20- 40 MB for upload and 30-130 MB for download at first start up (spv chain). + // Afterwards its about 1 MB for upload and 20-80 MB for download. + // Probably better then a high FP rate would be to include foreign pubKeyHashes which are tested to not be used + // in many transactions. If we had a pool of 100 000 such keys (2 MB data dump) to random select 4000 we could mix it with our + // 1000 own keys and get a similar probability rate as with the current setup but less variation in bandwidth + // consumption. + + // For now to reduce risks with high bandwidth consumption we reduce the FP rate by half. + // FP rate = 0,00005; Nr of false positives: 0,00005 * 56 000 000 = 2800 + // 1333 / (2800 + 1333) = 0.32 -> 32 % probability that a pub key is in our wallet + walletAppKit.setBloomFilterFalsePositiveRate(0.00005); // TODO Get bitcoinj running over our tor proxy. BlockingClientManager need to be used to use the socket diff --git a/core/src/main/java/io/bitsquare/trade/protocol/availability/OfferAvailabilityProtocol.java b/core/src/main/java/io/bitsquare/trade/protocol/availability/OfferAvailabilityProtocol.java index 137772c29a..20202167f1 100644 --- a/core/src/main/java/io/bitsquare/trade/protocol/availability/OfferAvailabilityProtocol.java +++ b/core/src/main/java/io/bitsquare/trade/protocol/availability/OfferAvailabilityProtocol.java @@ -37,7 +37,7 @@ import static io.bitsquare.util.Validator.nonEmptyStringOf; public class OfferAvailabilityProtocol { private static final Logger log = LoggerFactory.getLogger(OfferAvailabilityProtocol.class); - private static final long TIMEOUT_SEC = 20; + private static final long TIMEOUT_SEC = 30; private final OfferAvailabilityModel model; private final ResultHandler resultHandler; diff --git a/gui/src/main/java/io/bitsquare/gui/main/offer/createoffer/CreateOfferViewModel.java b/gui/src/main/java/io/bitsquare/gui/main/offer/createoffer/CreateOfferViewModel.java index 710bc15dc7..edb39ef403 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/offer/createoffer/CreateOfferViewModel.java +++ b/gui/src/main/java/io/bitsquare/gui/main/offer/createoffer/CreateOfferViewModel.java @@ -248,7 +248,7 @@ class CreateOfferViewModel extends ActivatableWithDataModel numConnectedPeers.set(networkNode.getAllConnections().size()), 3); } @@ -315,6 +316,7 @@ public class P2PService implements SetupListener, MessageListener, ConnectionLis public void onDisconnect(CloseConnectionReason closeConnectionReason, Connection connection) { Log.traceCall(); numConnectedPeers.set(networkNode.getAllConnections().size()); + //TODO check if still needed and why UserThread.runAfter(() -> numConnectedPeers.set(networkNode.getAllConnections().size()), 3); } @@ -518,7 +520,7 @@ public class P2PService implements SetupListener, MessageListener, ConnectionLis } catch (CryptoException e) { log.error("sendEncryptedMessage failed"); e.printStackTrace(); - sendMailboxMessageListener.onFault("Data already exist in our local database"); + sendMailboxMessageListener.onFault("sendEncryptedMailboxMessage failed " + e); } } else { sendMailboxMessageListener.onFault("There are no P2P network nodes connected. " + @@ -566,6 +568,7 @@ public class P2PService implements SetupListener, MessageListener, ConnectionLis @Override public void onBroadcastFailed(String errorMessage) { + //sendMailboxMessageListener.onFault("Broadcast completed without any successful broadcast"); } }; boolean result = p2PDataStorage.add(protectedMailboxStorageEntry, networkNode.getNodeAddress(), listener, true); diff --git a/network/src/main/java/io/bitsquare/p2p/peers/PeerManager.java b/network/src/main/java/io/bitsquare/p2p/peers/PeerManager.java index eeafda7901..9649fc4b56 100644 --- a/network/src/main/java/io/bitsquare/p2p/peers/PeerManager.java +++ b/network/src/main/java/io/bitsquare/p2p/peers/PeerManager.java @@ -513,7 +513,7 @@ public class PeerManager implements ConnectionListener { public void handleConnectionFault(NodeAddress nodeAddress, @Nullable Connection connection) { Log.traceCall("nodeAddress=" + nodeAddress); boolean doRemovePersistedPeer = false; - Peer reportedPeer = removeReportedPeer(nodeAddress); + removeReportedPeer(nodeAddress); Optional persistedPeerOptional = getPersistedPeerOptional(nodeAddress); if (persistedPeerOptional.isPresent()) { Peer persistedPeer = persistedPeerOptional.get();