forked from Qortal/qortal
Synchronize hasInvalidBlock predicate, as it wasn't thread safe
This commit is contained in:
parent
7e1ce38f0a
commit
a2e1efab90
@ -723,6 +723,7 @@ public class Controller extends Thread {
|
|||||||
};
|
};
|
||||||
|
|
||||||
public static final Predicate<Peer> hasInvalidBlock = peer -> {
|
public static final Predicate<Peer> hasInvalidBlock = peer -> {
|
||||||
|
synchronized (peer.peerInfoLock) {
|
||||||
final PeerChainTipData peerChainTipData = peer.getChainTipData();
|
final PeerChainTipData peerChainTipData = peer.getChainTipData();
|
||||||
Map<ByteArray, Long> invalidBlockSignatures = Synchronizer.getInstance().getInvalidBlockSignatures();
|
Map<ByteArray, Long> invalidBlockSignatures = Synchronizer.getInstance().getInvalidBlockSignatures();
|
||||||
List<byte[]> peerSignatures = new ArrayList<>();
|
List<byte[]> peerSignatures = new ArrayList<>();
|
||||||
@ -756,6 +757,7 @@ public class Controller extends Thread {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public static final Predicate<Peer> hasNoRecentBlock = peer -> {
|
public static final Predicate<Peer> hasNoRecentBlock = peer -> {
|
||||||
|
@ -121,7 +121,7 @@ public class Peer {
|
|||||||
|
|
||||||
// Peer info
|
// Peer info
|
||||||
|
|
||||||
private final Object peerInfoLock = new Object();
|
public final Object peerInfoLock = new Object();
|
||||||
|
|
||||||
private String peersNodeId;
|
private String peersNodeId;
|
||||||
private byte[] peersPublicKey;
|
private byte[] peersPublicKey;
|
||||||
|
Loading…
Reference in New Issue
Block a user