Skip to content

Commit

Permalink
chore
Browse files Browse the repository at this point in the history
  • Loading branch information
tkxkd0159 committed May 3, 2024
1 parent 4460ca3 commit 59962c2
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions x/fbridge/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ func (k Keeper) InitMemStore(ctx sdk.Context) {

roleMetadata := types.RoleMetadata{}
if !k.IsInitialized(noGasCtx) {
memStore := noGasCtx.KVStore(k.memKey)

for _, pair := range k.GetRolePairs(noGasCtx) {
switch pair.Role {
case types.RoleGuardian:
Expand All @@ -71,7 +69,7 @@ func (k Keeper) InitMemStore(ctx sdk.Context) {
roleMetadata.Judge++
}
}
memStore.Set(types.KeyMemRoleMetadata, k.cdc.MustMarshal(&roleMetadata))
k.setRoleMetadata(noGasCtx, roleMetadata)

bsMeta := types.BridgeStatusMetadata{Inactive: 0, Active: 0}
for _, bs := range k.GetBridgeSwitches(noGasCtx) {
Expand All @@ -86,6 +84,7 @@ func (k Keeper) InitMemStore(ctx sdk.Context) {
}
k.setBridgeStatusMetadata(noGasCtx, types.BridgeStatusMetadata{})

memStore := noGasCtx.KVStore(k.memKey)
memStore.Set(types.KeyMemInitialized, []byte{1})
}
}
Expand All @@ -111,7 +110,7 @@ func (k Keeper) GetRoleMetadata(ctx sdk.Context) types.RoleMetadata {
data := types.RoleMetadata{}
bz := memStore.Get(types.KeyMemRoleMetadata)
if bz == nil {
panic("role metadata must be set at genesis")
return types.RoleMetadata{}
}
k.cdc.MustUnmarshal(bz, &data)
return data
Expand Down

0 comments on commit 59962c2

Please sign in to comment.