forked from Qortal/qortal
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();
|
int removeNameCheckHeight = BlockChain.getInstance().getRemoveOnlyMintWithNameHeight();
|
||||||
|
|
||||||
String myAddress = accountData.getAddress();
|
String myAddress = accountData.getAddress();
|
||||||
List<NameData> myName = nameRepository.getNamesByOwner(myAddress);
|
|
||||||
boolean isMember = groupRepository.memberExists(groupIdToMint, myAddress);
|
|
||||||
|
|
||||||
if (accountData == null)
|
if (accountData == null)
|
||||||
return false;
|
return false;
|
||||||
@ -232,45 +230,40 @@ public class Account {
|
|||||||
if (blockchainHeight < nameCheckHeight && level >= levelToMint)
|
if (blockchainHeight < nameCheckHeight && level >= levelToMint)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
LOGGER.info("Calling myName.isEmpty(): myAddress = " + myAddress);
|
|
||||||
|
|
||||||
// Can only mint if have registered a name
|
// 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;
|
return true;
|
||||||
|
|
||||||
// Can only mint if have registered a name and is member of minter group id
|
// 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;
|
return true;
|
||||||
|
|
||||||
// Can only mint if is member of minter group id
|
// 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;
|
return true;
|
||||||
|
|
||||||
// Founders needs to pass same tests like minters
|
// Founders needs to pass same tests like minters
|
||||||
if (blockchainHeight < nameCheckHeight &&
|
|
||||||
Account.isFounder(accountData.getFlags()) &&
|
|
||||||
accountData.getBlocksMintedPenalty() == 0)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
if (blockchainHeight >= nameCheckHeight &&
|
if (blockchainHeight >= nameCheckHeight &&
|
||||||
blockchainHeight < groupCheckHeight &&
|
blockchainHeight < groupCheckHeight &&
|
||||||
Account.isFounder(accountData.getFlags()) &&
|
!nameRepository.getNamesByOwner(myAddress).isEmpty())
|
||||||
accountData.getBlocksMintedPenalty() == 0 &&
|
|
||||||
!myName.isEmpty())
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (blockchainHeight >= groupCheckHeight &&
|
if (blockchainHeight >= groupCheckHeight &&
|
||||||
blockchainHeight < removeNameCheckHeight &&
|
blockchainHeight < removeNameCheckHeight &&
|
||||||
Account.isFounder(accountData.getFlags()) &&
|
!nameRepository.getNamesByOwner(myAddress).isEmpty() &&
|
||||||
accountData.getBlocksMintedPenalty() == 0 &&
|
groupRepository.memberExists(groupIdToMint, myAddress))
|
||||||
!myName.isEmpty() &&
|
|
||||||
isMember)
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (blockchainHeight >= removeNameCheckHeight &&
|
if (blockchainHeight >= removeNameCheckHeight &&
|
||||||
Account.isFounder(accountData.getFlags()) &&
|
groupRepository.memberExists(groupIdToMint, myAddress))
|
||||||
accountData.getBlocksMintedPenalty() == 0 &&
|
|
||||||
isMember)
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
package org.qortal.repository.hsqldb;
|
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.data.naming.NameData;
|
||||||
import org.qortal.repository.DataException;
|
import org.qortal.repository.DataException;
|
||||||
import org.qortal.repository.NameRepository;
|
import org.qortal.repository.NameRepository;
|
||||||
@ -14,8 +11,6 @@ import java.util.List;
|
|||||||
|
|
||||||
public class HSQLDBNameRepository implements NameRepository {
|
public class HSQLDBNameRepository implements NameRepository {
|
||||||
|
|
||||||
private static final Logger LOGGER = LogManager.getLogger(HSQLDBNameRepository.class);
|
|
||||||
|
|
||||||
protected HSQLDBRepository repository;
|
protected HSQLDBRepository repository;
|
||||||
|
|
||||||
public HSQLDBNameRepository(HSQLDBRepository repository) {
|
public HSQLDBNameRepository(HSQLDBRepository repository) {
|
||||||
@ -269,8 +264,6 @@ public class HSQLDBNameRepository implements NameRepository {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<NameData> getNamesByOwner(String owner, Integer limit, Integer offset, Boolean reverse) throws DataException {
|
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);
|
StringBuilder sql = new StringBuilder(512);
|
||||||
|
|
||||||
sql.append("SELECT name, reduced_name, data, registered_when, updated_when, "
|
sql.append("SELECT name, reduced_name, data, registered_when, updated_when, "
|
||||||
@ -313,8 +306,6 @@ public class HSQLDBNameRepository implements NameRepository {
|
|||||||
return names;
|
return names;
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
throw new DataException("Unable to fetch account's names from repository", 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