From a43b3f1865f7363630f9b69aa4112f51e4623056 Mon Sep 17 00:00:00 2001 From: RafilxTenfen Date: Mon, 16 Sep 2024 17:13:13 -0300 Subject: [PATCH] chore: move check for outside the QueryFinalityProviderVotingPower --- clientcontroller/babylon.go | 7 ------- finality-provider/service/app.go | 6 +++++- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/clientcontroller/babylon.go b/clientcontroller/babylon.go index 3fff41ab..629ee015 100644 --- a/clientcontroller/babylon.go +++ b/clientcontroller/babylon.go @@ -3,7 +3,6 @@ package clientcontroller import ( "context" "fmt" - "strings" "time" sdkErr "cosmossdk.io/errors" @@ -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) } diff --git a/finality-provider/service/app.go b/finality-provider/service/app.go index a1738814..65def6c7 100644 --- a/finality-provider/service/app.go +++ b/finality-provider/service/app.go @@ -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) {