mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-23 20:36:44 +00:00
fix various refresh history issues when updating node sets
This commit is contained in:
parent
001e368775
commit
7b3ff2a6d3
3 changed files with 10 additions and 6 deletions
2
drongo
2
drongo
|
@ -1 +1 @@
|
|||
Subproject commit 0734757a177627600a63cb3347804ea126b0d417
|
||||
Subproject commit 04631be8c10bf0ef72ebd7f7ef26254cccecb282
|
|
@ -1303,6 +1303,11 @@ public class ElectrumServer {
|
|||
return false;
|
||||
}
|
||||
|
||||
Set<WalletNode> nodes = (filterToNodes == null ? null : filterToNodes.stream().filter(node -> node.getWallet().equals(wallet)).collect(Collectors.toSet()));
|
||||
if(filterToNodes != null && nodes.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean initial = (walletSynchronizeLocks.putIfAbsent(wallet, new Object()) == null);
|
||||
synchronized(walletSynchronizeLocks.get(wallet)) {
|
||||
if(initial) {
|
||||
|
@ -1311,7 +1316,6 @@ public class ElectrumServer {
|
|||
|
||||
if(isConnected()) {
|
||||
ElectrumServer electrumServer = new ElectrumServer();
|
||||
Set<WalletNode> nodes = (filterToNodes == null ? null : filterToNodes.stream().filter(node -> node.getWallet().equals(wallet)).collect(Collectors.toSet()));
|
||||
|
||||
Map<String, String> previousScriptHashes = getCalculatedScriptHashes(wallet);
|
||||
Map<WalletNode, Set<BlockTransactionHash>> nodeTransactionMap = (nodes == null ? electrumServer.getHistory(wallet) : electrumServer.getHistory(wallet, nodes));
|
||||
|
|
|
@ -259,12 +259,12 @@ public class WalletForm {
|
|||
}
|
||||
|
||||
private List<WalletNode> getHistoryChangedNodes(Set<WalletNode> previousNodes, Set<WalletNode> currentNodes) {
|
||||
Map<WalletNode, WalletNode> previousNodeMap = new HashMap<>(previousNodes.size());
|
||||
previousNodes.forEach(walletNode -> previousNodeMap.put(walletNode, walletNode));
|
||||
Map<String, WalletNode> previousNodeMap = new HashMap<>(previousNodes.size());
|
||||
previousNodes.forEach(walletNode -> previousNodeMap.put(walletNode.getDerivationPath(), walletNode));
|
||||
|
||||
List<WalletNode> changedNodes = new ArrayList<>();
|
||||
for(WalletNode currentNode : currentNodes) {
|
||||
WalletNode previousNode = previousNodeMap.get(currentNode);
|
||||
WalletNode previousNode = previousNodeMap.get(currentNode.getDerivationPath());
|
||||
if(previousNode != null) {
|
||||
if(!currentNode.getTransactionOutputs().equals(previousNode.getTransactionOutputs())) {
|
||||
changedNodes.add(currentNode);
|
||||
|
@ -286,7 +286,7 @@ public class WalletForm {
|
|||
return null;
|
||||
}
|
||||
|
||||
Set<WalletNode> allNodes = new LinkedHashSet<>();
|
||||
Set<WalletNode> allNodes = new LinkedHashSet<>(walletNodes);
|
||||
for(WalletNode walletNode : walletNodes) {
|
||||
for(Set<WalletNode> nodes : walletTransactionNodes) {
|
||||
if(nodes.contains(walletNode)) {
|
||||
|
|
Loading…
Reference in a new issue