mirror of
https://github.com/Qortal/qortal.git
synced 2025-07-23 04:36:50 +00:00
Fix potentially overflowing multiply in Block reward processing.
Change BlockChain config to use AmountTypeAdapter instead of creating duplicated long versions of BigDecimal values. Some tidying to Amounts class.
This commit is contained in:
@@ -13,7 +13,7 @@ public abstract class TestTransaction {
|
||||
protected static final Random random = new Random();
|
||||
|
||||
public static BaseTransactionData generateBase(PrivateKeyAccount account) throws DataException {
|
||||
return new BaseTransactionData(System.currentTimeMillis(), Group.NO_GROUP, account.getLastReference(), account.getPublicKey(), BlockChain.getInstance().getUnscaledUnitFee(), null);
|
||||
return new BaseTransactionData(System.currentTimeMillis(), Group.NO_GROUP, account.getLastReference(), account.getPublicKey(), BlockChain.getInstance().getUnitFee(), null);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -71,7 +71,7 @@ public class RewardTests extends Common {
|
||||
|
||||
BlockUtils.mintBlock(repository);
|
||||
|
||||
expectedBalance += rewardInfo.unscaledReward;
|
||||
expectedBalance += rewardInfo.reward;
|
||||
}
|
||||
|
||||
AccountUtils.assertBalance(repository, "alice", Asset.QORT, expectedBalance);
|
||||
@@ -106,8 +106,8 @@ public class RewardTests extends Common {
|
||||
public void testLegacyQoraReward() throws DataException {
|
||||
Common.useSettings("test-settings-v2-qora-holder.json");
|
||||
|
||||
long qoraHoldersShare = BlockChain.getInstance().getQoraHoldersUnscaledShare();
|
||||
long qoraPerQort = BlockChain.getInstance().getUnscaledQoraPerQortReward();
|
||||
long qoraHoldersShare = BlockChain.getInstance().getQoraHoldersShare();
|
||||
long qoraPerQort = BlockChain.getInstance().getQoraPerQortReward();
|
||||
|
||||
try (final Repository repository = RepositoryManager.getRepository()) {
|
||||
Map<String, Map<Long, Long>> initialBalances = AccountUtils.getBalances(repository, Asset.QORT, Asset.LEGACY_QORA, Asset.QORT_FROM_QORA);
|
||||
@@ -161,7 +161,7 @@ public class RewardTests extends Common {
|
||||
public void testMaxLegacyQoraReward() throws DataException {
|
||||
Common.useSettings("test-settings-v2-qora-holder.json");
|
||||
|
||||
long qoraPerQort = BlockChain.getInstance().getUnscaledQoraPerQortReward();
|
||||
long qoraPerQort = BlockChain.getInstance().getQoraPerQortReward();
|
||||
|
||||
try (final Repository repository = RepositoryManager.getRepository()) {
|
||||
Map<String, Map<Long, Long>> initialBalances = AccountUtils.getBalances(repository, Asset.QORT, Asset.LEGACY_QORA, Asset.QORT_FROM_QORA);
|
||||
|
Reference in New Issue
Block a user