improve multithreaded behaviour

This commit is contained in:
Craig Raw
2020-06-26 13:34:39 +02:00
parent 7444a87d89
commit cd7fc06819
2 changed files with 3 additions and 15 deletions
@@ -288,13 +288,7 @@ public class ElectrumServer {
}
if(!transactionMap.equals(wallet.getTransactions())) {
for(BlockTransaction blockTx : transactionMap.values()) {
Optional<String> optionalLabel = wallet.getTransactions().values().stream().filter(oldBlTx -> oldBlTx.getHash().equals(blockTx.getHash())).map(BlockTransaction::getLabel).filter(Objects::nonNull).findFirst();
optionalLabel.ifPresent(blockTx::setLabel);
}
wallet.getTransactions().clear();
wallet.getTransactions().putAll(transactionMap);
wallet.updateTransactions(transactionMap);
}
}
@@ -481,13 +475,7 @@ public class ElectrumServer {
}
if(!transactionOutputs.equals(node.getTransactionOutputs())) {
for(BlockTransactionHashIndex txo : transactionOutputs) {
Optional<String> optionalLabel = node.getTransactionOutputs().stream().filter(oldTxo -> oldTxo.getHash().equals(txo.getHash()) && oldTxo.getIndex() == txo.getIndex() && oldTxo.getLabel() != null).map(BlockTransactionHash::getLabel).findFirst();
optionalLabel.ifPresent(txo::setLabel);
}
node.getTransactionOutputs().clear();
node.getTransactionOutputs().addAll(transactionOutputs);
node.updateTransactionOutputs(transactionOutputs);
}
}