mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-20 02:12:00 +01:00
Add check for empty list
This commit is contained in:
parent
0aaab849eb
commit
ddd857a7f9
@ -67,6 +67,14 @@ public class CoreSeedNodesRepository implements SeedNodesRepository {
|
||||
new NodeAddress("s67qglwhkgkyvr74.onion:8000"), // @emzy
|
||||
new NodeAddress("jhgcy2won7xnslrb.onion:8000"), // @sqrrm
|
||||
|
||||
/* old nodes pre 0.6.0 (still running for 0.5.* versions
|
||||
new NodeAddress("3f3cu2yw7u457ztq.onion:8000"),
|
||||
new NodeAddress("723ljisnynbtdohi.onion:8000"),
|
||||
new NodeAddress("rm7b56wbrcczpjvl.onion:8000"),
|
||||
new NodeAddress("fl3mmribyxgrv63c.onion:8000"),
|
||||
*/
|
||||
|
||||
|
||||
//TODO dev
|
||||
// local dev
|
||||
// new NodeAddress("joehwtpe7ijnz4df.onion:8000"),
|
||||
|
@ -422,9 +422,11 @@ public class PeerManager implements ConnectionListener, PersistedDataHost {
|
||||
List<Peer> list = new ArrayList<>(reportedPeers);
|
||||
// we dont use sorting by lastActivityDate to keep it more random
|
||||
for (int i = 0; i < diff; i++) {
|
||||
if (!list.isEmpty()) {
|
||||
Peer toRemove = list.remove(new Random().nextInt(list.size()));
|
||||
removeReportedPeer(toRemove);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
log.trace("No need to purge reported peers.\n\tWe don't have more then {} reported peers yet.", MAX_REPORTED_PEERS);
|
||||
}
|
||||
@ -501,9 +503,11 @@ public class PeerManager implements ConnectionListener, PersistedDataHost {
|
||||
List<Peer> list = new ArrayList<>(persistedPeers);
|
||||
// we dont use sorting by lastActivityDate to avoid attack vectors and keep it more random
|
||||
for (int i = 0; i < diff; i++) {
|
||||
if (!list.isEmpty()) {
|
||||
Peer toRemove = list.remove(new Random().nextInt(list.size()));
|
||||
removePersistedPeer(toRemove);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
log.trace("No need to purge persisted peers.\n\tWe don't have more then {} persisted peers yet.", MAX_PERSISTED_PEERS);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user