forked from Qortal/qortal
Don't re-fetch unconfirmed transactions that are already in the queue
This commit is contained in:
parent
a49218a840
commit
ab4ba9bb17
@ -824,6 +824,12 @@ public class Controller extends Thread {
|
|||||||
|
|
||||||
// Incoming transactions queue
|
// Incoming transactions queue
|
||||||
|
|
||||||
|
private boolean incomingTransactionQueueContains(byte[] signature) {
|
||||||
|
synchronized (incomingTransactions) {
|
||||||
|
return incomingTransactions.stream().anyMatch(t -> Arrays.equals(t.getSignature(), signature));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void processIncomingTransactionsQueue() {
|
private void processIncomingTransactionsQueue() {
|
||||||
if (this.incomingTransactions.size() == 0) {
|
if (this.incomingTransactions.size() == 0) {
|
||||||
// Don't bother locking if there are no new transactions to process
|
// Don't bother locking if there are no new transactions to process
|
||||||
@ -1599,6 +1605,12 @@ public class Controller extends Thread {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ignore if this transaction is in the queue
|
||||||
|
if (incomingTransactionQueueContains(signature)) {
|
||||||
|
LOGGER.trace(() -> String.format("Ignoring existing queued transaction %s from peer %s", Base58.encode(signature), peer));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Do we have it already? (Before requesting transaction data itself)
|
// Do we have it already? (Before requesting transaction data itself)
|
||||||
if (repository.getTransactionRepository().exists(signature)) {
|
if (repository.getTransactionRepository().exists(signature)) {
|
||||||
LOGGER.trace(() -> String.format("Ignoring existing transaction %s from peer %s", Base58.encode(signature), peer));
|
LOGGER.trace(() -> String.format("Ignoring existing transaction %s from peer %s", Base58.encode(signature), peer));
|
||||||
|
Loading…
Reference in New Issue
Block a user