retain utxo frozen status on wallet refresh

This commit is contained in:
Craig Raw 2023-06-23 09:51:44 +02:00
parent a8df17ff5e
commit d5abf351be
2 changed files with 9 additions and 0 deletions

View file

@ -1660,6 +1660,10 @@ public class Wallet extends Persistable implements Comparable<Wallet> {
labels.put(output.getHash().toString() + "<" + output.getIndex(), output.getLabel());
}
if(output.getStatus() != null) {
labels.put(output.getHash().toString() + ":" + output.getIndex(), output.getStatus().toString());
}
if(output.isSpent() && output.getSpentBy().getLabel() != null && !output.getSpentBy().getLabel().isEmpty()) {
labels.put(output.getSpentBy().getHash() + ">" + output.getSpentBy().getIndex(), output.getSpentBy().getLabel());
}

View file

@ -149,6 +149,11 @@ public class WalletNode extends Persistable implements Comparable<WalletNode> {
txo.setLabel(label);
}
String status = wallet.getDetachedLabels().remove(txo.getHash().toString() + ":" + txo.getIndex());
if(status != null && txo.getStatus() == null) {
txo.setStatus(Status.valueOf(status));
}
if(txo.isSpent()) {
String spentByLabel = wallet.getDetachedLabels().remove(txo.getSpentBy().getHash() + ">" + txo.getSpentBy().getIndex());
if(spentByLabel != null && (txo.getSpentBy().getLabel() == null || txo.getSpentBy().getLabel().isEmpty())) {