[#103] common: Disallow downgrading contracts
`PrevVersion` marks suitable version that we can upgrade from. However, we can have multiple minor versions, so, currently an upgrade from v0.19.3 to v0.19.1 is possible. Prevent this with an additional check. Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
82e04b6c32
commit
ba7329c3a7
1 changed files with 1 additions and 1 deletions
|
@ -32,7 +32,7 @@ func CheckVersion(from int) {
|
||||||
if from < PrevVersion {
|
if from < PrevVersion {
|
||||||
panic(ErrVersionMismatch + ": expected >=" + std.Itoa(PrevVersion, 10))
|
panic(ErrVersionMismatch + ": expected >=" + std.Itoa(PrevVersion, 10))
|
||||||
}
|
}
|
||||||
if from == Version {
|
if Version <= from {
|
||||||
panic(ErrAlreadyUpdated + ": " + std.Itoa(Version, 10))
|
panic(ErrAlreadyUpdated + ": " + std.Itoa(Version, 10))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue