handle npe connecting to bitcoin core with wallet functionality disabled

This commit is contained in:
Craig Raw 2025-08-01 07:44:34 +02:00
parent d81b868049
commit 385d173948

View file

@ -149,6 +149,9 @@ public class BitcoindClient {
List<String> loadedWallets; List<String> loadedWallets;
try { try {
loadedWallets = getBitcoindService().listWallets(); loadedWallets = getBitcoindService().listWallets();
if(loadedWallets == null) {
throw new BitcoinRPCException("Wallet support must be enabled in Bitcoin Core");
}
legacyWalletExists = loadedWallets.contains(Bwt.DEFAULT_CORE_WALLET); legacyWalletExists = loadedWallets.contains(Bwt.DEFAULT_CORE_WALLET);
} catch(JsonRpcException e) { } catch(JsonRpcException e) {
if(e.getErrorMessage().getCode() == RPC_METHOD_NOT_FOUND) { if(e.getErrorMessage().getCode() == RPC_METHOD_NOT_FOUND) {