Detect if DAO full node has no BTC core running

If DAO full mode is used Bitcoin core need to be running. If not an RPC
exception is thrown. We detect that and show a popup with instructions.
This commit is contained in:
Manfred Karrer 2018-12-02 18:12:45 +01:00
parent 7c2d10066f
commit 42e0d410d2
No known key found for this signature in database
GPG Key ID: 401250966A6B2C46

View File

@ -31,6 +31,8 @@ import bisq.network.p2p.P2PService;
import bisq.common.UserThread;
import bisq.common.handlers.ResultHandler;
import com.neemre.btcdcli4j.core.http.HttpLayerException;
import javax.inject.Inject;
import java.util.function.Consumer;
@ -244,8 +246,16 @@ public class FullNode extends BsqNode {
String errorMessage = "An error occurred: Error=" + throwable.toString();
log.error(errorMessage);
if (throwable instanceof BlockNotConnectingException)
if (throwable instanceof BlockNotConnectingException) {
startReOrgFromLastSnapshot();
} else if (throwable instanceof RpcException &&
throwable.getCause() != null &&
throwable.getCause() instanceof HttpLayerException &&
((HttpLayerException) throwable.getCause()).getCode() == 1004004) {
errorMessage = "You have configured Bisq to run as DAO full node but there is not " +
"localhost Bitcoin Core node detected. You need to have Bitcoin Core started and synced before " +
"starting Bisq.";
}
if (errorMessageHandler != null)
errorMessageHandler.handleErrorMessage(errorMessage);