From f9873b19b27a79559bfe2de2aef12c3124a83e4c Mon Sep 17 00:00:00 2001 From: Eela Nagaraj Date: Wed, 27 Sep 2023 13:48:53 +0200 Subject: [PATCH] Fix bug using contract versions at tip instead of requested block height for subaccount balances --- service/rpc/servicer.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/service/rpc/servicer.go b/service/rpc/servicer.go index 0ef28d8c..f3f4e537 100644 --- a/service/rpc/servicer.go +++ b/service/rpc/servicer.go @@ -246,7 +246,7 @@ func (s *Servicer) AccountBalance(ctx context.Context, request *types.AccountBal if subAccount.Address == string(analyzer.AccLockedGoldNonVoting) { // Fetch LockedGold Balances - lockedGold, err := registry.GetLockedGoldContract(ctx, nil) + lockedGold, err := registry.GetLockedGoldContract(ctx, requestedBlockOpts.BlockNumber) if err == client.ErrContractNotDeployed { // Nothing is deployed => ignore lockedGold & election balances return emptyResponse, nil @@ -264,7 +264,7 @@ func (s *Servicer) AccountBalance(ctx context.Context, request *types.AccountBal if subAccount.Address == string(analyzer.AccLockedGoldPending) { // Fetch LockedGold Balances - lockedGold, err := registry.GetLockedGoldContract(ctx, nil) + lockedGold, err := registry.GetLockedGoldContract(ctx, requestedBlockOpts.BlockNumber) if err == client.ErrContractNotDeployed { // Nothing is deployed => ignore lockedGold & election balances return emptyResponse, nil @@ -283,7 +283,7 @@ func (s *Servicer) AccountBalance(ctx context.Context, request *types.AccountBal // If we are here need to be election based // Fetch Election (Votes) Balances - _election, err := registry.GetElectionContract(ctx, nil) + _election, err := registry.GetElectionContract(ctx, requestedBlockOpts.BlockNumber) if err == client.ErrContractNotDeployed { // Nothing is deployed => ignore lockedGold & election balances return emptyResponse, nil