Skip to content

Commit

Permalink
chore: move check for outside the QueryFinalityProviderVotingPower
Browse files Browse the repository at this point in the history
  • Loading branch information
RafilxTenfen committed Sep 16, 2024
1 parent 46bdbf9 commit a43b3f1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
7 changes: 0 additions & 7 deletions clientcontroller/babylon.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package clientcontroller
import (
"context"
"fmt"
"strings"
"time"

sdkErr "cosmossdk.io/errors"
Expand Down Expand Up @@ -277,12 +276,6 @@ func (bc *BabylonController) QueryFinalityProviderVotingPower(fpPk *btcec.Public
blockHeight,
)
if err != nil {
allowedErr := fmt.Sprintf("rpc error: code = Unknown desc = %s: unknown request", btcstakingtypes.ErrVotingPowerTableNotUpdated.Wrapf("height: %d", blockHeight).Error())
if strings.EqualFold(err.Error(), allowedErr) {
// if nothing was updated in the voting power table, it should consider as zero VP to start to send pub random
return 0, nil
}

return 0, fmt.Errorf("failed to query Finality Voting Power at Height: %w", err)
}

Expand Down
6 changes: 5 additions & 1 deletion finality-provider/service/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,11 @@ func (app *FinalityProviderApp) SyncFinalityProviderStatus() error {
if err != nil {
// if error occured then the finality-provider is not registered in the Babylon chain yet or
// there is nothing in the voting power table, so it should not start the fp.
continue
allowedErr := fmt.Sprintf("failed to query Finality Voting Power at Height: rpc error: code = Unknown desc = %s: unknown request", bstypes.ErrVotingPowerTableNotUpdated.Wrapf("height: %d", latestBlock.Height).Error())
if !strings.EqualFold(err.Error(), allowedErr) {
// if nothing was updated in the voting power table, it should consider as zero VP to start to send pub random
continue
}
}

if !fp.ShouldSyncStatusFromVotingPower(vp) {
Expand Down

0 comments on commit a43b3f1

Please sign in to comment.