neoneo-go/pkg/config/hardfork.go
Anna Shaleva 2872c1c668 core: move contract notifications check under HFBasilisk
Follow the https://github.com/neo-project/neo/pull/2884.
A part of the https://github.com/neo-project/neo/pull/2810.
Fix failing tests along the way (a lot of them have invalid notifications
format which differs from the one declared in manifest).

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-08-18 16:40:20 +03:00

35 lines
1.1 KiB
Go

package config
//go:generate stringer -type=Hardfork -linecomment
// Hardfork represents the application hard-fork identifier.
type Hardfork byte
const (
// 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).
HFAspidochelone Hardfork = 1 << iota // Aspidochelone
// HFBasilisk represents hard-fork introduced in #3056 (ported from
// 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).
HFBasilisk // Basilisk
)
// hardforks holds a map of Hardfork string representation to its type.
var hardforks map[string]Hardfork
func init() {
hardforks = make(map[string]Hardfork)
for _, hf := range []Hardfork{HFAspidochelone, HFBasilisk} {
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
}