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
|
||||
}
|
||||
|
||||
oldSet, exists := k.GetGuardianSet(ctx, k.GetGuardianSetCount(ctx)-1)
|
||||
oldSet, exists := k.GetGuardianSet(ctx, k.GetLatestGuardianSetIndex(ctx))
|
||||
if !exists {
|
||||
return types.ErrGuardianSetNotFound
|
||||
}
|
||||
|
@ -136,11 +136,7 @@ func (k Keeper) AppendGuardianSet(
|
|||
return 0, types.ErrGuardianSetNotSequential
|
||||
}
|
||||
|
||||
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.GuardianSetKey))
|
||||
appendedValue := k.cdc.MustMarshal(&guardianSet)
|
||||
store.Set(GetGuardianSetIDBytes(guardianSet.Index), appendedValue)
|
||||
|
||||
// Update guardianSet count
|
||||
k.setGuardianSet(ctx, guardianSet)
|
||||
k.setGuardianSetCount(ctx, count+1)
|
||||
|
||||
return count, nil
|
||||
|
|
Loading…
Reference in New Issue