forked from Qortal/qortal
Optimized code in Synchronizer.uniqueCommonBlocks()
This commit is contained in:
parent
ec2af62b4d
commit
f532dbe7b4
@ -403,10 +403,7 @@ public class Synchronizer {
|
|||||||
private List<BlockSummaryData> uniqueCommonBlocks(List<Peer> peers) {
|
private List<BlockSummaryData> uniqueCommonBlocks(List<Peer> peers) {
|
||||||
List<BlockSummaryData> commonBlocks = new ArrayList<>();
|
List<BlockSummaryData> commonBlocks = new ArrayList<>();
|
||||||
|
|
||||||
Iterator<Peer> iterator = peers.iterator();
|
for (Peer peer : peers) {
|
||||||
while (iterator.hasNext()) {
|
|
||||||
Peer peer = iterator.next();
|
|
||||||
|
|
||||||
if (peer.getCommonBlockData() != null && peer.getCommonBlockData().getCommonBlockSummary() != null) {
|
if (peer.getCommonBlockData() != null && peer.getCommonBlockData().getCommonBlockSummary() != null) {
|
||||||
LOGGER.debug(String.format("Peer %s has common block %.8s", peer, Base58.encode(peer.getCommonBlockData().getCommonBlockSummary().getSignature())));
|
LOGGER.debug(String.format("Peer %s has common block %.8s", peer, Base58.encode(peer.getCommonBlockData().getCommonBlockSummary().getSignature())));
|
||||||
|
|
||||||
@ -416,7 +413,6 @@ public class Synchronizer {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
LOGGER.debug(String.format("Peer %s has no common block data. Skipping...", peer));
|
LOGGER.debug(String.format("Peer %s has no common block data. Skipping...", peer));
|
||||||
iterator.remove();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user