mirror of
https://github.com/planetmint/planetmint-go.git
synced 2025-11-24 14:35:47 +00:00
fix: iterate over correct store in migration
Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
This commit is contained in:
parent
76ec1fbb7d
commit
700944ffa7
@ -11,19 +11,21 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func MigrateStore(ctx sdk.Context, storeKey storetypes.StoreKey, cdc codec.BinaryCodec) error {
|
func MigrateStore(ctx sdk.Context, storeKey storetypes.StoreKey, cdc codec.BinaryCodec) error {
|
||||||
store := prefix.NewStore(ctx.KVStore(storeKey), types.KeyPrefix(types.ActivatedTACounterPrefix))
|
store := prefix.NewStore(ctx.KVStore(storeKey), types.KeyPrefix(types.TrustAnchorKey))
|
||||||
|
|
||||||
count := uint64(0)
|
count := uint64(0)
|
||||||
|
|
||||||
iterator := store.Iterator(nil, nil)
|
iterator := store.Iterator(nil, nil)
|
||||||
defer iterator.Close()
|
defer iterator.Close()
|
||||||
for ; iterator.Valid(); iterator.Next() {
|
for ; iterator.Valid(); iterator.Next() {
|
||||||
|
if iterator.Value()[0] == 1 {
|
||||||
count++
|
count++
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bz := make([]byte, 8)
|
bz := make([]byte, 8)
|
||||||
binary.BigEndian.PutUint64(bz, count)
|
binary.BigEndian.PutUint64(bz, count)
|
||||||
store.Set([]byte{1}, bz)
|
countStore := prefix.NewStore(ctx.KVStore(storeKey), types.KeyPrefix(types.ActivatedTACounterPrefix))
|
||||||
|
countStore.Set([]byte{1}, bz)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user