From 3cdd9cfab3ddc1c1a5f1f0138cbbdb688d4616d7 Mon Sep 17 00:00:00 2001 From: Max <82761650+MaxMustermann2@users.noreply.github.com> Date: Thu, 4 Aug 2022 13:15:35 +0000 Subject: [PATCH] [rpc] hex address GetValidatorsStakeByBlockNumber (#4256) --- hmy/staking.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hmy/staking.go b/hmy/staking.go index 7ac4362e9..9d99b7908 100644 --- a/hmy/staking.go +++ b/hmy/staking.go @@ -229,12 +229,12 @@ func (hmy *Harmony) GetAllValidatorAddresses() []common.Address { func (hmy *Harmony) GetValidatorsStakeByBlockNumber( block *types.Block, -) (map[common.Address]*big.Int, error) { +) (map[string]*big.Int, error) { if cachedReward, ok := hmy.stakeByBlockNumberCache.Get(block.Hash()); ok { - return cachedReward.(map[common.Address]*big.Int), nil + return cachedReward.(map[string]*big.Int), nil } validatorAddresses := hmy.GetAllValidatorAddresses() - stakes := make(map[common.Address]*big.Int, len(validatorAddresses)) + stakes := make(map[string]*big.Int, len(validatorAddresses)) for _, validatorAddress := range validatorAddresses { wrapper, err := hmy.BlockChain.ReadValidatorInformationAtRoot(validatorAddress, block.Root()) if err != nil { @@ -250,7 +250,7 @@ func (hmy *Harmony) GetValidatorsStakeByBlockNumber( continue } } - stakes[validatorAddress] = wrapper.TotalDelegation() + stakes[validatorAddress.Hex()] = wrapper.TotalDelegation() } hmy.stakeByBlockNumberCache.Add(block.Hash(), stakes) return stakes, nil