Fixed and updated blocksignerReader

This commit is contained in:
AnilChinchawale 2019-01-12 08:34:50 +05:30
parent f9a893dd18
commit e62fd0abe4
4 changed files with 6 additions and 6 deletions

View file

@ -30,4 +30,4 @@ func GetSigners(statedb *state.StateDB, block *types.Block) []common.Address {
}
return rets
}
}

View file

@ -31,4 +31,4 @@ func getLocFixedArrAtElement(slot uint64, index uint64, elementSize uint64) comm
slotBig := new(big.Int).SetUint64(slot)
arrBig := slotBig.Add(slotBig, new(big.Int).SetUint64(index*elementSize))
return common.BigToHash(arrBig)
}
}

View file

@ -279,4 +279,4 @@ package contracts
// slotBig := new(big.Int).SetUint64(slot)
// arrBig := slotBig.Add(slotBig, new(big.Int).SetUint64(index*elementSize))
// return common.BigToHash(arrBig)
//}
//}

View file

@ -374,7 +374,7 @@ func CalculateRewardForSigner(chainReward *big.Int, signers map[common.Address]*
}
// Get candidate owner by address.
func GetCandidatesOwnerBySigner(validator *contractValidator.XDCValidator, signerAddr common.Address) common.Address {
func GetCandidatesOwnerBySigner(validator *contractValidator.Kyc, signerAddr common.Address) common.Address {
owner := signerAddr
opts := new(bind.CallOpts)
owner, err := validator.GetCandidateOwner(opts, signerAddr)
@ -387,7 +387,7 @@ func GetCandidatesOwnerBySigner(validator *contractValidator.XDCValidator, signe
}
// Calculate reward for holders.
func CalculateRewardForHolders(foudationWalletAddr common.Address, validator *contractValidator.XDCValidator, state *state.StateDB, signer common.Address, calcReward *big.Int) (error, map[common.Address]*big.Int) {
func CalculateRewardForHolders(foudationWalletAddr common.Address, validator *contractValidator.Kyc, state *state.StateDB, signer common.Address, calcReward *big.Int) (error, map[common.Address]*big.Int) {
rewards, err := GetRewardBalancesRate(foudationWalletAddr, signer, calcReward, validator)
if err != nil {
return err, nil
@ -401,7 +401,7 @@ func CalculateRewardForHolders(foudationWalletAddr common.Address, validator *co
}
// Get reward balance rates for master node, founder and holders.
func GetRewardBalancesRate(foudationWalletAddr common.Address, masterAddr common.Address, totalReward *big.Int, validator *contractValidator.XDCValidator) (map[common.Address]*big.Int, error) {
func GetRewardBalancesRate(foudationWalletAddr common.Address, masterAddr common.Address, totalReward *big.Int, validator *contractValidator.Kyc) (map[common.Address]*big.Int, error) {
owner := GetCandidatesOwnerBySigner(validator, masterAddr)
balances := make(map[common.Address]*big.Int)
rewardMaster := new(big.Int).Mul(totalReward, new(big.Int).SetInt64(common.RewardMasterPercent))