Fix ConcurrentModificationException in getCachedSigValidTransactions()

This commit is contained in:
CalDescent 2022-05-27 10:15:41 +02:00
parent 8e71cbd822
commit 0875c5bf3b

View File

@ -99,10 +99,12 @@ public class TransactionImporter extends Thread {
* @return a list of TransactionData objects, with valid signatures.
*/
private List<TransactionData> getCachedSigValidTransactions() {
return this.incomingTransactions.entrySet().stream()
.filter(t -> Boolean.TRUE.equals(t.getValue()))
.map(Map.Entry::getKey)
.collect(Collectors.toList());
synchronized (this.incomingTransactions) {
return this.incomingTransactions.entrySet().stream()
.filter(t -> Boolean.TRUE.equals(t.getValue()))
.map(Map.Entry::getKey)
.collect(Collectors.toList());
}
}
/**