2022-05-06 12:19:17 +00:00
|
|
|
package config
|
|
|
|
|
|
|
|
//go:generate stringer -type=Hardfork -linecomment
|
|
|
|
|
|
|
|
// Hardfork represents the application hard-fork identifier.
|
|
|
|
type Hardfork byte
|
|
|
|
|
|
|
|
const (
|
2022-05-26 11:04:23 +00:00
|
|
|
// HFAspidochelone represents hard-fork introduced in #2469 (ported from
|
|
|
|
// https://github.com/neo-project/neo/pull/2712) and #2519 (ported from
|
|
|
|
// https://github.com/neo-project/neo/pull/2749).
|
2022-06-03 08:38:03 +00:00
|
|
|
HFAspidochelone Hardfork = 1 << iota // Aspidochelone
|
2023-08-03 16:48:55 +00:00
|
|
|
// HFBasilisk represents hard-fork introduced in #3056 (ported from
|
2023-08-10 11:05:32 +00:00
|
|
|
// https://github.com/neo-project/neo/pull/2881), #3080 (ported from
|
|
|
|
// https://github.com/neo-project/neo/pull/2883) and #3085 (ported from
|
|
|
|
// https://github.com/neo-project/neo/pull/2810).
|
2023-08-03 16:48:55 +00:00
|
|
|
HFBasilisk // Basilisk
|
2022-05-06 12:19:17 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// hardforks holds a map of Hardfork string representation to its type.
|
|
|
|
var hardforks map[string]Hardfork
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
hardforks = make(map[string]Hardfork)
|
2023-08-03 16:48:55 +00:00
|
|
|
for _, hf := range []Hardfork{HFAspidochelone, HFBasilisk} {
|
2022-05-06 12:19:17 +00:00
|
|
|
hardforks[hf.String()] = hf
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// IsHardforkValid denotes whether the provided string represents a valid
|
|
|
|
// Hardfork name.
|
|
|
|
func IsHardforkValid(s string) bool {
|
|
|
|
_, ok := hardforks[s]
|
|
|
|
return ok
|
|
|
|
}
|