Skip to content

Commit

Permalink
PeerGroup.addInactive(): Ignore metadata fields when checking for dup…
Browse files Browse the repository at this point in the history
…licates.

Cherry pick 02da126
  • Loading branch information
oscarguindzberg committed May 16, 2020
1 parent 76f589d commit ca65f0a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion core/src/main/java/org/bitcoinj/core/PeerGroup.java
Original file line number Diff line number Diff line change
Expand Up @@ -896,7 +896,14 @@ private boolean addInactive(PeerAddress peerAddress, int priority) {
lock.lock();
try {
// Deduplicate
if (backoffMap.containsKey(peerAddress))
boolean backoffMapContainsPeerAddress = false;
for (PeerAddress a : backoffMap.keySet()) {
if (a.equalsIgnoringMetadata(peerAddress)) {
backoffMapContainsPeerAddress = true;
break;
}
}
if (backoffMapContainsPeerAddress)
return false;
backoffMap.put(peerAddress, new ExponentialBackoff(peerBackoffParams));
if (priority != 0)
Expand Down

0 comments on commit ca65f0a

Please sign in to comment.