mirror of
https://github.com/Qortal/qortal.git
synced 2025-02-11 17:55:50 +00:00
removed the NULL account from the dev admin reward distribution and added some fail safes in case the admin groups are empty
This commit is contained in:
parent
2805bb8364
commit
a8a8904ebf
@ -26,6 +26,7 @@ import org.qortal.data.block.BlockTransactionData;
|
|||||||
import org.qortal.data.group.GroupAdminData;
|
import org.qortal.data.group.GroupAdminData;
|
||||||
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.group.Group;
|
||||||
import org.qortal.repository.*;
|
import org.qortal.repository.*;
|
||||||
import org.qortal.settings.Settings;
|
import org.qortal.settings.Settings;
|
||||||
import org.qortal.transaction.AtTransaction;
|
import org.qortal.transaction.AtTransaction;
|
||||||
@ -2497,21 +2498,28 @@ public class Block {
|
|||||||
.filter(expandedAccount -> minterAdmins.contains(expandedAccount.getMintingAccount().getAddress()))
|
.filter(expandedAccount -> minterAdmins.contains(expandedAccount.getMintingAccount().getAddress()))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
BlockRewardDistributor minterAdminDistributor
|
long minterAdminShare;
|
||||||
= (distributionAmount, balanceChanges)
|
|
||||||
->
|
|
||||||
distributeBlockRewardShare(distributionAmount, onlineMinterAdminAccounts, balanceChanges);
|
|
||||||
|
|
||||||
long adminShare = 1_00000000 - totalShares;
|
if( onlineMinterAdminAccounts.isEmpty() ) {
|
||||||
LOGGER.info("initial total Shares: {}",totalShares);
|
minterAdminShare = 0;
|
||||||
LOGGER.info("logging adminShare after hardfork, this is the primary reward that will be split {}",adminShare);
|
}
|
||||||
|
else {
|
||||||
|
BlockRewardDistributor minterAdminDistributor
|
||||||
|
= (distributionAmount, balanceChanges)
|
||||||
|
->
|
||||||
|
distributeBlockRewardShare(distributionAmount, onlineMinterAdminAccounts, balanceChanges);
|
||||||
|
|
||||||
long minterAdminShare = adminShare / 2;
|
long adminShare = 1_00000000 - totalShares;
|
||||||
BlockRewardCandidate minterAdminRewardCandidate
|
LOGGER.info("initial total Shares: {}", totalShares);
|
||||||
= new BlockRewardCandidate("Minter Admins", minterAdminShare, minterAdminDistributor);
|
LOGGER.info("logging adminShare after hardfork, this is the primary reward that will be split {}", adminShare);
|
||||||
rewardCandidates.add(minterAdminRewardCandidate);
|
|
||||||
|
|
||||||
totalShares += minterAdminShare;
|
minterAdminShare = adminShare / 2;
|
||||||
|
BlockRewardCandidate minterAdminRewardCandidate
|
||||||
|
= new BlockRewardCandidate("Minter Admins", minterAdminShare, minterAdminDistributor);
|
||||||
|
rewardCandidates.add(minterAdminRewardCandidate);
|
||||||
|
|
||||||
|
totalShares += minterAdminShare;
|
||||||
|
}
|
||||||
|
|
||||||
LOGGER.info("MINTER ADMIN SHARE: {}",minterAdminShare);
|
LOGGER.info("MINTER ADMIN SHARE: {}",minterAdminShare);
|
||||||
|
|
||||||
@ -2521,6 +2529,10 @@ public class Block {
|
|||||||
.map(GroupAdminData::getAdmin)
|
.map(GroupAdminData::getAdmin)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
LOGGER.info("Removing NULL Account Address, Dev Admin Count = {}", devAdminAddresses.size());
|
||||||
|
devAdminAddresses.removeIf( address -> Group.NULL_OWNER_ADDRESS.equals(address) );
|
||||||
|
LOGGER.info("Removed NULL Account Address, Dev Admin Count = {}", devAdminAddresses.size());
|
||||||
|
|
||||||
BlockRewardDistributor devAdminDistributor
|
BlockRewardDistributor devAdminDistributor
|
||||||
= (distributionAmount, balanceChanges) -> distributeToAccounts(distributionAmount, devAdminAddresses, balanceChanges);
|
= (distributionAmount, balanceChanges) -> distributeToAccounts(distributionAmount, devAdminAddresses, balanceChanges);
|
||||||
|
|
||||||
@ -2548,6 +2560,8 @@ public class Block {
|
|||||||
*/
|
*/
|
||||||
public static long distributeToAccounts(long distributionAmount, List<String> accountAddressess, Map<String, Long> balanceChanges) {
|
public static long distributeToAccounts(long distributionAmount, List<String> accountAddressess, Map<String, Long> balanceChanges) {
|
||||||
|
|
||||||
|
if( accountAddressess.isEmpty() ) return 0;
|
||||||
|
|
||||||
long distibutionShare = distributionAmount / accountAddressess.size();
|
long distibutionShare = distributionAmount / accountAddressess.size();
|
||||||
|
|
||||||
for(String accountAddress : accountAddressess ) {
|
for(String accountAddress : accountAddressess ) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user