make wallet node static inner class

This commit is contained in:
Craig Raw 2020-05-30 11:47:05 +02:00
parent a32410b538
commit cc4f70002f

View file

@ -141,6 +141,10 @@ public class Wallet {
throw new IllegalStateException("Could not fill nodes to index " + index);
}
public Address getAddress(Node node) {
return getAddress(node.getKeyPurpose(), node.getIndex());
}
public Address getAddress(KeyPurpose keyPurpose, int index) {
if(policyType == PolicyType.SINGLE) {
Keystore keystore = getKeystores().get(0);
@ -155,6 +159,10 @@ public class Wallet {
}
}
public Script getOutputScript(Node node) {
return getOutputScript(node.getKeyPurpose(), node.getIndex());
}
public Script getOutputScript(KeyPurpose keyPurpose, int index) {
if(policyType == PolicyType.SINGLE) {
Keystore keystore = getKeystores().get(0);
@ -169,6 +177,10 @@ public class Wallet {
}
}
public String getOutputDescriptor(Node node) {
return getOutputDescriptor(node.getKeyPurpose(), node.getIndex());
}
public String getOutputDescriptor(KeyPurpose keyPurpose, int index) {
if(policyType == PolicyType.SINGLE) {
Keystore keystore = getKeystores().get(0);
@ -353,7 +365,7 @@ public class Wallet {
}
}
public class Node implements Comparable<Node> {
public static class Node implements Comparable<Node> {
private final String derivationPath;
private String label;
private Long amount;
@ -449,18 +461,6 @@ public class Wallet {
this.history = history;
}
public Address getAddress() {
return Wallet.this.getAddress(keyPurpose, index);
}
public Script getOutputScript() {
return Wallet.this.getOutputScript(keyPurpose, index);
}
public String getOutputDescriptor() {
return Wallet.this.getOutputDescriptor(keyPurpose, index);
}
public void fillToIndex(int index) {
for(int i = 0; i <= index; i++) {
Node node = new Node(getKeyPurpose(), i);