Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Give LocalBitcoinNode a timeout in case BitcoinJ hangs during handshake attempt #4058

Merged
merged 2 commits into from Mar 14, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions core/src/main/java/bisq/core/btc/nodes/LocalBitcoinNode.java
Expand Up @@ -249,13 +249,13 @@ private Optional<VersionMessage> attemptHandshakeForVersionMessage() {
try {
var peerVersionMessage = peerVersionMessageFuture.get(HANDSHAKE_TIMEOUT, TimeUnit.MILLISECONDS);
optionalPeerVersionMessage = Optional.of(peerVersionMessage);
} catch (ExecutionException | InterruptedException | CancellationException | TimeoutException ex) {
} catch (ExecutionException | InterruptedException | CancellationException ex) {
optionalPeerVersionMessage = Optional.empty();
if (ex instanceof TimeoutException) {
log.error("Exploratory handshake attempt with a local Bitcoin node (that may not be there)" +
" unexpectedly timed out. This should never happen; please report this. HANDSHAKE_TIMEOUT" +
" is {} ms. Continuing as if a local BTC node was not found.", HANDSHAKE_TIMEOUT);
}
} catch (TimeoutException ex) {
optionalPeerVersionMessage = Optional.empty();
log.error("Exploratory handshake attempt with a local Bitcoin node (that may not be there)" +
" unexpectedly timed out. This should never happen; please report this. HANDSHAKE_TIMEOUT" +
" is {} ms. Continuing as if a local BTC node was not found.", HANDSHAKE_TIMEOUT);
}

peer.close();
Expand Down