mirror of
https://github.com/Qortal/qortal.git
synced 2025-02-11 17:55:50 +00:00
Removed logging statements to demonstrate order of operations to others. Added optimizations for the canMint() method. This is a quick fix and a more comprehensive fix will be done in the future.
This commit is contained in:
parent
130bb6cf50
commit
f55efe38c5
@ -222,8 +222,6 @@ public class Account {
|
||||
int removeNameCheckHeight = BlockChain.getInstance().getRemoveOnlyMintWithNameHeight();
|
||||
|
||||
String myAddress = accountData.getAddress();
|
||||
List<NameData> myName = nameRepository.getNamesByOwner(myAddress);
|
||||
boolean isMember = groupRepository.memberExists(groupIdToMint, myAddress);
|
||||
|
||||
if (accountData == null)
|
||||
return false;
|
||||
@ -232,45 +230,40 @@ public class Account {
|
||||
if (blockchainHeight < nameCheckHeight && level >= levelToMint)
|
||||
return true;
|
||||
|
||||
LOGGER.info("Calling myName.isEmpty(): myAddress = " + myAddress);
|
||||
|
||||
// Can only mint if have registered a name
|
||||
if (blockchainHeight >= nameCheckHeight && blockchainHeight < groupCheckHeight && level >= levelToMint && !myName.isEmpty())
|
||||
if (blockchainHeight >= nameCheckHeight && blockchainHeight < groupCheckHeight && level >= levelToMint && !nameRepository.getNamesByOwner(myAddress).isEmpty())
|
||||
return true;
|
||||
|
||||
// Can only mint if have registered a name and is member of minter group id
|
||||
if (blockchainHeight >= groupCheckHeight && blockchainHeight < removeNameCheckHeight && level >= levelToMint && !myName.isEmpty() && isMember)
|
||||
if (blockchainHeight >= groupCheckHeight && blockchainHeight < removeNameCheckHeight && level >= levelToMint && groupRepository.memberExists(groupIdToMint, myAddress) && !nameRepository.getNamesByOwner(myAddress).isEmpty() && groupRepository.memberExists(groupIdToMint, myAddress))
|
||||
return true;
|
||||
|
||||
// Can only mint if is member of minter group id
|
||||
if (blockchainHeight >= removeNameCheckHeight && level >= levelToMint && isMember)
|
||||
if (blockchainHeight >= removeNameCheckHeight && level >= levelToMint && groupRepository.memberExists(groupIdToMint, myAddress))
|
||||
return true;
|
||||
|
||||
// if you aren't a legit founder by this point, then you can't mint
|
||||
if( !(Account.isFounder(accountData.getFlags()) &&
|
||||
accountData.getBlocksMintedPenalty() == 0))
|
||||
return false;
|
||||
|
||||
if (blockchainHeight < nameCheckHeight )
|
||||
return true;
|
||||
|
||||
// Founders needs to pass same tests like minters
|
||||
if (blockchainHeight < nameCheckHeight &&
|
||||
Account.isFounder(accountData.getFlags()) &&
|
||||
accountData.getBlocksMintedPenalty() == 0)
|
||||
return true;
|
||||
|
||||
if (blockchainHeight >= nameCheckHeight &&
|
||||
blockchainHeight < groupCheckHeight &&
|
||||
Account.isFounder(accountData.getFlags()) &&
|
||||
accountData.getBlocksMintedPenalty() == 0 &&
|
||||
!myName.isEmpty())
|
||||
!nameRepository.getNamesByOwner(myAddress).isEmpty())
|
||||
return true;
|
||||
|
||||
if (blockchainHeight >= groupCheckHeight &&
|
||||
blockchainHeight < removeNameCheckHeight &&
|
||||
Account.isFounder(accountData.getFlags()) &&
|
||||
accountData.getBlocksMintedPenalty() == 0 &&
|
||||
!myName.isEmpty() &&
|
||||
isMember)
|
||||
!nameRepository.getNamesByOwner(myAddress).isEmpty() &&
|
||||
groupRepository.memberExists(groupIdToMint, myAddress))
|
||||
return true;
|
||||
|
||||
if (blockchainHeight >= removeNameCheckHeight &&
|
||||
Account.isFounder(accountData.getFlags()) &&
|
||||
accountData.getBlocksMintedPenalty() == 0 &&
|
||||
isMember)
|
||||
groupRepository.memberExists(groupIdToMint, myAddress))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
@ -1,8 +1,5 @@
|
||||
package org.qortal.repository.hsqldb;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.qortal.account.Account;
|
||||
import org.qortal.data.naming.NameData;
|
||||
import org.qortal.repository.DataException;
|
||||
import org.qortal.repository.NameRepository;
|
||||
@ -14,8 +11,6 @@ import java.util.List;
|
||||
|
||||
public class HSQLDBNameRepository implements NameRepository {
|
||||
|
||||
private static final Logger LOGGER = LogManager.getLogger(HSQLDBNameRepository.class);
|
||||
|
||||
protected HSQLDBRepository repository;
|
||||
|
||||
public HSQLDBNameRepository(HSQLDBRepository repository) {
|
||||
@ -269,8 +264,6 @@ public class HSQLDBNameRepository implements NameRepository {
|
||||
|
||||
@Override
|
||||
public List<NameData> getNamesByOwner(String owner, Integer limit, Integer offset, Boolean reverse) throws DataException {
|
||||
LOGGER.info("Executing getNamesByOwner: owner = " + owner);
|
||||
|
||||
StringBuilder sql = new StringBuilder(512);
|
||||
|
||||
sql.append("SELECT name, reduced_name, data, registered_when, updated_when, "
|
||||
@ -313,8 +306,6 @@ public class HSQLDBNameRepository implements NameRepository {
|
||||
return names;
|
||||
} catch (SQLException e) {
|
||||
throw new DataException("Unable to fetch account's names from repository", e);
|
||||
} finally {
|
||||
LOGGER.info("Executed getNamesByOwner: owner = " + owner);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user