mirror of
https://github.com/sparrowwallet/drongo.git
synced 2024-12-26 10:06:45 +00:00
various improvements
This commit is contained in:
parent
601c11bd50
commit
81378b28b2
2 changed files with 15 additions and 7 deletions
|
@ -13,7 +13,7 @@ import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class Wallet {
|
public class Wallet {
|
||||||
private static final int DEFAULT_LOOKAHEAD = 20;
|
public static final int DEFAULT_LOOKAHEAD = 20;
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
private PolicyType policyType;
|
private PolicyType policyType;
|
||||||
|
@ -75,10 +75,6 @@ public class Wallet {
|
||||||
return keystores;
|
return keystores;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setKeystores(List<Keystore> keystores) {
|
|
||||||
this.keystores = keystores;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Set<WalletNode> getPurposeNodes() {
|
private Set<WalletNode> getPurposeNodes() {
|
||||||
return purposeNodes;
|
return purposeNodes;
|
||||||
}
|
}
|
||||||
|
@ -113,7 +109,7 @@ public class Wallet {
|
||||||
int lookAhead = DEFAULT_LOOKAHEAD;
|
int lookAhead = DEFAULT_LOOKAHEAD;
|
||||||
Integer highestUsed = node.getHighestUsedIndex();
|
Integer highestUsed = node.getHighestUsedIndex();
|
||||||
if(highestUsed != null) {
|
if(highestUsed != null) {
|
||||||
lookAhead = Math.max(highestUsed + lookAhead/2, lookAhead);
|
lookAhead = highestUsed + lookAhead;
|
||||||
}
|
}
|
||||||
|
|
||||||
return lookAhead;
|
return lookAhead;
|
||||||
|
|
|
@ -157,7 +157,19 @@ public class WalletNode implements Comparable<WalletNode> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(WalletNode node) {
|
public int compareTo(WalletNode node) {
|
||||||
return getIndex() - node.getIndex();
|
if(getDerivation().size() != node.getDerivation().size()) {
|
||||||
|
return getDerivation().size() - node.getDerivation().size();
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int i = 0; i < getDerivation().size(); i++) {
|
||||||
|
ChildNumber thisChild = getDerivation().get(i);
|
||||||
|
ChildNumber nodeChild = node.getDerivation().get(i);
|
||||||
|
if(thisChild.num() != nodeChild.num()) {
|
||||||
|
return thisChild.num() - nodeChild.num();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clearHistory() {
|
public void clearHistory() {
|
||||||
|
|
Loading…
Reference in a new issue