mirror of
https://github.com/sparrowwallet/drongo.git
synced 2024-11-05 03:26:43 +00:00
ensure keystore source and wallet model is always filled in
This commit is contained in:
parent
d740895bd6
commit
cbffaf3e41
2 changed files with 13 additions and 1 deletions
|
@ -66,7 +66,7 @@ public class Keystore {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isValid() {
|
public boolean isValid() {
|
||||||
if(label == null || keyDerivation == null || extendedPublicKey == null) {
|
if(label == null || source == null || walletModel == null || keyDerivation == null || extendedPublicKey == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,6 +85,8 @@ public class Keystore {
|
||||||
|
|
||||||
public Keystore copy() {
|
public Keystore copy() {
|
||||||
Keystore copy = new Keystore(label);
|
Keystore copy = new Keystore(label);
|
||||||
|
copy.setSource(source);
|
||||||
|
copy.setWalletModel(walletModel);
|
||||||
if(keyDerivation != null) {
|
if(keyDerivation != null) {
|
||||||
copy.setKeyDerivation(keyDerivation.copy());
|
copy.setKeyDerivation(keyDerivation.copy());
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,16 @@ public enum WalletModel {
|
||||||
return this.toString();
|
return this.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static WalletModel fromType(String type) {
|
||||||
|
for(WalletModel model : values()) {
|
||||||
|
if(model.getType().equals(type)) {
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public String toDisplayString() {
|
public String toDisplayString() {
|
||||||
String line = this.toString().toLowerCase();
|
String line = this.toString().toLowerCase();
|
||||||
String[] words = line.split("_");
|
String[] words = line.split("_");
|
||||||
|
|
Loading…
Reference in a new issue