mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-25 05:06:45 +00:00
propagate transaction label changes to inputs, outputs and addresses where their existing labels were set in the same manner
This commit is contained in:
parent
2c1204c247
commit
b1bc25ba04
1 changed files with 9 additions and 3 deletions
|
@ -506,16 +506,22 @@ public class WalletForm {
|
||||||
for(WalletNode childNode : wallet.getNode(keyPurpose).getChildren()) {
|
for(WalletNode childNode : wallet.getNode(keyPurpose).getChildren()) {
|
||||||
for(BlockTransactionHashIndex receivedRef : childNode.getTransactionOutputs()) {
|
for(BlockTransactionHashIndex receivedRef : childNode.getTransactionOutputs()) {
|
||||||
if(receivedRef.getHash().equals(transactionEntry.getBlockTransaction().getHash())) {
|
if(receivedRef.getHash().equals(transactionEntry.getBlockTransaction().getHash())) {
|
||||||
if((receivedRef.getLabel() == null || receivedRef.getLabel().isEmpty()) && wallet.getStandardAccountType() != StandardAccount.WHIRLPOOL_PREMIX) {
|
String prevRefLabel = "";
|
||||||
|
if((receivedRef.getLabel() == null || receivedRef.getLabel().isEmpty()
|
||||||
|
|| receivedRef.getLabel().endsWith(" (sent)") || receivedRef.getLabel().endsWith(" (change)") || receivedRef.getLabel().endsWith(" (received)"))
|
||||||
|
&& wallet.getStandardAccountType() != StandardAccount.WHIRLPOOL_PREMIX) {
|
||||||
|
prevRefLabel = receivedRef.getLabel();
|
||||||
receivedRef.setLabel(entry.getLabel() + (keyPurpose == KeyPurpose.CHANGE ? (event.getWallet().isBip47() ? " (sent)" : " (change)") : " (received)"));
|
receivedRef.setLabel(entry.getLabel() + (keyPurpose == KeyPurpose.CHANGE ? (event.getWallet().isBip47() ? " (sent)" : " (change)") : " (received)"));
|
||||||
labelChangedEntries.put(new HashIndexEntry(event.getWallet(), receivedRef, HashIndexEntry.Type.OUTPUT, keyPurpose), entry);
|
labelChangedEntries.put(new HashIndexEntry(event.getWallet(), receivedRef, HashIndexEntry.Type.OUTPUT, keyPurpose), entry);
|
||||||
}
|
}
|
||||||
if((childNode.getLabel() == null || childNode.getLabel().isEmpty())) {
|
if(childNode.getLabel() == null || childNode.getLabel().isEmpty()
|
||||||
|
|| prevRefLabel.equals(childNode.getLabel() + " (sent)") || prevRefLabel.equals(childNode.getLabel() + " (change)") || prevRefLabel.equals(childNode.getLabel() + " (received)")) {
|
||||||
childNode.setLabel(entry.getLabel());
|
childNode.setLabel(entry.getLabel());
|
||||||
labelChangedEntries.put(new NodeEntry(event.getWallet(), childNode), entry);
|
labelChangedEntries.put(new NodeEntry(event.getWallet(), childNode), entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(receivedRef.isSpent() && receivedRef.getSpentBy().getHash().equals(transactionEntry.getBlockTransaction().getHash()) && (receivedRef.getSpentBy().getLabel() == null || receivedRef.getSpentBy().getLabel().isEmpty())) {
|
if(receivedRef.isSpent() && receivedRef.getSpentBy().getHash().equals(transactionEntry.getBlockTransaction().getHash())
|
||||||
|
&& (receivedRef.getSpentBy().getLabel() == null || receivedRef.getSpentBy().getLabel().isEmpty() || receivedRef.getSpentBy().getLabel().endsWith(" (input)"))) {
|
||||||
receivedRef.getSpentBy().setLabel(entry.getLabel() + " (input)");
|
receivedRef.getSpentBy().setLabel(entry.getLabel() + " (input)");
|
||||||
labelChangedEntries.put(new HashIndexEntry(event.getWallet(), receivedRef.getSpentBy(), HashIndexEntry.Type.INPUT, keyPurpose), entry);
|
labelChangedEntries.put(new HashIndexEntry(event.getWallet(), receivedRef.getSpentBy(), HashIndexEntry.Type.INPUT, keyPurpose), entry);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue