display full derivation path where possible

This commit is contained in:
Craig Raw 2020-08-20 17:59:58 +02:00
parent f723d20c9a
commit ab5fdef919

View file

@ -101,7 +101,7 @@ public class ReceiveController extends WalletFormController implements Initializ
this.currentEntry = nodeEntry;
address.setText(nodeEntry.getAddress().toString());
label.textProperty().bindBidirectional(nodeEntry.labelProperty());
derivationPath.setText(nodeEntry.getNode().getDerivationPath());
updateDerivationPath(nodeEntry);
updateLastUsed();
@ -119,6 +119,23 @@ public class ReceiveController extends WalletFormController implements Initializ
updateDisplayAddress(AppController.getDevices());
}
private void updateDerivationPath(NodeEntry nodeEntry) {
KeyDerivation firstDerivation = getWalletForm().getWallet().getKeystores().get(0).getKeyDerivation();
boolean singleDerivationPath = true;
for(Keystore keystore : getWalletForm().getWallet().getKeystores()) {
if(!keystore.getKeyDerivation().getDerivationPath().equals(firstDerivation.getDerivationPath())) {
singleDerivationPath = false;
break;
}
}
if(singleDerivationPath) {
derivationPath.setText(firstDerivation.extend(nodeEntry.getNode().getDerivation()).getDerivationPath());
} else {
derivationPath.setText(nodeEntry.getNode().getDerivationPath().replace("m", "multi"));
}
}
private void updateLastUsed() {
Set<BlockTransactionHashIndex> currentOutputs = currentEntry.getNode().getTransactionOutputs();
if(AppController.isOnline() && currentOutputs.isEmpty()) {