Class StakeManagement
- java.lang.Object
-
- com.h2tcoin.takamakachain.db.embedded.node.StakeManagement
-
public class StakeManagement extends Object
- Author:
- iris.dimni
-
-
Constructor Summary
Constructors Constructor Description StakeManagement()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ConcurrentSkipListMap<String,AcceptedBetByTargetBean>consolidateMainStakesByHolder(ConcurrentSkipListSet<AcceptedBetByHolderBean> acceptedBets, KeyWriterStatusBean kwSB)Get all the stakes consolidated on the MAIN addresses by holder Bets made on OVERFLOW nodes are transferred onto their MAINsstatic ConcurrentSkipListMap<String,BigInteger>consolidateStakesOnMain(ConcurrentSkipListSet<AcceptedBetByHolderBean> acceptedBets, KeyWriterStatusBean kwSB)Step II: Get all stakes and consolidate them onto the MAIN addresses do not consider orphan nodes, whether MAIN or OVERFLOWstatic ConcurrentSkipListMap<String,AcceptedBetByTargetBean>getConsolidatedAcceptedBetsByMain(ConcurrentSkipListMap<String,NodeManagerBean> nodeLinks, ConcurrentSkipListMap<String,BigInteger> nodeStakes, ConcurrentSkipListSet<AcceptedBetByHolderBean> acceptedBets)Returns the main stakes by holderstatic ConcurrentSkipListMap<String,HolderStakesByTargetBean>getHolderStakesByTarget(ConcurrentSkipListSet<AcceptedBetByHolderBean> acceptedBets, KeyWriterStatusBean kwSB, ConcurrentSkipListMap<String,AcceptedBetByTargetBean> mainStakesByHolder)Same as AcceptedBetByHolder but this list contains only bets on MAIN addresses enabled to minestatic ConcurrentSkipListMap<String,NodeManagerBean>getKeyListBucket(ConcurrentSkipListSet<String> hexKeys, KeyWriterStatusBean kwSB)return the buckets corresponding to the specified list of keysstatic ConcurrentSkipListMap<String,NodeManagerBean>getKeyWriterBuckets(KeyWriterStatusBean kwSB)return the all the buckets corresponding to the specified keywriterstatic ConcurrentSkipListMap<String,NodeManagerBean>getNodeLinks(ConcurrentSkipListSet<AcceptedBetByHolderBean> acceptedBets, KeyWriterStatusBean kwSB)returns the list of linked nodes MAIN/OVERFLOW that have stakes bet on themstatic ConcurrentSkipListMap<String,String>getRewardAddresses(ConcurrentSkipListMap<String,AcceptedBetByTargetBean> input, String seed)returns an ordered list of all the addresses that are expected to receive rewards(fees and coinbase)static ConcurrentSkipListMap<String,BigInteger>getStakeDistribution(ConcurrentSkipListSet<AcceptedBetByHolderBean> acceptedBets, KeyWriterStatusBean kwSB, ConcurrentSkipListMap<String,BigInteger> mainStakes, ConcurrentSkipListMap<String,NodeManagerBean> nodeLinks, BigInteger minStake)STEP VI: redistribute stakes among mining nodes(OVERFLOWS)static BigIntegergetTotalAtStake(ConcurrentSkipListMap<String,BigInteger> mainStakes)STEP IV: returns the total amount of green tokens at stakestatic BigIntegergetTotalAtStake(ConcurrentSkipListSet<AcceptedBetByHolderBean> acceptedBets, KeyWriterStatusBean kwSB)STEP IV: returns the total amount of green tokens at stakestatic BigIntegerminimunStakeAllowed(BigInteger totalAtStake)STEP V: returns the minimum amount of stake required for a node to be activated as a minerstatic BigIntegerminimunStakeAllowed(ConcurrentSkipListSet<AcceptedBetByHolderBean> acceptedBets, KeyWriterStatusBean kwSB)STEP V: returns the minimum amount of stake required for a node to be activated as a miner
-
-
-
Method Detail
-
consolidateStakesOnMain
public static ConcurrentSkipListMap<String,BigInteger> consolidateStakesOnMain(ConcurrentSkipListSet<AcceptedBetByHolderBean> acceptedBets, KeyWriterStatusBean kwSB)
Step II: Get all stakes and consolidate them onto the MAIN addresses do not consider orphan nodes, whether MAIN or OVERFLOW- Parameters:
acceptedBets-kwSB-- Returns:
-
consolidateMainStakesByHolder
public static ConcurrentSkipListMap<String,AcceptedBetByTargetBean> consolidateMainStakesByHolder(ConcurrentSkipListSet<AcceptedBetByHolderBean> acceptedBets, KeyWriterStatusBean kwSB)
Get all the stakes consolidated on the MAIN addresses by holder Bets made on OVERFLOW nodes are transferred onto their MAINs- Parameters:
acceptedBets-kwSB-- Returns:
-
getRewardAddresses
public static ConcurrentSkipListMap<String,String> getRewardAddresses(ConcurrentSkipListMap<String,AcceptedBetByTargetBean> input, String seed)
returns an ordered list of all the addresses that are expected to receive rewards(fees and coinbase)- Parameters:
input-seed-- Returns:
-
getTotalAtStake
public static BigInteger getTotalAtStake(ConcurrentSkipListSet<AcceptedBetByHolderBean> acceptedBets, KeyWriterStatusBean kwSB)
STEP IV: returns the total amount of green tokens at stake- Parameters:
acceptedBets-kwSB-- Returns:
-
getTotalAtStake
public static BigInteger getTotalAtStake(ConcurrentSkipListMap<String,BigInteger> mainStakes)
STEP IV: returns the total amount of green tokens at stake- Parameters:
mainStakes-- Returns:
-
minimunStakeAllowed
public static BigInteger minimunStakeAllowed(ConcurrentSkipListSet<AcceptedBetByHolderBean> acceptedBets, KeyWriterStatusBean kwSB)
STEP V: returns the minimum amount of stake required for a node to be activated as a miner- Parameters:
acceptedBets-kwSB-- Returns:
-
minimunStakeAllowed
public static BigInteger minimunStakeAllowed(BigInteger totalAtStake)
STEP V: returns the minimum amount of stake required for a node to be activated as a miner- Parameters:
totalAtStake-- Returns:
-
getStakeDistribution
public static ConcurrentSkipListMap<String,BigInteger> getStakeDistribution(ConcurrentSkipListSet<AcceptedBetByHolderBean> acceptedBets, KeyWriterStatusBean kwSB, ConcurrentSkipListMap<String,BigInteger> mainStakes, ConcurrentSkipListMap<String,NodeManagerBean> nodeLinks, BigInteger minStake)
STEP VI: redistribute stakes among mining nodes(OVERFLOWS)- Parameters:
acceptedBets-kwSB-mainStakes- optionalnodeLinks- optionalminStake- optional- Returns:
-
getConsolidatedAcceptedBetsByMain
public static ConcurrentSkipListMap<String,AcceptedBetByTargetBean> getConsolidatedAcceptedBetsByMain(ConcurrentSkipListMap<String,NodeManagerBean> nodeLinks, ConcurrentSkipListMap<String,BigInteger> nodeStakes, ConcurrentSkipListSet<AcceptedBetByHolderBean> acceptedBets)
Returns the main stakes by holder- Parameters:
nodeLinks-nodeStakes-acceptedBets-- Returns:
- main_address_hex, AcceptedBetByTargetBean
-
getHolderStakesByTarget
public static ConcurrentSkipListMap<String,HolderStakesByTargetBean> getHolderStakesByTarget(ConcurrentSkipListSet<AcceptedBetByHolderBean> acceptedBets, KeyWriterStatusBean kwSB, ConcurrentSkipListMap<String,AcceptedBetByTargetBean> mainStakesByHolder)
Same as AcceptedBetByHolder but this list contains only bets on MAIN addresses enabled to mine- Parameters:
acceptedBets-kwSB-nodeLinks-nodeStakes-mainStakesByHolder-- Returns:
-
getKeyListBucket
public static ConcurrentSkipListMap<String,NodeManagerBean> getKeyListBucket(ConcurrentSkipListSet<String> hexKeys, KeyWriterStatusBean kwSB)
return the buckets corresponding to the specified list of keys- Parameters:
hexKeys-kwSB-- Returns:
-
getKeyWriterBuckets
public static ConcurrentSkipListMap<String,NodeManagerBean> getKeyWriterBuckets(KeyWriterStatusBean kwSB)
return the all the buckets corresponding to the specified keywriter- Parameters:
kwSB-- Returns:
-
getNodeLinks
public static ConcurrentSkipListMap<String,NodeManagerBean> getNodeLinks(ConcurrentSkipListSet<AcceptedBetByHolderBean> acceptedBets, KeyWriterStatusBean kwSB)
returns the list of linked nodes MAIN/OVERFLOW that have stakes bet on them- Parameters:
acceptedBets-kwSB-- Returns:
-
-