use all addressable script types (not just single hash types)

This commit is contained in:
Craig Raw 2021-07-02 10:44:24 +02:00
parent 143472bdfc
commit a1d2de1859
3 changed files with 4 additions and 4 deletions

2
drongo

@ -1 +1 @@
Subproject commit 107a165fc1db84f80febbe358aaab16b2764a5d5 Subproject commit 967a2c2026f15a6b458d055e33ac488e53df65fd

View file

@ -546,7 +546,7 @@ public class DevicePane extends TitledDescriptionPane {
keystore.setExtendedPublicKey(ExtendedKey.fromDescriptor(xpub)); keystore.setExtendedPublicKey(ExtendedKey.fromDescriptor(xpub));
if(wallet.getScriptType() == null) { if(wallet.getScriptType() == null) {
ScriptType scriptType = Arrays.stream(ScriptType.SINGLE_HASH_TYPES).filter(type -> type.getDefaultDerivation().get(0).equals(derivation.get(0))).findFirst().orElse(ScriptType.P2PKH); ScriptType scriptType = Arrays.stream(ScriptType.ADDRESSABLE_TYPES).filter(type -> type.getDefaultDerivation().get(0).equals(derivation.get(0))).findFirst().orElse(ScriptType.P2PKH);
wallet.setName(device.getModel().toDisplayString()); wallet.setName(device.getModel().toDisplayString());
wallet.setPolicyType(PolicyType.SINGLE); wallet.setPolicyType(PolicyType.SINGLE);
wallet.setScriptType(scriptType); wallet.setScriptType(scriptType);

View file

@ -119,8 +119,8 @@ public class Hwi {
public String displayAddress(Device device, String passphrase, ScriptType scriptType, OutputDescriptor outputDescriptor) throws DisplayAddressException { public String displayAddress(Device device, String passphrase, ScriptType scriptType, OutputDescriptor outputDescriptor) throws DisplayAddressException {
try { try {
if(!Arrays.asList(ScriptType.SINGLE_HASH_TYPES).contains(scriptType)) { if(!Arrays.asList(ScriptType.ADDRESSABLE_TYPES).contains(scriptType)) {
throw new IllegalArgumentException("Cannot display address for script type " + scriptType + ": Only single hash types supported"); throw new IllegalArgumentException("Cannot display address for script type " + scriptType + ": Only addressable types supported");
} }
String descriptor = outputDescriptor.toString(); String descriptor = outputDescriptor.toString();