mirror of
https://github.com/Qortal/qortal.git
synced 2025-03-27 15:55:54 +00:00
Fix batch reward
This commit is contained in:
parent
d89f7ad41d
commit
c010ab47db
@ -25,10 +25,7 @@ import org.qortal.data.block.BlockSummaryData;
|
|||||||
import org.qortal.data.block.BlockTransactionData;
|
import org.qortal.data.block.BlockTransactionData;
|
||||||
import org.qortal.data.network.OnlineAccountData;
|
import org.qortal.data.network.OnlineAccountData;
|
||||||
import org.qortal.data.transaction.TransactionData;
|
import org.qortal.data.transaction.TransactionData;
|
||||||
import org.qortal.repository.ATRepository;
|
import org.qortal.repository.*;
|
||||||
import org.qortal.repository.DataException;
|
|
||||||
import org.qortal.repository.Repository;
|
|
||||||
import org.qortal.repository.TransactionRepository;
|
|
||||||
import org.qortal.settings.Settings;
|
import org.qortal.settings.Settings;
|
||||||
import org.qortal.transaction.AtTransaction;
|
import org.qortal.transaction.AtTransaction;
|
||||||
import org.qortal.transaction.Transaction;
|
import org.qortal.transaction.Transaction;
|
||||||
@ -144,6 +141,7 @@ public class Block {
|
|||||||
private final Account mintingAccount;
|
private final Account mintingAccount;
|
||||||
private final AccountData mintingAccountData;
|
private final AccountData mintingAccountData;
|
||||||
private final boolean isMinterFounder;
|
private final boolean isMinterFounder;
|
||||||
|
private final boolean isMinterMember;
|
||||||
|
|
||||||
private final Account recipientAccount;
|
private final Account recipientAccount;
|
||||||
private final AccountData recipientAccountData;
|
private final AccountData recipientAccountData;
|
||||||
@ -157,6 +155,7 @@ public class Block {
|
|||||||
this.isMinterFounder = Account.isFounder(mintingAccountData.getFlags());
|
this.isMinterFounder = Account.isFounder(mintingAccountData.getFlags());
|
||||||
|
|
||||||
this.isRecipientAlsoMinter = this.rewardShareData.getRecipient().equals(this.mintingAccount.getAddress());
|
this.isRecipientAlsoMinter = this.rewardShareData.getRecipient().equals(this.mintingAccount.getAddress());
|
||||||
|
this.isMinterMember = repository.getGroupRepository().memberExists(BlockChain.getInstance().getMintingGroupId(), this.mintingAccount.getAddress());
|
||||||
|
|
||||||
if (this.isRecipientAlsoMinter) {
|
if (this.isRecipientAlsoMinter) {
|
||||||
// Self-share: minter is also recipient
|
// Self-share: minter is also recipient
|
||||||
@ -192,6 +191,11 @@ public class Block {
|
|||||||
if (accountLevel <= 0)
|
if (accountLevel <= 0)
|
||||||
return null; // level 0 isn't included in any share bins
|
return null; // level 0 isn't included in any share bins
|
||||||
|
|
||||||
|
if (blockHeight >= BlockChain.getInstance().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
|
// Select the correct set of share bins based on block height
|
||||||
final BlockChain blockChain = BlockChain.getInstance();
|
final BlockChain blockChain = BlockChain.getInstance();
|
||||||
final AccountLevelShareBin[] shareBinsByLevel = (blockHeight >= blockChain.getSharesByLevelV2Height()) ?
|
final AccountLevelShareBin[] shareBinsByLevel = (blockHeight >= blockChain.getSharesByLevelV2Height()) ?
|
||||||
@ -715,8 +719,18 @@ public class Block {
|
|||||||
|
|
||||||
List<ExpandedAccount> expandedAccounts = new ArrayList<>();
|
List<ExpandedAccount> expandedAccounts = new ArrayList<>();
|
||||||
|
|
||||||
for (RewardShareData rewardShare : this.cachedOnlineRewardShares)
|
for (RewardShareData rewardShare : this.cachedOnlineRewardShares) {
|
||||||
|
if (this.getBlockData().getHeight() < BlockChain.getInstance().getFixBatchRewardHeight()) {
|
||||||
expandedAccounts.add(new ExpandedAccount(repository, rewardShare));
|
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;
|
this.cachedExpandedAccounts = expandedAccounts;
|
||||||
|
|
||||||
@ -2213,6 +2227,7 @@ public class Block {
|
|||||||
List<AccountBalanceData> accountBalanceDeltas = balanceChanges.entrySet().stream()
|
List<AccountBalanceData> accountBalanceDeltas = balanceChanges.entrySet().stream()
|
||||||
.map(entry -> new AccountBalanceData(entry.getKey(), Asset.QORT, entry.getValue()))
|
.map(entry -> new AccountBalanceData(entry.getKey(), Asset.QORT, entry.getValue()))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
LOGGER.trace("Account Balance Deltas: {}", accountBalanceDeltas);
|
||||||
this.repository.getAccountRepository().modifyAssetBalances(accountBalanceDeltas);
|
this.repository.getAccountRepository().modifyAssetBalances(accountBalanceDeltas);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +87,8 @@ public class BlockChain {
|
|||||||
enableRewardshareHeight,
|
enableRewardshareHeight,
|
||||||
onlyMintWithNameHeight,
|
onlyMintWithNameHeight,
|
||||||
removeOnlyMintWithNameHeight,
|
removeOnlyMintWithNameHeight,
|
||||||
groupMemberCheckHeight
|
groupMemberCheckHeight,
|
||||||
|
fixBatchRewardHeight
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom transaction fees
|
// Custom transaction fees
|
||||||
@ -657,6 +658,10 @@ public class BlockChain {
|
|||||||
return this.featureTriggers.get(FeatureTrigger.groupMemberCheckHeight.name()).intValue();
|
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
|
// More complex getters for aspects that change by height or timestamp
|
||||||
|
|
||||||
public long getRewardAtHeight(int ourHeight) {
|
public long getRewardAtHeight(int ourHeight) {
|
||||||
|
@ -112,7 +112,8 @@
|
|||||||
"enableRewardshareHeight": 1905100,
|
"enableRewardshareHeight": 1905100,
|
||||||
"onlyMintWithNameHeight": 1900300,
|
"onlyMintWithNameHeight": 1900300,
|
||||||
"removeOnlyMintWithNameHeight": 1935500,
|
"removeOnlyMintWithNameHeight": 1935500,
|
||||||
"groupMemberCheckHeight": 1902700
|
"groupMemberCheckHeight": 1902700,
|
||||||
|
"fixBatchRewardHeight": 9999999
|
||||||
},
|
},
|
||||||
"checkpoints": [
|
"checkpoints": [
|
||||||
{ "height": 1136300, "signature": "3BbwawEF2uN8Ni5ofpJXkukoU8ctAPxYoFB7whq9pKfBnjfZcpfEJT4R95NvBDoTP8WDyWvsUvbfHbcr9qSZuYpSKZjUQTvdFf6eqznHGEwhZApWfvXu6zjGCxYCp65F4jsVYYJjkzbjmkCg5WAwN5voudngA23kMK6PpTNygapCzXt" }
|
{ "height": 1136300, "signature": "3BbwawEF2uN8Ni5ofpJXkukoU8ctAPxYoFB7whq9pKfBnjfZcpfEJT4R95NvBDoTP8WDyWvsUvbfHbcr9qSZuYpSKZjUQTvdFf6eqznHGEwhZApWfvXu6zjGCxYCp65F4jsVYYJjkzbjmkCg5WAwN5voudngA23kMK6PpTNygapCzXt" }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user