[#112] Remove to v0.9.2 migration code

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
enable-notary-in-public-chains
Alex Vanin 2021-07-22 15:02:01 +03:00 committed by Alex Vanin
parent 9840f29372
commit c7ed05cc2e
2 changed files with 0 additions and 50 deletions

View File

@ -67,8 +67,6 @@ func _deploy(data interface{}, isUpdate bool) {
ctx := storage.GetContext()
if isUpdate {
migrateContainerLists(ctx) // from v0.9.1 to v0.9.2
migrateEstimationStorage(ctx) // from v0.9.1 to v0.9.2
return
}
@ -102,35 +100,6 @@ func _deploy(data interface{}, isUpdate bool) {
runtime.Log("container contract initialized")
}
func migrateContainerLists(ctx storage.Context) {
const ownersKey = "ownersList"
containers := getAllContainers(ctx)
for i := range containers {
containerID := containers[i]
ownerID := getOwnerByID(ctx, containerID)
containerListKey := append(ownerID, containerID...)
storage.Put(ctx, containerListKey, containerID)
storage.Delete(ctx, ownerID)
}
storage.Delete(ctx, ownersKey)
}
func migrateEstimationStorage(ctx storage.Context) {
// In fact, this method does not migrate estimation storage because this data
// is valid only for one epoch. Migration routine will be quite complex, so
// it makes sense to clean all remaining estimations and wait for new one.
it := storage.Find(ctx, []byte(estimateKeyPrefix), storage.KeysOnly)
for iterator.Next(it) {
key := iterator.Value(it).([]byte)
storage.Delete(ctx, key)
}
}
// Migrate method updates contract source code and manifest. Can be invoked
// only by contract owner.
func Migrate(script []byte, manifest []byte, data interface{}) bool {

View File

@ -65,7 +65,6 @@ func _deploy(data interface{}, isUpdate bool) {
ctx := storage.GetContext()
if isUpdate {
migrateNetmapCandidates(ctx) // from v0.9.1 to v0.9.2
return
}
@ -114,24 +113,6 @@ func _deploy(data interface{}, isUpdate bool) {
runtime.Log("netmap contract initialized")
}
func migrateNetmapCandidates(ctx storage.Context) {
const netmapKey = "netmap"
data := storage.Get(ctx, netmapKey)
if data == nil {
return
}
candidates := std.Deserialize(data.([]byte)).([]netmapNode)
for i := range candidates {
candidate := candidates[i]
addToNetmap(ctx, candidate.node)
}
storage.Delete(ctx, netmapKey)
}
// Migrate method updates contract source code and manifest. Can be invoked
// only by contract owner.
func Migrate(script []byte, manifest []byte, data interface{}) bool {