mirror of
https://github.com/Qortal/qortal.git
synced 2025-02-11 17:55:50 +00:00
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:
parent
69cba78d94
commit
b2dbcbb603
@ -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,34 +1163,31 @@ 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() &&
|
||||||
List<ExpandedAccount> expandedAccounts
|
this.getBlockData().getHeight() >= BlockChain.getInstance().getOnlineAccountMinterLevelValidationHeight()) {
|
||||||
|
List<ExpandedAccount> expandedAccounts
|
||||||
= this.getExpandedAccounts().stream()
|
= this.getExpandedAccounts().stream()
|
||||||
.filter(expandedAccount -> expandedAccount.isMinterMember)
|
.filter(expandedAccount -> expandedAccount.isMinterMember)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
for (ExpandedAccount account : expandedAccounts) {
|
for (ExpandedAccount account : expandedAccounts) {
|
||||||
if (account.getMintingAccount().getEffectiveMintingLevel() == 0)
|
if (account.getMintingAccount().getEffectiveMintingLevel() == 0)
|
||||||
|
return ValidationResult.ONLINE_ACCOUNTS_INVALID;
|
||||||
|
|
||||||
|
if (this.getBlockData().getHeight() >= BlockChain.getInstance().getFixBatchRewardHeight()) {
|
||||||
|
if (!account.isMinterMember)
|
||||||
return ValidationResult.ONLINE_ACCOUNTS_INVALID;
|
return ValidationResult.ONLINE_ACCOUNTS_INVALID;
|
||||||
|
|
||||||
if (this.getBlockData().getHeight() >= BlockChain.getInstance().getFixBatchRewardHeight()) {
|
|
||||||
if (!account.isMinterMember)
|
|
||||||
return ValidationResult.ONLINE_ACCOUNTS_INVALID;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// this.blockData.getHeight() >= BlockChain.getInstance().getOnlineValidationFailSafeHeight()
|
}
|
||||||
else {
|
else if (this.blockData.getHeight() >= BlockChain.getInstance().getIgnoreLevelForRewardShareHeight()){
|
||||||
Optional<ExpandedAccount> anyInvalidAccount
|
Optional<ExpandedAccount> anyInvalidAccount
|
||||||
= this.getExpandedAccounts().stream()
|
= this.getExpandedAccounts().stream()
|
||||||
.filter(
|
.filter(account -> !account.isMinterMember)
|
||||||
account -> account.getEffectiveMintingLevel() == 0 ||
|
.findAny();
|
||||||
!account.isMinterMember)
|
if( anyInvalidAccount.isPresent() ) return ValidationResult.ONLINE_ACCOUNTS_INVALID;
|
||||||
.findAny();
|
|
||||||
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
|
||||||
|
@ -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();
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user