forked from Qortal/qortal
Fix namecheck
This commit is contained in:
parent
885aa10395
commit
b6272c1b0f
@ -7,7 +7,9 @@ import org.qortal.controller.LiteNode;
|
|||||||
import org.qortal.data.account.AccountBalanceData;
|
import org.qortal.data.account.AccountBalanceData;
|
||||||
import org.qortal.data.account.AccountData;
|
import org.qortal.data.account.AccountData;
|
||||||
import org.qortal.data.account.RewardShareData;
|
import org.qortal.data.account.RewardShareData;
|
||||||
|
import org.qortal.data.naming.NameData;
|
||||||
import org.qortal.repository.DataException;
|
import org.qortal.repository.DataException;
|
||||||
|
import org.qortal.repository.NameRepository;
|
||||||
import org.qortal.repository.Repository;
|
import org.qortal.repository.Repository;
|
||||||
import org.qortal.settings.Settings;
|
import org.qortal.settings.Settings;
|
||||||
import org.qortal.utils.Base58;
|
import org.qortal.utils.Base58;
|
||||||
@ -15,6 +17,8 @@ import org.qortal.utils.Base58;
|
|||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import static org.qortal.utils.Amounts.prettyAmount;
|
import static org.qortal.utils.Amounts.prettyAmount;
|
||||||
|
|
||||||
@XmlAccessorType(XmlAccessType.NONE) // Stops JAX-RS errors when unmarshalling blockchain config
|
@XmlAccessorType(XmlAccessType.NONE) // Stops JAX-RS errors when unmarshalling blockchain config
|
||||||
@ -196,6 +200,7 @@ public class Account {
|
|||||||
* To be considered a "minting account", the account needs to pass at least one of these tests:<br>
|
* To be considered a "minting account", the account needs to pass at least one of these tests:<br>
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>account's level is at least <tt>minAccountLevelToMint</tt> from blockchain config</li>
|
* <li>account's level is at least <tt>minAccountLevelToMint</tt> from blockchain config</li>
|
||||||
|
* <li>account's address have registered a name</li>
|
||||||
* <li>account has 'founder' flag set</li>
|
* <li>account has 'founder' flag set</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
@ -204,11 +209,24 @@ public class Account {
|
|||||||
*/
|
*/
|
||||||
public boolean canMint() throws DataException {
|
public boolean canMint() throws DataException {
|
||||||
AccountData accountData = this.repository.getAccountRepository().getAccount(this.address);
|
AccountData accountData = this.repository.getAccountRepository().getAccount(this.address);
|
||||||
|
NameRepository nameRepository = this.repository.getNameRepository();
|
||||||
|
|
||||||
|
int blockchainHeight = this.repository.getBlockRepository().getBlockchainHeight();
|
||||||
|
int nameCheckHeight = BlockChain.getInstance().getOnlyMintWithNameHeight();
|
||||||
|
int levelToMint = BlockChain.getInstance().getMinAccountLevelToMint();
|
||||||
|
int level = accountData.getLevel();
|
||||||
|
|
||||||
|
String myAddress = accountData.getAddress();
|
||||||
|
List<NameData> myName = nameRepository.getNamesByOwner(myAddress);
|
||||||
|
|
||||||
if (accountData == null)
|
if (accountData == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Integer level = accountData.getLevel();
|
if (blockchainHeight < nameCheckHeight && level >= levelToMint)
|
||||||
if (level != null && level >= BlockChain.getInstance().getMinAccountLevelToMint())
|
return true;
|
||||||
|
|
||||||
|
// Can only mint if have registered a name
|
||||||
|
if (blockchainHeight >= nameCheckHeight && level >= levelToMint && !myName.isEmpty())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// Founders can always mint, unless they have a penalty
|
// Founders can always mint, unless they have a penalty
|
||||||
|
Loading…
x
Reference in New Issue
Block a user