Skip to content

Commit

Permalink
add error message when connecting to bitcoin core with a taproot wallet
Browse files Browse the repository at this point in the history
  • Loading branch information
craigraw committed Nov 8, 2022
1 parent 871c503 commit a25b53b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main/java/com/sparrowwallet/sparrow/net/Bwt.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
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;
Expand Down Expand Up @@ -360,6 +361,10 @@ public void onReady() {
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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1105,6 +1105,8 @@ protected FeeRatesUpdatedEvent call() throws ServerException {
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));
}
Expand Down

0 comments on commit a25b53b

Please sign in to comment.