forked from Qortal/qortal
hasInvalidSigner() now only checks the chain tip block, to reduce the amount of unintended side effects that can occur.
This commit is contained in:
parent
76686eca21
commit
5ff7b3df6d
@ -758,24 +758,15 @@ public class Controller extends Thread {
|
|||||||
};
|
};
|
||||||
|
|
||||||
public static final Predicate<Peer> hasInvalidSigner = peer -> {
|
public static final Predicate<Peer> hasInvalidSigner = peer -> {
|
||||||
final List<BlockSummaryData> peerChainTipSummaries = peer.getChainTipSummaries();
|
final BlockSummaryData peerChainTipData = peer.getChainTipData();
|
||||||
if (peerChainTipSummaries == null) {
|
if (peerChainTipData == null)
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
|
|
||||||
try (Repository repository = RepositoryManager.getRepository()) {
|
try (Repository repository = RepositoryManager.getRepository()) {
|
||||||
for (BlockSummaryData blockSummaryData : peerChainTipSummaries) {
|
return Account.getRewardShareEffectiveMintingLevel(repository, peerChainTipData.getMinterPublicKey()) == 0;
|
||||||
if (Account.getRewardShareEffectiveMintingLevel(repository, blockSummaryData.getMinterPublicKey()) == 0) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (DataException e) {
|
} catch (DataException e) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We got this far without encountering invalid or missing summaries, nor was an exception thrown,
|
|
||||||
// so it is safe to assume that all of this peer's recent blocks had a valid signer.
|
|
||||||
return false;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
private long getRandomRepositoryMaintenanceInterval() {
|
private long getRandomRepositoryMaintenanceInterval() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user