made adjustments to support the ignore level feature trigger and removed the fail-safe feature trigger since the ignore level feature trigger now satisfies it implicitly

This commit is contained in:
kennycud 2025-01-13 13:52:17 -08:00
parent 69cba78d94
commit b2dbcbb603
3 changed files with 22 additions and 29 deletions

View File

@ -418,7 +418,9 @@ public class Block {
onlineAccounts.removeIf(a -> a.getNonce() == null || a.getNonce() < 0); onlineAccounts.removeIf(a -> a.getNonce() == null || a.getNonce() < 0);
// After feature trigger, remove any online accounts that are level 0 // After feature trigger, remove any online accounts that are level 0
if (height >= BlockChain.getInstance().getOnlineAccountMinterLevelValidationHeight()) { // but only if they are before the ignore level feature trigger
if (height < BlockChain.getInstance().getIgnoreLevelForRewardShareHeight() &&
height >= BlockChain.getInstance().getOnlineAccountMinterLevelValidationHeight()) {
onlineAccounts.removeIf(a -> { onlineAccounts.removeIf(a -> {
try { try {
return Account.getRewardShareEffectiveMintingLevel(repository, a.getPublicKey()) == 0; return Account.getRewardShareEffectiveMintingLevel(repository, a.getPublicKey()) == 0;
@ -1161,9 +1163,10 @@ public class Block {
if (onlineRewardShares == null) if (onlineRewardShares == null)
return ValidationResult.ONLINE_ACCOUNT_UNKNOWN; return ValidationResult.ONLINE_ACCOUNT_UNKNOWN;
// After feature trigger, require all online account minters to be greater than level 0 // After feature trigger, require all online account minters to be greater than level 0,
if (this.getBlockData().getHeight() >= BlockChain.getInstance().getOnlineAccountMinterLevelValidationHeight()) { // but only if it is before the feature trigger where we ignore level again
if( this.blockData.getHeight() < BlockChain.getInstance().getOnlineValidationFailSafeHeight()) { if (this.blockData.getHeight() < BlockChain.getInstance().getIgnoreLevelForRewardShareHeight() &&
this.getBlockData().getHeight() >= BlockChain.getInstance().getOnlineAccountMinterLevelValidationHeight()) {
List<ExpandedAccount> expandedAccounts List<ExpandedAccount> expandedAccounts
= this.getExpandedAccounts().stream() = this.getExpandedAccounts().stream()
.filter(expandedAccount -> expandedAccount.isMinterMember) .filter(expandedAccount -> expandedAccount.isMinterMember)
@ -1179,17 +1182,13 @@ public class Block {
} }
} }
} }
// this.blockData.getHeight() >= BlockChain.getInstance().getOnlineValidationFailSafeHeight() else if (this.blockData.getHeight() >= BlockChain.getInstance().getIgnoreLevelForRewardShareHeight()){
else {
Optional<ExpandedAccount> anyInvalidAccount Optional<ExpandedAccount> anyInvalidAccount
= this.getExpandedAccounts().stream() = this.getExpandedAccounts().stream()
.filter( .filter(account -> !account.isMinterMember)
account -> account.getEffectiveMintingLevel() == 0 ||
!account.isMinterMember)
.findAny(); .findAny();
if( anyInvalidAccount.isPresent() ) return ValidationResult.ONLINE_ACCOUNTS_INVALID; if( anyInvalidAccount.isPresent() ) return ValidationResult.ONLINE_ACCOUNTS_INVALID;
} }
}
// If block is past a certain age then we simply assume the signatures were correct // If block is past a certain age then we simply assume the signatures were correct
long signatureRequirementThreshold = NTP.getTime() - BlockChain.getInstance().getOnlineAccountSignaturesMinLifetime(); long signatureRequirementThreshold = NTP.getTime() - BlockChain.getInstance().getOnlineAccountSignaturesMinLifetime();

View File

@ -90,7 +90,6 @@ public class BlockChain {
groupMemberCheckHeight, groupMemberCheckHeight,
fixBatchRewardHeight, fixBatchRewardHeight,
adminsReplaceFoundersHeight, adminsReplaceFoundersHeight,
onlineValidationFailSafeHeight,
nullGroupMembershipHeight, nullGroupMembershipHeight,
ignoreLevelForRewardShareHeight ignoreLevelForRewardShareHeight
} }
@ -670,10 +669,6 @@ public class BlockChain {
return this.featureTriggers.get(FeatureTrigger.adminsReplaceFoundersHeight.name()).intValue(); return this.featureTriggers.get(FeatureTrigger.adminsReplaceFoundersHeight.name()).intValue();
} }
public int getOnlineValidationFailSafeHeight() {
return this.featureTriggers.get(FeatureTrigger.onlineValidationFailSafeHeight.name()).intValue();
}
public int getNullGroupMembershipHeight() { public int getNullGroupMembershipHeight() {
return this.featureTriggers.get(FeatureTrigger.nullGroupMembershipHeight.name()).intValue(); return this.featureTriggers.get(FeatureTrigger.nullGroupMembershipHeight.name()).intValue();
} }

View File

@ -115,7 +115,6 @@
"groupMemberCheckHeight": 1902700, "groupMemberCheckHeight": 1902700,
"fixBatchRewardHeight": 1945900, "fixBatchRewardHeight": 1945900,
"adminsReplaceFoundersHeight": 9999999, "adminsReplaceFoundersHeight": 9999999,
"onlineValidationFailSafeHeight": 9999999,
"nullGroupMembershipHeight": 9999999, "nullGroupMembershipHeight": 9999999,
"ignoreLevelForRewardShareHeight": 9999999 "ignoreLevelForRewardShareHeight": 9999999
}, },