Use getEffectiveMintingLevel() rather than getLevel()

This commit is contained in:
CalDescent 2022-01-28 10:16:42 +00:00
parent d200a098cd
commit cdd57190ce

View File

@ -16,7 +16,6 @@ import org.qortal.account.PrivateKeyAccount;
import org.qortal.block.Block; import org.qortal.block.Block;
import org.qortal.block.Block.ValidationResult; import org.qortal.block.Block.ValidationResult;
import org.qortal.block.BlockChain; import org.qortal.block.BlockChain;
import org.qortal.data.account.AccountData;
import org.qortal.data.account.MintingAccountData; import org.qortal.data.account.MintingAccountData;
import org.qortal.data.account.RewardShareData; import org.qortal.data.account.RewardShareData;
import org.qortal.data.block.BlockData; import org.qortal.data.block.BlockData;
@ -48,10 +47,10 @@ public class BlockMinter extends Thread {
// Recovery // Recovery
public static final long INVALID_BLOCK_RECOVERY_TIMEOUT = 10 * 60 * 1000L; // ms public static final long INVALID_BLOCK_RECOVERY_TIMEOUT = 10 * 60 * 1000L; // ms
// Min account level to submit blocks // Min effective account level to submit blocks
// This is an unvalidated version of Blockchain.minAccountLevelToMint // This is an unvalidated version of Blockchain.minAccountLevelToMint
// and exists only to reduce block candidates by default. // and exists only to reduce block candidates by default.
private static int MIN_LEVEL_FOR_BLOCK_SUBMISSION = 6; private static int MIN_EFFECTIVE_LEVEL_FOR_BLOCK_SUBMISSION = 6;
// Constructors // Constructors
@ -138,13 +137,10 @@ public class BlockMinter extends Thread {
} }
// Optional (non-validated) prevention of block submissions below a defined level // Optional (non-validated) prevention of block submissions below a defined level
AccountData accountData = repository.getAccountRepository().getAccount(mintingAccount.getAddress()); int level = mintingAccount.getEffectiveMintingLevel();
if (accountData != null) { if (level < MIN_EFFECTIVE_LEVEL_FOR_BLOCK_SUBMISSION) {
Integer level = accountData.getLevel(); madi.remove();
if (level != null && level < MIN_LEVEL_FOR_BLOCK_SUBMISSION) { continue;
madi.remove();
continue;
}
} }
} }