mirror of
https://github.com/Qortal/qortal.git
synced 2025-04-30 06:47:50 +00:00
Merge remote-tracking branch 'origin/master' into reticulum
This commit is contained in:
commit
85e92dbfdd
6
pom.xml
6
pom.xml
@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.qortal</groupId>
|
||||
<artifactId>qortal</artifactId>
|
||||
<version>4.6.3</version>
|
||||
<version>4.6.5</version>
|
||||
<packaging>jar</packaging>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
@ -16,7 +16,7 @@
|
||||
<ciyam-at.version>1.4.2</ciyam-at.version>
|
||||
<commons-net.version>3.8.0</commons-net.version>
|
||||
<commons-text.version>1.12.0</commons-text.version>
|
||||
<commons-io.version>2.17.0</commons-io.version>
|
||||
<commons-io.version>2.18.0</commons-io.version>
|
||||
<commons-compress.version>1.27.1</commons-compress.version>
|
||||
<commons-lang3.version>3.17.0</commons-lang3.version>
|
||||
<dagger.version>1.2.2</dagger.version>
|
||||
@ -28,7 +28,7 @@
|
||||
<homoglyph.version>1.2.1</homoglyph.version>
|
||||
<hsqldb.version>2.7.4</hsqldb.version>
|
||||
<icu4j.version>76.1</icu4j.version>
|
||||
<java-diff-utils.version>4.12</java-diff-utils.version>
|
||||
<java-diff-utils.version>4.15</java-diff-utils.version>
|
||||
<javax.servlet-api.version>4.0.1</javax.servlet-api.version>
|
||||
<jaxb-runtime.version>2.3.9</jaxb-runtime.version>
|
||||
<jersey.version>2.42</jersey.version>
|
||||
|
@ -205,10 +205,11 @@ public class Account {
|
||||
* <li>account's address is a member of the minter group</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param isGroupValidated true if this account has already been validated for MINTER Group membership
|
||||
* @return true if account can be considered "minting account"
|
||||
* @throws DataException
|
||||
*/
|
||||
public boolean canMint() throws DataException {
|
||||
public boolean canMint(boolean isGroupValidated) throws DataException {
|
||||
AccountData accountData = this.repository.getAccountRepository().getAccount(this.address);
|
||||
NameRepository nameRepository = this.repository.getNameRepository();
|
||||
GroupRepository groupRepository = this.repository.getGroupRepository();
|
||||
@ -251,9 +252,9 @@ public class Account {
|
||||
if (blockchainHeight >= groupCheckHeight && blockchainHeight < removeNameCheckHeight) {
|
||||
List<NameData> myName = nameRepository.getNamesByOwner(myAddress);
|
||||
if (Account.isFounder(accountData.getFlags())) {
|
||||
return accountData.getBlocksMintedPenalty() == 0 && !myName.isEmpty() && groupRepository.memberExists(groupIdToMint, myAddress);
|
||||
return accountData.getBlocksMintedPenalty() == 0 && !myName.isEmpty() && (isGroupValidated || groupRepository.memberExists(groupIdToMint, myAddress));
|
||||
} else {
|
||||
return level >= levelToMint && !myName.isEmpty() && groupRepository.memberExists(groupIdToMint, myAddress);
|
||||
return level >= levelToMint && !myName.isEmpty() && (isGroupValidated || groupRepository.memberExists(groupIdToMint, myAddress));
|
||||
}
|
||||
}
|
||||
|
||||
@ -262,9 +263,9 @@ public class Account {
|
||||
// Account's address is a member of the minter group
|
||||
if (blockchainHeight >= removeNameCheckHeight) {
|
||||
if (Account.isFounder(accountData.getFlags())) {
|
||||
return accountData.getBlocksMintedPenalty() == 0 && groupRepository.memberExists(groupIdToMint, myAddress);
|
||||
return accountData.getBlocksMintedPenalty() == 0 && (isGroupValidated || groupRepository.memberExists(groupIdToMint, myAddress));
|
||||
} else {
|
||||
return level >= levelToMint && groupRepository.memberExists(groupIdToMint, myAddress);
|
||||
return level >= levelToMint && (isGroupValidated || groupRepository.memberExists(groupIdToMint, myAddress));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -459,7 +459,7 @@ public class AdminResource {
|
||||
|
||||
// Qortal: check reward-share's minting account is still allowed to mint
|
||||
Account rewardShareMintingAccount = new Account(repository, rewardShareData.getMinter());
|
||||
if (!rewardShareMintingAccount.canMint())
|
||||
if (!rewardShareMintingAccount.canMint(false))
|
||||
throw ApiExceptionFactory.INSTANCE.createException(request, ApiError.CANNOT_MINT);
|
||||
|
||||
MintingAccountData mintingAccountData = new MintingAccountData(mintingAccount.getPrivateKey(), mintingAccount.getPublicKey());
|
||||
|
@ -25,10 +25,7 @@ import org.qortal.data.block.BlockSummaryData;
|
||||
import org.qortal.data.block.BlockTransactionData;
|
||||
import org.qortal.data.network.OnlineAccountData;
|
||||
import org.qortal.data.transaction.TransactionData;
|
||||
import org.qortal.repository.ATRepository;
|
||||
import org.qortal.repository.DataException;
|
||||
import org.qortal.repository.Repository;
|
||||
import org.qortal.repository.TransactionRepository;
|
||||
import org.qortal.repository.*;
|
||||
import org.qortal.settings.Settings;
|
||||
import org.qortal.transaction.AtTransaction;
|
||||
import org.qortal.transaction.Transaction;
|
||||
@ -144,10 +141,13 @@ public class Block {
|
||||
private final Account mintingAccount;
|
||||
private final AccountData mintingAccountData;
|
||||
private final boolean isMinterFounder;
|
||||
private final boolean isMinterMember;
|
||||
|
||||
private final Account recipientAccount;
|
||||
private final AccountData recipientAccountData;
|
||||
|
||||
final BlockChain blockChain = BlockChain.getInstance();
|
||||
|
||||
ExpandedAccount(Repository repository, RewardShareData rewardShareData) throws DataException {
|
||||
this.rewardShareData = rewardShareData;
|
||||
this.sharePercent = this.rewardShareData.getSharePercent();
|
||||
@ -157,6 +157,7 @@ public class Block {
|
||||
this.isMinterFounder = Account.isFounder(mintingAccountData.getFlags());
|
||||
|
||||
this.isRecipientAlsoMinter = this.rewardShareData.getRecipient().equals(this.mintingAccount.getAddress());
|
||||
this.isMinterMember = repository.getGroupRepository().memberExists(BlockChain.getInstance().getMintingGroupId(), this.mintingAccount.getAddress());
|
||||
|
||||
if (this.isRecipientAlsoMinter) {
|
||||
// Self-share: minter is also recipient
|
||||
@ -192,8 +193,12 @@ public class Block {
|
||||
if (accountLevel <= 0)
|
||||
return null; // level 0 isn't included in any share bins
|
||||
|
||||
if (blockHeight >= blockChain.getFixBatchRewardHeight()) {
|
||||
if (!this.isMinterMember)
|
||||
return null; // not member of minter group isn't included in any share bins
|
||||
}
|
||||
|
||||
// Select the correct set of share bins based on block height
|
||||
final BlockChain blockChain = BlockChain.getInstance();
|
||||
final AccountLevelShareBin[] shareBinsByLevel = (blockHeight >= blockChain.getSharesByLevelV2Height()) ?
|
||||
blockChain.getShareBinsByAccountLevelV2() : blockChain.getShareBinsByAccountLevelV1();
|
||||
|
||||
@ -715,8 +720,18 @@ public class Block {
|
||||
|
||||
List<ExpandedAccount> expandedAccounts = new ArrayList<>();
|
||||
|
||||
for (RewardShareData rewardShare : this.cachedOnlineRewardShares)
|
||||
expandedAccounts.add(new ExpandedAccount(repository, rewardShare));
|
||||
for (RewardShareData rewardShare : this.cachedOnlineRewardShares) {
|
||||
if (this.getBlockData().getHeight() < BlockChain.getInstance().getFixBatchRewardHeight()) {
|
||||
expandedAccounts.add(new ExpandedAccount(repository, rewardShare));
|
||||
}
|
||||
if (this.getBlockData().getHeight() >= BlockChain.getInstance().getFixBatchRewardHeight()) {
|
||||
boolean isMinterGroupMember = repository.getGroupRepository().memberExists(BlockChain.getInstance().getMintingGroupId(), rewardShare.getMinter());
|
||||
if (isMinterGroupMember) {
|
||||
expandedAccounts.add(new ExpandedAccount(repository, rewardShare));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.cachedExpandedAccounts = expandedAccounts;
|
||||
|
||||
@ -1518,7 +1533,7 @@ public class Block {
|
||||
return false;
|
||||
|
||||
Account mintingAccount = new PublicKeyAccount(this.repository, rewardShareData.getMinterPublicKey());
|
||||
return mintingAccount.canMint();
|
||||
return mintingAccount.canMint(false);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2213,6 +2228,7 @@ public class Block {
|
||||
List<AccountBalanceData> accountBalanceDeltas = balanceChanges.entrySet().stream()
|
||||
.map(entry -> new AccountBalanceData(entry.getKey(), Asset.QORT, entry.getValue()))
|
||||
.collect(Collectors.toList());
|
||||
LOGGER.trace("Account Balance Deltas: {}", accountBalanceDeltas);
|
||||
this.repository.getAccountRepository().modifyAssetBalances(accountBalanceDeltas);
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,8 @@ public class BlockChain {
|
||||
enableRewardshareHeight,
|
||||
onlyMintWithNameHeight,
|
||||
removeOnlyMintWithNameHeight,
|
||||
groupMemberCheckHeight
|
||||
groupMemberCheckHeight,
|
||||
fixBatchRewardHeight
|
||||
}
|
||||
|
||||
// Custom transaction fees
|
||||
@ -657,6 +658,10 @@ public class BlockChain {
|
||||
return this.featureTriggers.get(FeatureTrigger.groupMemberCheckHeight.name()).intValue();
|
||||
}
|
||||
|
||||
public int getFixBatchRewardHeight() {
|
||||
return this.featureTriggers.get(FeatureTrigger.fixBatchRewardHeight.name()).intValue();
|
||||
}
|
||||
|
||||
// More complex getters for aspects that change by height or timestamp
|
||||
|
||||
public long getRewardAtHeight(int ourHeight) {
|
||||
|
@ -148,7 +148,7 @@ public class BlockMinter extends Thread {
|
||||
}
|
||||
|
||||
Account mintingAccount = new Account(repository, rewardShareData.getMinter());
|
||||
if (!mintingAccount.canMint()) {
|
||||
if (!mintingAccount.canMint(true)) {
|
||||
// Minting-account component of reward-share can no longer mint - disregard
|
||||
madi.remove();
|
||||
continue;
|
||||
|
@ -13,6 +13,7 @@ import org.qortal.crypto.MemoryPoW;
|
||||
import org.qortal.crypto.Qortal25519Extras;
|
||||
import org.qortal.data.account.MintingAccountData;
|
||||
import org.qortal.data.account.RewardShareData;
|
||||
import org.qortal.data.group.GroupMemberData;
|
||||
import org.qortal.data.network.OnlineAccountData;
|
||||
import org.qortal.network.Network;
|
||||
import org.qortal.network.Peer;
|
||||
@ -224,6 +225,12 @@ public class OnlineAccountsManager {
|
||||
Set<OnlineAccountData> onlineAccountsToAdd = new HashSet<>();
|
||||
Set<OnlineAccountData> onlineAccountsToRemove = new HashSet<>();
|
||||
try (final Repository repository = RepositoryManager.getRepository()) {
|
||||
List<String> mintingGroupMemberAddresses
|
||||
= repository.getGroupRepository()
|
||||
.getGroupMembers(BlockChain.getInstance().getMintingGroupId()).stream()
|
||||
.map(GroupMemberData::getMember)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
for (OnlineAccountData onlineAccountData : this.onlineAccountsImportQueue) {
|
||||
if (isStopping)
|
||||
return;
|
||||
@ -236,7 +243,7 @@ public class OnlineAccountsManager {
|
||||
continue;
|
||||
}
|
||||
|
||||
boolean isValid = this.isValidCurrentAccount(repository, onlineAccountData);
|
||||
boolean isValid = this.isValidCurrentAccount(repository, mintingGroupMemberAddresses, onlineAccountData);
|
||||
if (isValid)
|
||||
onlineAccountsToAdd.add(onlineAccountData);
|
||||
|
||||
@ -315,7 +322,7 @@ public class OnlineAccountsManager {
|
||||
return inplaceArray;
|
||||
}
|
||||
|
||||
private static boolean isValidCurrentAccount(Repository repository, OnlineAccountData onlineAccountData) throws DataException {
|
||||
private static boolean isValidCurrentAccount(Repository repository, List<String> mintingGroupMemberAddresses, OnlineAccountData onlineAccountData) throws DataException {
|
||||
final Long now = NTP.getTime();
|
||||
if (now == null)
|
||||
return false;
|
||||
@ -350,9 +357,14 @@ public class OnlineAccountsManager {
|
||||
LOGGER.trace(() -> String.format("Rejecting unknown online reward-share public key %s", Base58.encode(rewardSharePublicKey)));
|
||||
return false;
|
||||
}
|
||||
// reject account address that are not in the MINTER Group
|
||||
else if( !mintingGroupMemberAddresses.contains(rewardShareData.getMinter())) {
|
||||
LOGGER.trace(() -> String.format("Rejecting online reward-share that is not in MINTER Group, account %s", rewardShareData.getMinter()));
|
||||
return false;
|
||||
}
|
||||
|
||||
Account mintingAccount = new Account(repository, rewardShareData.getMinter());
|
||||
if (!mintingAccount.canMint()) {
|
||||
if (!mintingAccount.canMint(true)) { // group validation is a few lines above
|
||||
// Minting-account component of reward-share can no longer mint - disregard
|
||||
LOGGER.trace(() -> String.format("Rejecting online reward-share with non-minting account %s", mintingAccount.getAddress()));
|
||||
return false;
|
||||
@ -539,7 +551,7 @@ public class OnlineAccountsManager {
|
||||
}
|
||||
|
||||
Account mintingAccount = new Account(repository, rewardShareData.getMinter());
|
||||
if (!mintingAccount.canMint()) {
|
||||
if (!mintingAccount.canMint(true)) {
|
||||
// Minting-account component of reward-share can no longer mint - disregard
|
||||
iterator.remove();
|
||||
continue;
|
||||
|
@ -4,10 +4,15 @@ import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.qortal.network.Network;
|
||||
import org.qortal.network.Peer;
|
||||
import org.qortal.utils.DaemonThreadFactory;
|
||||
import org.qortal.utils.ExecuteProduceConsume.Task;
|
||||
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
public class PeerConnectTask implements Task {
|
||||
private static final Logger LOGGER = LogManager.getLogger(PeerConnectTask.class);
|
||||
private static final ExecutorService connectionExecutor = Executors.newCachedThreadPool(new DaemonThreadFactory(8));
|
||||
|
||||
private final Peer peer;
|
||||
private final String name;
|
||||
@ -24,6 +29,24 @@ public class PeerConnectTask implements Task {
|
||||
|
||||
@Override
|
||||
public void perform() throws InterruptedException {
|
||||
Network.getInstance().connectPeer(peer);
|
||||
// Submit connection task to a dedicated thread pool for non-blocking I/O
|
||||
connectionExecutor.submit(() -> {
|
||||
try {
|
||||
connectPeerAsync(peer);
|
||||
} catch (InterruptedException e) {
|
||||
LOGGER.error("Connection attempt interrupted for peer {}", peer, e);
|
||||
Thread.currentThread().interrupt(); // Reset interrupt flag
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void connectPeerAsync(Peer peer) throws InterruptedException {
|
||||
// Perform peer connection in a separate thread to avoid blocking main task execution
|
||||
try {
|
||||
Network.getInstance().connectPeer(peer);
|
||||
LOGGER.trace("Successfully connected to peer {}", peer);
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Error connecting to peer {}", peer, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -213,7 +213,7 @@ public class Settings {
|
||||
public long recoveryModeTimeout = 9999999999999L;
|
||||
|
||||
/** Minimum peer version number required in order to sync with them */
|
||||
private String minPeerVersion = "4.6.2";
|
||||
private String minPeerVersion = "4.6.3";
|
||||
/** Whether to allow connections with peers below minPeerVersion
|
||||
* If true, we won't sync with them but they can still sync with us, and will show in the peers list
|
||||
* If false, sync will be blocked both ways, and they will not appear in the peers list */
|
||||
|
@ -123,7 +123,7 @@ public class RewardShareTransaction extends Transaction {
|
||||
final boolean isCancellingSharePercent = this.rewardShareTransactionData.getSharePercent() < 0;
|
||||
|
||||
// Creator themselves needs to be allowed to mint (unless cancelling)
|
||||
if (!isCancellingSharePercent && !creator.canMint())
|
||||
if (!isCancellingSharePercent && !creator.canMint(false))
|
||||
return ValidationResult.NOT_MINTING_ACCOUNT;
|
||||
|
||||
// Qortal: special rules in play depending whether recipient is also minter
|
||||
|
@ -112,7 +112,8 @@
|
||||
"enableRewardshareHeight": 1905100,
|
||||
"onlyMintWithNameHeight": 1900300,
|
||||
"removeOnlyMintWithNameHeight": 1935500,
|
||||
"groupMemberCheckHeight": 1902700
|
||||
"groupMemberCheckHeight": 1902700,
|
||||
"fixBatchRewardHeight": 1945900
|
||||
},
|
||||
"checkpoints": [
|
||||
{ "height": 1136300, "signature": "3BbwawEF2uN8Ni5ofpJXkukoU8ctAPxYoFB7whq9pKfBnjfZcpfEJT4R95NvBDoTP8WDyWvsUvbfHbcr9qSZuYpSKZjUQTvdFf6eqznHGEwhZApWfvXu6zjGCxYCp65F4jsVYYJjkzbjmkCg5WAwN5voudngA23kMK6PpTNygapCzXt" }
|
||||
|
@ -74,7 +74,7 @@ public class TransferPrivsTests extends Common {
|
||||
public void testAliceIntoNewAccountTransferPrivs() throws DataException {
|
||||
try (final Repository repository = RepositoryManager.getRepository()) {
|
||||
TestAccount alice = Common.getTestAccount(repository, "alice");
|
||||
assertTrue(alice.canMint());
|
||||
assertTrue(alice.canMint(false));
|
||||
|
||||
PrivateKeyAccount aliceMintingAccount = Common.getTestAccount(repository, "alice-reward-share");
|
||||
|
||||
@ -86,8 +86,8 @@ public class TransferPrivsTests extends Common {
|
||||
|
||||
combineAccounts(repository, alice, randomAccount, aliceMintingAccount);
|
||||
|
||||
assertFalse(alice.canMint());
|
||||
assertTrue(randomAccount.canMint());
|
||||
assertFalse(alice.canMint(false));
|
||||
assertTrue(randomAccount.canMint(false));
|
||||
}
|
||||
}
|
||||
|
||||
@ -97,8 +97,8 @@ public class TransferPrivsTests extends Common {
|
||||
TestAccount alice = Common.getTestAccount(repository, "alice");
|
||||
TestAccount dilbert = Common.getTestAccount(repository, "dilbert");
|
||||
|
||||
assertTrue(alice.canMint());
|
||||
assertTrue(dilbert.canMint());
|
||||
assertTrue(alice.canMint(false));
|
||||
assertTrue(dilbert.canMint(false));
|
||||
|
||||
// Dilbert has level, Alice does not so we need Alice to mint enough blocks to bump Dilbert's level post-combine
|
||||
final int expectedPostCombineLevel = dilbert.getLevel() + 1;
|
||||
@ -118,11 +118,11 @@ public class TransferPrivsTests extends Common {
|
||||
|
||||
// Post-combine sender checks
|
||||
checkSenderPostTransfer(postCombineAliceData);
|
||||
assertFalse(alice.canMint());
|
||||
assertFalse(alice.canMint(false));
|
||||
|
||||
// Post-combine recipient checks
|
||||
checkRecipientPostTransfer(preCombineAliceData, preCombineDilbertData, postCombineDilbertData, expectedPostCombineLevel);
|
||||
assertTrue(dilbert.canMint());
|
||||
assertTrue(dilbert.canMint(false));
|
||||
|
||||
// Orphan previous block
|
||||
BlockUtils.orphanLastBlock(repository);
|
||||
@ -130,12 +130,12 @@ public class TransferPrivsTests extends Common {
|
||||
// Sender checks
|
||||
AccountData orphanedAliceData = repository.getAccountRepository().getAccount(alice.getAddress());
|
||||
checkAccountDataRestored("sender", preCombineAliceData, orphanedAliceData);
|
||||
assertTrue(alice.canMint());
|
||||
assertTrue(alice.canMint(false));
|
||||
|
||||
// Recipient checks
|
||||
AccountData orphanedDilbertData = repository.getAccountRepository().getAccount(dilbert.getAddress());
|
||||
checkAccountDataRestored("recipient", preCombineDilbertData, orphanedDilbertData);
|
||||
assertTrue(dilbert.canMint());
|
||||
assertTrue(dilbert.canMint(false));
|
||||
}
|
||||
}
|
||||
|
||||
@ -145,8 +145,8 @@ public class TransferPrivsTests extends Common {
|
||||
TestAccount alice = Common.getTestAccount(repository, "alice");
|
||||
TestAccount dilbert = Common.getTestAccount(repository, "dilbert");
|
||||
|
||||
assertTrue(dilbert.canMint());
|
||||
assertTrue(alice.canMint());
|
||||
assertTrue(dilbert.canMint(false));
|
||||
assertTrue(alice.canMint(false));
|
||||
|
||||
// Dilbert has level, Alice does not so we need Alice to mint enough blocks to surpass Dilbert's level post-combine
|
||||
final int expectedPostCombineLevel = dilbert.getLevel() + 1;
|
||||
@ -166,11 +166,11 @@ public class TransferPrivsTests extends Common {
|
||||
|
||||
// Post-combine sender checks
|
||||
checkSenderPostTransfer(postCombineDilbertData);
|
||||
assertFalse(dilbert.canMint());
|
||||
assertFalse(dilbert.canMint(false));
|
||||
|
||||
// Post-combine recipient checks
|
||||
checkRecipientPostTransfer(preCombineDilbertData, preCombineAliceData, postCombineAliceData, expectedPostCombineLevel);
|
||||
assertTrue(alice.canMint());
|
||||
assertTrue(alice.canMint(false));
|
||||
|
||||
// Orphan previous block
|
||||
BlockUtils.orphanLastBlock(repository);
|
||||
@ -178,12 +178,12 @@ public class TransferPrivsTests extends Common {
|
||||
// Sender checks
|
||||
AccountData orphanedDilbertData = repository.getAccountRepository().getAccount(dilbert.getAddress());
|
||||
checkAccountDataRestored("sender", preCombineDilbertData, orphanedDilbertData);
|
||||
assertTrue(dilbert.canMint());
|
||||
assertTrue(dilbert.canMint(false));
|
||||
|
||||
// Recipient checks
|
||||
AccountData orphanedAliceData = repository.getAccountRepository().getAccount(alice.getAddress());
|
||||
checkAccountDataRestored("recipient", preCombineAliceData, orphanedAliceData);
|
||||
assertTrue(alice.canMint());
|
||||
assertTrue(alice.canMint(false));
|
||||
}
|
||||
}
|
||||
|
||||
@ -202,8 +202,8 @@ public class TransferPrivsTests extends Common {
|
||||
TestAccount chloe = Common.getTestAccount(repository, "chloe");
|
||||
TestAccount dilbert = Common.getTestAccount(repository, "dilbert");
|
||||
|
||||
assertTrue(dilbert.canMint());
|
||||
assertFalse(chloe.canMint());
|
||||
assertTrue(dilbert.canMint(false));
|
||||
assertFalse(chloe.canMint(false));
|
||||
|
||||
// COMBINE DILBERT INTO CHLOE
|
||||
|
||||
@ -225,16 +225,16 @@ public class TransferPrivsTests extends Common {
|
||||
|
||||
// Post-combine sender checks
|
||||
checkSenderPostTransfer(post1stCombineDilbertData);
|
||||
assertFalse(dilbert.canMint());
|
||||
assertFalse(dilbert.canMint(false));
|
||||
|
||||
// Post-combine recipient checks
|
||||
checkRecipientPostTransfer(pre1stCombineDilbertData, pre1stCombineChloeData, post1stCombineChloeData, expectedPost1stCombineLevel);
|
||||
assertTrue(chloe.canMint());
|
||||
assertTrue(chloe.canMint(false));
|
||||
|
||||
// COMBINE ALICE INTO CHLOE
|
||||
|
||||
assertTrue(alice.canMint());
|
||||
assertTrue(chloe.canMint());
|
||||
assertTrue(alice.canMint(false));
|
||||
assertTrue(chloe.canMint(false));
|
||||
|
||||
// Alice needs to mint enough blocks to surpass Chloe's level post-combine
|
||||
final int expectedPost2ndCombineLevel = chloe.getLevel() + 1;
|
||||
@ -254,11 +254,11 @@ public class TransferPrivsTests extends Common {
|
||||
|
||||
// Post-combine sender checks
|
||||
checkSenderPostTransfer(post2ndCombineAliceData);
|
||||
assertFalse(alice.canMint());
|
||||
assertFalse(alice.canMint(false));
|
||||
|
||||
// Post-combine recipient checks
|
||||
checkRecipientPostTransfer(pre2ndCombineAliceData, pre2ndCombineChloeData, post2ndCombineChloeData, expectedPost2ndCombineLevel);
|
||||
assertTrue(chloe.canMint());
|
||||
assertTrue(chloe.canMint(false));
|
||||
|
||||
// Orphan 2nd combine
|
||||
BlockUtils.orphanLastBlock(repository);
|
||||
@ -266,12 +266,12 @@ public class TransferPrivsTests extends Common {
|
||||
// Sender checks
|
||||
AccountData orphanedAliceData = repository.getAccountRepository().getAccount(alice.getAddress());
|
||||
checkAccountDataRestored("sender", pre2ndCombineAliceData, orphanedAliceData);
|
||||
assertTrue(alice.canMint());
|
||||
assertTrue(alice.canMint(false));
|
||||
|
||||
// Recipient checks
|
||||
AccountData orphanedChloeData = repository.getAccountRepository().getAccount(chloe.getAddress());
|
||||
checkAccountDataRestored("recipient", pre2ndCombineChloeData, orphanedChloeData);
|
||||
assertTrue(chloe.canMint());
|
||||
assertTrue(chloe.canMint(false));
|
||||
|
||||
// Orphan 1nd combine
|
||||
BlockUtils.orphanToBlock(repository, pre1stCombineBlockHeight);
|
||||
@ -279,7 +279,7 @@ public class TransferPrivsTests extends Common {
|
||||
// Sender checks
|
||||
AccountData orphanedDilbertData = repository.getAccountRepository().getAccount(dilbert.getAddress());
|
||||
checkAccountDataRestored("sender", pre1stCombineDilbertData, orphanedDilbertData);
|
||||
assertTrue(dilbert.canMint());
|
||||
assertTrue(dilbert.canMint(false));
|
||||
|
||||
// Recipient checks
|
||||
orphanedChloeData = repository.getAccountRepository().getAccount(chloe.getAddress());
|
||||
@ -287,7 +287,7 @@ public class TransferPrivsTests extends Common {
|
||||
|
||||
// Chloe canMint() would return true here due to Alice-Chloe reward-share minting at top of method, so undo that minting by orphaning back to block 1
|
||||
BlockUtils.orphanToBlock(repository, 1);
|
||||
assertFalse(chloe.canMint());
|
||||
assertFalse(chloe.canMint(false));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user