fix: runtime: fix (*App).RegisterMoodules inconsistency in checking/memoizing appModule (#14128)
Fixes an inconsistency in checking for duplicates in ModuleManager's Modules[name] then also basicManager[name] in which memoization could happen for .Module[name] but fail after a duplicate check in basicManager[name]. This change instead only memoizes the AppModule after the duplicate checks have all cleared. Fixes #14006
This commit is contained in:
parent
9f46665d93
commit
3aff993fcb
@ -59,12 +59,12 @@ func (a *App) RegisterModules(modules ...module.AppModule) error {
|
||||
if _, ok := a.ModuleManager.Modules[name]; ok {
|
||||
return fmt.Errorf("AppModule named %q already exists", name)
|
||||
}
|
||||
a.ModuleManager.Modules[name] = appModule
|
||||
|
||||
if _, ok := a.basicManager[name]; ok {
|
||||
return fmt.Errorf("AppModuleBasic named %q already exists", name)
|
||||
}
|
||||
|
||||
a.ModuleManager.Modules[name] = appModule
|
||||
a.basicManager[name] = appModule
|
||||
appModule.RegisterInterfaces(a.interfaceRegistry)
|
||||
appModule.RegisterLegacyAminoCodec(a.amino)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user