mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-25 05:06:45 +00:00
handle unknown derivation path for unchained caravan key
This commit is contained in:
parent
5c3a00b71b
commit
e6fce14fde
1 changed files with 7 additions and 2 deletions
|
@ -50,10 +50,16 @@ public class CaravanMultisig implements WalletImport, WalletExport {
|
||||||
Wallet wallet = new Wallet();
|
Wallet wallet = new Wallet();
|
||||||
wallet.setName(cf.name);
|
wallet.setName(cf.name);
|
||||||
wallet.setPolicyType(PolicyType.MULTI);
|
wallet.setPolicyType(PolicyType.MULTI);
|
||||||
|
ScriptType scriptType = ScriptType.valueOf(cf.addressType);
|
||||||
|
|
||||||
for(ExtPublicKey extKey : cf.extendedPublicKeys) {
|
for(ExtPublicKey extKey : cf.extendedPublicKeys) {
|
||||||
Keystore keystore = new Keystore(extKey.name);
|
Keystore keystore = new Keystore(extKey.name);
|
||||||
keystore.setKeyDerivation(new KeyDerivation(extKey.xfp, extKey.bip32Path));
|
try {
|
||||||
|
keystore.setKeyDerivation(new KeyDerivation(extKey.xfp, extKey.bip32Path));
|
||||||
|
} catch(NumberFormatException e) {
|
||||||
|
keystore.setKeyDerivation(new KeyDerivation(extKey.xfp, scriptType.getDefaultDerivationPath()));
|
||||||
|
}
|
||||||
|
|
||||||
keystore.setExtendedPublicKey(ExtendedKey.fromDescriptor(extKey.xpub));
|
keystore.setExtendedPublicKey(ExtendedKey.fromDescriptor(extKey.xpub));
|
||||||
|
|
||||||
WalletModel walletModel = WalletModel.fromType(extKey.method);
|
WalletModel walletModel = WalletModel.fromType(extKey.method);
|
||||||
|
@ -67,7 +73,6 @@ public class CaravanMultisig implements WalletImport, WalletExport {
|
||||||
wallet.getKeystores().add(keystore);
|
wallet.getKeystores().add(keystore);
|
||||||
}
|
}
|
||||||
|
|
||||||
ScriptType scriptType = ScriptType.valueOf(cf.addressType);
|
|
||||||
wallet.setScriptType(scriptType);
|
wallet.setScriptType(scriptType);
|
||||||
wallet.setDefaultPolicy(Policy.getPolicy(PolicyType.MULTI, scriptType, wallet.getKeystores(), cf.quorum.requiredSigners));
|
wallet.setDefaultPolicy(Policy.getPolicy(PolicyType.MULTI, scriptType, wallet.getKeystores(), cf.quorum.requiredSigners));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue