From 2b00236ef9c68ef23321a7bac5ba6f47ac69f75a Mon Sep 17 00:00:00 2001 From: Rootul Patel Date: Fri, 16 Aug 2024 12:16:21 -0400 Subject: [PATCH] feat: expose config.IsSealed --- types/config.go | 7 +++++++ types/config_test.go | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/types/config.go b/types/config.go index fce6c73526e2..06a3c3ce09f5 100644 --- a/types/config.go +++ b/types/config.go @@ -82,6 +82,13 @@ func (config *Config) assertNotSealed() { } } +func (config *Config) IsSealed() bool { + config.mtx.Lock() + defer config.mtx.Unlock() + + return config.sealed +} + // SetBech32PrefixForAccount builds the Config with Bech32 addressPrefix and publKeyPrefix for accounts // and returns the config instance func (config *Config) SetBech32PrefixForAccount(addressPrefix, pubKeyPrefix string) { diff --git a/types/config_test.go b/types/config_test.go index df281b1f852a..1c9b57d80c54 100644 --- a/types/config_test.go +++ b/types/config_test.go @@ -68,3 +68,10 @@ func (s *configTestSuite) TestConfig_SetFullFundraiserPath() { func (s *configTestSuite) TestKeyringServiceName() { s.Require().Equal(sdk.DefaultKeyringServiceName, sdk.KeyringServiceName()) } + +func (s *configTestSuite) TestIsConfigSealed() { + config := sdk.NewConfig() + s.Require().False(config.IsSealed()) + config.Seal() + s.Require().True(config.IsSealed()) +}