wormchain: wormhole: Use existing helper functions
Replace a couple of blocks with existing helper functions that do the same thing.
This commit is contained in:
parent
a0c25dead2
commit
991c41b46e
|
@ -19,7 +19,7 @@ func (k Keeper) UpdateGuardianSet(ctx sdk.Context, newGuardianSet types.Guardian
|
||||||
return types.ErrNoConfig
|
return types.ErrNoConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
oldSet, exists := k.GetGuardianSet(ctx, k.GetGuardianSetCount(ctx)-1)
|
oldSet, exists := k.GetGuardianSet(ctx, k.GetLatestGuardianSetIndex(ctx))
|
||||||
if !exists {
|
if !exists {
|
||||||
return types.ErrGuardianSetNotFound
|
return types.ErrGuardianSetNotFound
|
||||||
}
|
}
|
||||||
|
@ -136,11 +136,7 @@ func (k Keeper) AppendGuardianSet(
|
||||||
return 0, types.ErrGuardianSetNotSequential
|
return 0, types.ErrGuardianSetNotSequential
|
||||||
}
|
}
|
||||||
|
|
||||||
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.GuardianSetKey))
|
k.setGuardianSet(ctx, guardianSet)
|
||||||
appendedValue := k.cdc.MustMarshal(&guardianSet)
|
|
||||||
store.Set(GetGuardianSetIDBytes(guardianSet.Index), appendedValue)
|
|
||||||
|
|
||||||
// Update guardianSet count
|
|
||||||
k.setGuardianSetCount(ctx, count+1)
|
k.setGuardianSetCount(ctx, count+1)
|
||||||
|
|
||||||
return count, nil
|
return count, nil
|
||||||
|
|
Loading…
Reference in New Issue