cormorant: report configuration error when both core data folder and user/pass is not specified

This commit is contained in:
Craig Raw 2025-01-14 15:12:39 +02:00
parent bd0aca66b5
commit db1b55cfa0
2 changed files with 15 additions and 1 deletions

View file

@ -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);
}
}

View file

@ -17,6 +17,7 @@ import com.sparrowwallet.sparrow.event.CormorantScanStatusEvent;
import com.sparrowwallet.sparrow.event.CormorantSyncStatusEvent;
import com.sparrowwallet.sparrow.io.Config;
import com.sparrowwallet.sparrow.net.Bwt;
import com.sparrowwallet.sparrow.net.ConfigurationException;
import com.sparrowwallet.sparrow.net.CoreAuthType;
import com.sparrowwallet.sparrow.net.cormorant.Cormorant;
import com.sparrowwallet.drongo.address.Address;
@ -94,8 +95,10 @@ public class BitcoindClient {
Config config = Config.get();
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());
} else {
} else if(config.getCoreAuth() != null) {
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);