native: implement HF-based update
A part of #3213. Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
This commit is contained in:
parent
83fdcc8568
commit
d62fad1268
19 changed files with 416 additions and 105 deletions
|
@ -36,9 +36,30 @@ func init() {
|
|||
}
|
||||
}
|
||||
|
||||
// Cmp returns the result of hardforks comparison. It returns:
|
||||
//
|
||||
// -1 if hf < other
|
||||
// 0 if hf == other
|
||||
// +1 if hf > other
|
||||
func (hf Hardfork) Cmp(other Hardfork) int {
|
||||
switch {
|
||||
case hf == other:
|
||||
return 0
|
||||
case hf < other:
|
||||
return -1
|
||||
default:
|
||||
return 1
|
||||
}
|
||||
}
|
||||
|
||||
// IsHardforkValid denotes whether the provided string represents a valid
|
||||
// Hardfork name.
|
||||
func IsHardforkValid(s string) bool {
|
||||
_, ok := hardforks[s]
|
||||
return ok
|
||||
}
|
||||
|
||||
// LatestHardfork returns latest known hardfork.
|
||||
func LatestHardfork() Hardfork {
|
||||
return hfLast >> 1
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue