diff --git a/finality-provider/service/app_test.go b/finality-provider/service/app_test.go index 62bc4a92..f45d910f 100644 --- a/finality-provider/service/app_test.go +++ b/finality-provider/service/app_test.go @@ -280,10 +280,7 @@ func FuzzStatusUpdate(f *testing.F) { var err error require.Eventually(t, func() bool { fpIns, err = app.GetFinalityProviderInstance() - if err != nil { - return false - } - return true + return err == nil }, time.Second*5, time.Millisecond*200, "should eventually be registered or active") if votingPower > 0 { @@ -339,6 +336,7 @@ func startFPAppWithRegisteredFp(t *testing.T, r *rand.Rand, homePath string, cfg cfg.BabylonConfig.KeyringBackend, input, ) + require.NoError(t, err) kc, err := keyring.NewChainKeyringControllerWithKeyring(kr, keyName, input) require.NoError(t, err) btcPkBytes, err := em.CreateKey(keyName, passphrase, hdPath) diff --git a/finality-provider/service/fp_instance_test.go b/finality-provider/service/fp_instance_test.go index 90b940c0..8b4c487f 100644 --- a/finality-provider/service/fp_instance_test.go +++ b/finality-provider/service/fp_instance_test.go @@ -181,6 +181,7 @@ func startFinalityProviderAppWithRegisteredFp(t *testing.T, r *rand.Rand, cc cli fpCfg.BabylonConfig.KeyringBackend, input, ) + require.NoError(t, err) kc, err := fpkr.NewChainKeyringControllerWithKeyring(kr, keyName, input) require.NoError(t, err) keyInfo, err := kc.CreateChainKey("", "", "") diff --git a/finality-provider/store/fpstore.go b/finality-provider/store/fpstore.go index 77a4fa13..ffff5334 100644 --- a/finality-provider/store/fpstore.go +++ b/finality-provider/store/fpstore.go @@ -123,13 +123,11 @@ func (s *FinalityProviderStore) UpdateFpStatusFromVotingPower( return proto.FinalityProviderStatus_ACTIVE, s.SetFpStatus(fp.BtcPk, proto.FinalityProviderStatus_ACTIVE) } - // voting power == 0 then set status depending on previous status - //nolint:exhaustive - switch fp.Status { - case proto.FinalityProviderStatus_ACTIVE: + if fp.Status == proto.FinalityProviderStatus_ACTIVE { // previous status is ACTIVE then set to INACTIVE return proto.FinalityProviderStatus_INACTIVE, s.SetFpStatus(fp.BtcPk, proto.FinalityProviderStatus_INACTIVE) } + return fp.Status, nil }