mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-07 14:54:15 +00:00
Don't run confidence listeners if we get duplicate invs from the same peer (can happen if we connect to the same peer IP multiple times).
This commit is contained in:
parent
dfa722ccc8
commit
854d81eae9
@ -268,7 +268,7 @@ public class MemoryPool {
|
||||
private void markBroadcast(PeerAddress byPeer, Transaction tx) {
|
||||
checkState(lock.isHeldByCurrentThread());
|
||||
final TransactionConfidence confidence = tx.getConfidence();
|
||||
confidence.markBroadcastBy(byPeer);
|
||||
if (confidence.markBroadcastBy(byPeer))
|
||||
confidence.queueListeners(TransactionConfidence.Listener.ChangeReason.SEEN_PEERS);
|
||||
}
|
||||
|
||||
|
@ -274,12 +274,13 @@ public class TransactionConfidence implements Serializable {
|
||||
*
|
||||
* @param address IP address of the peer, used as a proxy for identity.
|
||||
*/
|
||||
public synchronized void markBroadcastBy(PeerAddress address) {
|
||||
public synchronized boolean markBroadcastBy(PeerAddress address) {
|
||||
if (!broadcastBy.addIfAbsent(address))
|
||||
return; // Duplicate.
|
||||
return false; // Duplicate.
|
||||
if (getConfidenceType() == ConfidenceType.UNKNOWN) {
|
||||
this.confidenceType = ConfidenceType.PENDING;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user