From 87cc28e0a47cb2e4cf23badf83785e60c4963367 Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Thu, 9 May 2024 15:44:47 +0200 Subject: [PATCH] improve error message when importing invalid coldcard multisig config --- .../sparrowwallet/sparrow/io/ColdcardMultisig.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/sparrowwallet/sparrow/io/ColdcardMultisig.java b/src/main/java/com/sparrowwallet/sparrow/io/ColdcardMultisig.java index ccd4ee36..11b633d4 100644 --- a/src/main/java/com/sparrowwallet/sparrow/io/ColdcardMultisig.java +++ b/src/main/java/com/sparrowwallet/sparrow/io/ColdcardMultisig.java @@ -7,10 +7,7 @@ import com.sparrowwallet.drongo.policy.Policy; import com.sparrowwallet.drongo.policy.PolicyType; import com.sparrowwallet.drongo.protocol.ScriptType; -import com.sparrowwallet.drongo.wallet.Keystore; -import com.sparrowwallet.drongo.wallet.KeystoreSource; -import com.sparrowwallet.drongo.wallet.Wallet; -import com.sparrowwallet.drongo.wallet.WalletModel; +import com.sparrowwallet.drongo.wallet.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -174,8 +171,10 @@ public Wallet importWallet(InputStream inputStream, String password) throws Impo wallet.setDefaultPolicy(policy); wallet.setScriptType(scriptType); - if(!wallet.isValid()) { - throw new IllegalStateException("This file does not describe a valid wallet. " + getKeystoreImportDescription()); + try { + wallet.checkWallet(); + } catch(InvalidWalletException e) { + throw new IllegalStateException("This file does not describe a valid wallet: " + e.getMessage()); } return wallet;