mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 05:36:46 +00:00
params: add Rules2 (WIP)
This commit is contained in:
parent
0101ffeee9
commit
1a63295458
1 changed files with 38 additions and 0 deletions
38
params/rules2.go
Normal file
38
params/rules2.go
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
// Copyright 2025 The go-ethereum Authors
|
||||
// This file is part of the go-ethereum library.
|
||||
//
|
||||
// The go-ethereum library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// The go-ethereum library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
package params
|
||||
|
||||
import (
|
||||
"github.com/ethereum/go-ethereum/params/forks"
|
||||
)
|
||||
|
||||
// Rules captures the activations of forks at a particular block height.
|
||||
type Rules2 struct {
|
||||
active map[forks.Fork]bool
|
||||
}
|
||||
|
||||
func (cfg *Config2) Rules(blockNum uint64, blockTime uint64) Rules2 {
|
||||
r := Rules2{
|
||||
active: make(map[forks.Fork]bool, len(cfg.activation)),
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
// Active reports whether the given fork is active.
|
||||
func (r *Rules2) Active(f forks.Fork) bool {
|
||||
return r.active[f]
|
||||
}
|
||||
Loading…
Reference in a new issue