Skip to content

Commit 559d622

Browse files
committed
fix rewardingpool and stakingpool balance
1 parent b0e00a9 commit 559d622

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

api/coreservice.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,8 @@ func (core *coreService) Account(addr address.Address) (*iotextypes.AccountMeta,
321321
ctx, span := tracer.NewSpan(context.Background(), "coreService.Account")
322322
defer span.End()
323323
addrStr := addr.String()
324-
if addrStr == address.RewardingPoolAddr || addrStr == address.StakingBucketPoolAddr {
324+
if addrStr == address.RewardingPoolAddr || addrStr == address.StakingBucketPoolAddr ||
325+
addrStr == address.RewardingProtocol || addrStr == address.StakingProtocolAddr {
325326
return core.getProtocolAccount(ctx, addrStr)
326327
}
327328
span.AddEvent("accountutil.AccountStateWithHeight")
@@ -1760,7 +1761,7 @@ func (core *coreService) getProtocolAccount(ctx context.Context, addr string) (*
17601761
err error
17611762
)
17621763
switch addr {
1763-
case address.RewardingPoolAddr:
1764+
case address.RewardingPoolAddr, address.RewardingProtocol:
17641765
if out, err = core.ReadState("rewarding", "", []byte("TotalBalance"), nil); err != nil {
17651766
return nil, nil, err
17661767
}
@@ -1769,7 +1770,7 @@ func (core *coreService) getProtocolAccount(ctx context.Context, addr string) (*
17691770
return nil, nil, errors.New("balance convert error")
17701771
}
17711772
balance = val.String()
1772-
case address.StakingBucketPoolAddr:
1773+
case address.StakingBucketPoolAddr, address.StakingProtocolAddr:
17731774
methodName, err := proto.Marshal(&iotexapi.ReadStakingDataMethod{
17741775
Method: iotexapi.ReadStakingDataMethod_TOTAL_STAKING_AMOUNT,
17751776
})

api/coreservice_with_height.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ func (core *coreServiceReaderWithHeight) Account(addr address.Address) (*iotexty
4545
ctx, span := tracer.NewSpan(context.Background(), "coreServiceReaderWithHeight.Account")
4646
defer span.End()
4747
addrStr := addr.String()
48-
if addrStr == address.RewardingPoolAddr || addrStr == address.StakingBucketPoolAddr {
48+
if addrStr == address.RewardingPoolAddr || addrStr == address.StakingBucketPoolAddr ||
49+
addrStr == address.RewardingProtocol || addrStr == address.StakingProtocolAddr {
4950
return core.cs.getProtocolAccount(ctx, addrStr)
5051
}
5152
state, pendingNonce, err := core.stateAndNonce(addr)

0 commit comments

Comments
 (0)