From 3562f46dabfeb0879dc58701fe0307c95158c84e Mon Sep 17 00:00:00 2001 From: Rootul P Date: Mon, 9 Sep 2024 09:10:51 -0400 Subject: [PATCH] feat: expose config.IsSealed (#414) --- 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()) +}