mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-25 05:06:45 +00:00
update null and empty labels, clear script hash cache on increasing gap limit
This commit is contained in:
parent
c202a941b9
commit
197c44bb07
1 changed files with 8 additions and 6 deletions
|
@ -286,6 +286,8 @@ public class WalletForm {
|
||||||
savedPastWallet = event.getPastWallet();
|
savedPastWallet = event.getPastWallet();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Clear the cache - we will need to fetch everything again
|
||||||
|
AppServices.clearTransactionHistoryCache(wallet);
|
||||||
refreshHistory(AppServices.getCurrentBlockHeight(), event.getPastWallet());
|
refreshHistory(AppServices.getCurrentBlockHeight(), event.getPastWallet());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -324,7 +326,7 @@ public class WalletForm {
|
||||||
List<Entry> changedLabelEntries = new ArrayList<>();
|
List<Entry> changedLabelEntries = new ArrayList<>();
|
||||||
for(BlockTransactionHashIndex receivedRef : changedNode.getTransactionOutputs()) {
|
for(BlockTransactionHashIndex receivedRef : changedNode.getTransactionOutputs()) {
|
||||||
BlockTransaction blockTransaction = wallet.getTransactions().get(receivedRef.getHash());
|
BlockTransaction blockTransaction = wallet.getTransactions().get(receivedRef.getHash());
|
||||||
if(blockTransaction != null && blockTransaction.getLabel() == null) {
|
if(blockTransaction != null && (blockTransaction.getLabel() == null || blockTransaction.getLabel().isEmpty())) {
|
||||||
blockTransaction.setLabel(changedNode.getLabel());
|
blockTransaction.setLabel(changedNode.getLabel());
|
||||||
changedLabelEntries.add(new TransactionEntry(event.getWallet(), blockTransaction, Collections.emptyMap(), Collections.emptyMap()));
|
changedLabelEntries.add(new TransactionEntry(event.getWallet(), blockTransaction, Collections.emptyMap(), Collections.emptyMap()));
|
||||||
}
|
}
|
||||||
|
@ -351,16 +353,16 @@ 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) {
|
if(receivedRef.getLabel() == null || receivedRef.getLabel().isEmpty()) {
|
||||||
receivedRef.setLabel(entry.getLabel() + (keyPurpose == KeyPurpose.CHANGE ? " (change)" : " (received)"));
|
receivedRef.setLabel(entry.getLabel() + (keyPurpose == KeyPurpose.CHANGE ? " (change)" : " (received)"));
|
||||||
labelChangedEntries.add(new HashIndexEntry(event.getWallet(), receivedRef, HashIndexEntry.Type.OUTPUT, keyPurpose));
|
labelChangedEntries.add(new HashIndexEntry(event.getWallet(), receivedRef, HashIndexEntry.Type.OUTPUT, keyPurpose));
|
||||||
}
|
}
|
||||||
if(childNode.getLabel() == null) {
|
if(childNode.getLabel() == null || childNode.getLabel().isEmpty()) {
|
||||||
childNode.setLabel(entry.getLabel());
|
childNode.setLabel(entry.getLabel());
|
||||||
labelChangedEntries.add(new NodeEntry(event.getWallet(), childNode));
|
labelChangedEntries.add(new NodeEntry(event.getWallet(), childNode));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(receivedRef.isSpent() && receivedRef.getSpentBy().getHash().equals(transactionEntry.getBlockTransaction().getHash()) && receivedRef.getSpentBy().getLabel() == null) {
|
if(receivedRef.isSpent() && receivedRef.getSpentBy().getHash().equals(transactionEntry.getBlockTransaction().getHash()) && (receivedRef.getSpentBy().getLabel() == null || receivedRef.getSpentBy().getLabel().isEmpty())) {
|
||||||
receivedRef.getSpentBy().setLabel(entry.getLabel() + " (input)");
|
receivedRef.getSpentBy().setLabel(entry.getLabel() + " (input)");
|
||||||
labelChangedEntries.add(new HashIndexEntry(event.getWallet(), receivedRef.getSpentBy(), HashIndexEntry.Type.INPUT, keyPurpose));
|
labelChangedEntries.add(new HashIndexEntry(event.getWallet(), receivedRef.getSpentBy(), HashIndexEntry.Type.INPUT, keyPurpose));
|
||||||
}
|
}
|
||||||
|
@ -372,7 +374,7 @@ public class WalletForm {
|
||||||
NodeEntry nodeEntry = (NodeEntry)entry;
|
NodeEntry nodeEntry = (NodeEntry)entry;
|
||||||
for(BlockTransactionHashIndex receivedRef : nodeEntry.getNode().getTransactionOutputs()) {
|
for(BlockTransactionHashIndex receivedRef : nodeEntry.getNode().getTransactionOutputs()) {
|
||||||
BlockTransaction blockTransaction = event.getWallet().getTransactions().get(receivedRef.getHash());
|
BlockTransaction blockTransaction = event.getWallet().getTransactions().get(receivedRef.getHash());
|
||||||
if(blockTransaction.getLabel() == null) {
|
if(blockTransaction.getLabel() == null || blockTransaction.getLabel().isEmpty()) {
|
||||||
blockTransaction.setLabel(entry.getLabel());
|
blockTransaction.setLabel(entry.getLabel());
|
||||||
labelChangedEntries.add(new TransactionEntry(event.getWallet(), blockTransaction, Collections.emptyMap(), Collections.emptyMap()));
|
labelChangedEntries.add(new TransactionEntry(event.getWallet(), blockTransaction, Collections.emptyMap(), Collections.emptyMap()));
|
||||||
}
|
}
|
||||||
|
@ -381,7 +383,7 @@ public class WalletForm {
|
||||||
if(entry instanceof HashIndexEntry) {
|
if(entry instanceof HashIndexEntry) {
|
||||||
HashIndexEntry hashIndexEntry = (HashIndexEntry)entry;
|
HashIndexEntry hashIndexEntry = (HashIndexEntry)entry;
|
||||||
BlockTransaction blockTransaction = hashIndexEntry.getBlockTransaction();
|
BlockTransaction blockTransaction = hashIndexEntry.getBlockTransaction();
|
||||||
if(blockTransaction.getLabel() == null) {
|
if(blockTransaction.getLabel() == null || blockTransaction.getLabel().isEmpty()) {
|
||||||
blockTransaction.setLabel(entry.getLabel());
|
blockTransaction.setLabel(entry.getLabel());
|
||||||
labelChangedEntries.add(new TransactionEntry(event.getWallet(), blockTransaction, Collections.emptyMap(), Collections.emptyMap()));
|
labelChangedEntries.add(new TransactionEntry(event.getWallet(), blockTransaction, Collections.emptyMap(), Collections.emptyMap()));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue