Skip to content

Commit

Permalink
improve error message when importing invalid coldcard multisig config
Browse files Browse the repository at this point in the history
  • Loading branch information
craigraw committed May 9, 2024
1 parent 1187925 commit 87cc28e
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/main/java/com/sparrowwallet/sparrow/io/ColdcardMultisig.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 87cc28e

Please # to comment.