From a25b53bd44056d389ea56911cc1ac9e770a5d1a2 Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Tue, 8 Nov 2022 10:36:56 +0200 Subject: [PATCH] add error message when connecting to bitcoin core with a taproot wallet --- src/main/java/com/sparrowwallet/sparrow/net/Bwt.java | 5 +++++ .../java/com/sparrowwallet/sparrow/net/ElectrumServer.java | 2 ++ 2 files changed, 7 insertions(+) diff --git a/src/main/java/com/sparrowwallet/sparrow/net/Bwt.java b/src/main/java/com/sparrowwallet/sparrow/net/Bwt.java index 0725a14e..a259917a 100644 --- a/src/main/java/com/sparrowwallet/sparrow/net/Bwt.java +++ b/src/main/java/com/sparrowwallet/sparrow/net/Bwt.java @@ -6,6 +6,7 @@ import com.google.gson.annotations.SerializedName; import com.sparrowwallet.drongo.KeyPurpose; import com.sparrowwallet.drongo.Network; import com.sparrowwallet.drongo.OutputDescriptor; +import com.sparrowwallet.drongo.protocol.ScriptType; import com.sparrowwallet.drongo.wallet.BlockTransactionHash; import com.sparrowwallet.drongo.wallet.Wallet; import com.sparrowwallet.drongo.wallet.WalletNode; @@ -360,6 +361,10 @@ public class Bwt { if(!useWallets) { Bwt.this.start(notifier); } else { + if(AppServices.get().getOpenWallets().keySet().stream().anyMatch(wallet -> wallet.getScriptType() == ScriptType.P2TR)) { + throw new IllegalStateException("Taproot wallets are not yet supported when connecting to Bitcoin Core"); + } + Bwt.this.start(AppServices.get().getOpenWallets().keySet(), notifier); } diff --git a/src/main/java/com/sparrowwallet/sparrow/net/ElectrumServer.java b/src/main/java/com/sparrowwallet/sparrow/net/ElectrumServer.java index 62e58645..9532c1f6 100644 --- a/src/main/java/com/sparrowwallet/sparrow/net/ElectrumServer.java +++ b/src/main/java/com/sparrowwallet/sparrow/net/ElectrumServer.java @@ -1105,6 +1105,8 @@ public class ElectrumServer { Matcher walletLoadingMatcher = RPC_WALLET_LOADING_PATTERN.matcher(bwtStartException.getMessage()); if(bwtStartException.getMessage().contains("Wallet file not specified")) { throw new ServerException("Bitcoin Core requires Multi-Wallet to be enabled in the Server Preferences"); + } else if(bwtStartException.getMessage().contains("Taproot wallets are not supported")) { + throw new ServerException(bwtStartException.getMessage()); } else if(walletLoadingMatcher.matches() && walletLoadingMatcher.group(1) != null) { throw new ServerException(walletLoadingMatcher.group(1)); }