mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-06-24 14:50:28 -04:00
Increase take offer timeout
This commit is contained in:
parent
565557b251
commit
613c80082a
4 changed files with 20 additions and 6 deletions
|
@ -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
|
// 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):
|
// 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
|
// 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
|
// We have 1333keys: 1333 / (5600 + 1333) = 0.19 -> 19 % 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 ?
|
// After tests I found out that the bandwidth consumption varies widely related to the generated filter.
|
||||||
walletAppKit.setBloomFilterFalsePositiveRate(0.0001);
|
// 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
|
// TODO Get bitcoinj running over our tor proxy. BlockingClientManager need to be used to use the socket
|
||||||
|
|
|
@ -37,7 +37,7 @@ import static io.bitsquare.util.Validator.nonEmptyStringOf;
|
||||||
public class OfferAvailabilityProtocol {
|
public class OfferAvailabilityProtocol {
|
||||||
private static final Logger log = LoggerFactory.getLogger(OfferAvailabilityProtocol.class);
|
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 OfferAvailabilityModel model;
|
||||||
private final ResultHandler resultHandler;
|
private final ResultHandler resultHandler;
|
||||||
|
|
|
@ -308,6 +308,7 @@ public class P2PService implements SetupListener, MessageListener, ConnectionLis
|
||||||
@Override
|
@Override
|
||||||
public void onConnection(Connection connection) {
|
public void onConnection(Connection connection) {
|
||||||
numConnectedPeers.set(networkNode.getAllConnections().size());
|
numConnectedPeers.set(networkNode.getAllConnections().size());
|
||||||
|
//TODO check if still needed and why
|
||||||
UserThread.runAfter(() -> numConnectedPeers.set(networkNode.getAllConnections().size()), 3);
|
UserThread.runAfter(() -> numConnectedPeers.set(networkNode.getAllConnections().size()), 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -315,6 +316,7 @@ public class P2PService implements SetupListener, MessageListener, ConnectionLis
|
||||||
public void onDisconnect(CloseConnectionReason closeConnectionReason, Connection connection) {
|
public void onDisconnect(CloseConnectionReason closeConnectionReason, Connection connection) {
|
||||||
Log.traceCall();
|
Log.traceCall();
|
||||||
numConnectedPeers.set(networkNode.getAllConnections().size());
|
numConnectedPeers.set(networkNode.getAllConnections().size());
|
||||||
|
//TODO check if still needed and why
|
||||||
UserThread.runAfter(() -> numConnectedPeers.set(networkNode.getAllConnections().size()), 3);
|
UserThread.runAfter(() -> numConnectedPeers.set(networkNode.getAllConnections().size()), 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -518,7 +520,7 @@ public class P2PService implements SetupListener, MessageListener, ConnectionLis
|
||||||
} catch (CryptoException e) {
|
} catch (CryptoException e) {
|
||||||
log.error("sendEncryptedMessage failed");
|
log.error("sendEncryptedMessage failed");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
sendMailboxMessageListener.onFault("Data already exist in our local database");
|
sendMailboxMessageListener.onFault("sendEncryptedMailboxMessage failed " + e);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
sendMailboxMessageListener.onFault("There are no P2P network nodes connected. " +
|
sendMailboxMessageListener.onFault("There are no P2P network nodes connected. " +
|
||||||
|
@ -566,6 +568,7 @@ public class P2PService implements SetupListener, MessageListener, ConnectionLis
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBroadcastFailed(String errorMessage) {
|
public void onBroadcastFailed(String errorMessage) {
|
||||||
|
//sendMailboxMessageListener.onFault("Broadcast completed without any successful broadcast");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
boolean result = p2PDataStorage.add(protectedMailboxStorageEntry, networkNode.getNodeAddress(), listener, true);
|
boolean result = p2PDataStorage.add(protectedMailboxStorageEntry, networkNode.getNodeAddress(), listener, true);
|
||||||
|
|
|
@ -513,7 +513,7 @@ public class PeerManager implements ConnectionListener {
|
||||||
public void handleConnectionFault(NodeAddress nodeAddress, @Nullable Connection connection) {
|
public void handleConnectionFault(NodeAddress nodeAddress, @Nullable Connection connection) {
|
||||||
Log.traceCall("nodeAddress=" + nodeAddress);
|
Log.traceCall("nodeAddress=" + nodeAddress);
|
||||||
boolean doRemovePersistedPeer = false;
|
boolean doRemovePersistedPeer = false;
|
||||||
Peer reportedPeer = removeReportedPeer(nodeAddress);
|
removeReportedPeer(nodeAddress);
|
||||||
Optional<Peer> persistedPeerOptional = getPersistedPeerOptional(nodeAddress);
|
Optional<Peer> persistedPeerOptional = getPersistedPeerOptional(nodeAddress);
|
||||||
if (persistedPeerOptional.isPresent()) {
|
if (persistedPeerOptional.isPresent()) {
|
||||||
Peer persistedPeer = persistedPeerOptional.get();
|
Peer persistedPeer = persistedPeerOptional.get();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue