mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2025-01-27 10:51:09 +00:00
cormorant: report configuration error when both core data folder and user/pass is not specified
This commit is contained in:
parent
bd0aca66b5
commit
db1b55cfa0
2 changed files with 15 additions and 1 deletions
|
@ -0,0 +1,11 @@
|
||||||
|
package com.sparrowwallet.sparrow.net;
|
||||||
|
|
||||||
|
public class ConfigurationException extends RuntimeException {
|
||||||
|
public ConfigurationException(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ConfigurationException(String message, Throwable cause) {
|
||||||
|
super(message, cause);
|
||||||
|
}
|
||||||
|
}
|
|
@ -17,6 +17,7 @@ import com.sparrowwallet.sparrow.event.CormorantScanStatusEvent;
|
||||||
import com.sparrowwallet.sparrow.event.CormorantSyncStatusEvent;
|
import com.sparrowwallet.sparrow.event.CormorantSyncStatusEvent;
|
||||||
import com.sparrowwallet.sparrow.io.Config;
|
import com.sparrowwallet.sparrow.io.Config;
|
||||||
import com.sparrowwallet.sparrow.net.Bwt;
|
import com.sparrowwallet.sparrow.net.Bwt;
|
||||||
|
import com.sparrowwallet.sparrow.net.ConfigurationException;
|
||||||
import com.sparrowwallet.sparrow.net.CoreAuthType;
|
import com.sparrowwallet.sparrow.net.CoreAuthType;
|
||||||
import com.sparrowwallet.sparrow.net.cormorant.Cormorant;
|
import com.sparrowwallet.sparrow.net.cormorant.Cormorant;
|
||||||
import com.sparrowwallet.drongo.address.Address;
|
import com.sparrowwallet.drongo.address.Address;
|
||||||
|
@ -94,8 +95,10 @@ public class BitcoindClient {
|
||||||
Config config = Config.get();
|
Config config = Config.get();
|
||||||
if((config.getCoreAuthType() == CoreAuthType.COOKIE || config.getCoreAuth() == null || config.getCoreAuth().length() < 2) && config.getCoreDataDir() != null) {
|
if((config.getCoreAuthType() == CoreAuthType.COOKIE || config.getCoreAuth() == null || config.getCoreAuth().length() < 2) && config.getCoreDataDir() != null) {
|
||||||
bitcoindTransport = new BitcoindTransport(config.getCoreServer(), CORE_WALLET_NAME, config.getCoreDataDir());
|
bitcoindTransport = new BitcoindTransport(config.getCoreServer(), CORE_WALLET_NAME, config.getCoreDataDir());
|
||||||
} else {
|
} else if(config.getCoreAuth() != null) {
|
||||||
bitcoindTransport = new BitcoindTransport(config.getCoreServer(), CORE_WALLET_NAME, config.getCoreAuth());
|
bitcoindTransport = new BitcoindTransport(config.getCoreServer(), CORE_WALLET_NAME, config.getCoreAuth());
|
||||||
|
} else {
|
||||||
|
throw new ConfigurationException("Bitcoin Core data folder or user and password is required");
|
||||||
}
|
}
|
||||||
|
|
||||||
this.jsonRpcClient = new JsonRpcClient(bitcoindTransport);
|
this.jsonRpcClient = new JsonRpcClient(bitcoindTransport);
|
||||||
|
|
Loading…
Reference in a new issue