Skip to content

Commit 1a63295

Browse files
committed
params: add Rules2 (WIP)
1 parent 0101ffe commit 1a63295

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

params/rules2.go

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// Copyright 2025 The go-ethereum Authors
2+
// This file is part of the go-ethereum library.
3+
//
4+
// The go-ethereum library is free software: you can redistribute it and/or modify
5+
// it under the terms of the GNU Lesser General Public License as published by
6+
// the Free Software Foundation, either version 3 of the License, or
7+
// (at your option) any later version.
8+
//
9+
// The go-ethereum library is distributed in the hope that it will be useful,
10+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
// GNU Lesser General Public License for more details.
13+
//
14+
// You should have received a copy of the GNU Lesser General Public License
15+
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
16+
17+
package params
18+
19+
import (
20+
"github.com/ethereum/go-ethereum/params/forks"
21+
)
22+
23+
// Rules captures the activations of forks at a particular block height.
24+
type Rules2 struct {
25+
active map[forks.Fork]bool
26+
}
27+
28+
func (cfg *Config2) Rules(blockNum uint64, blockTime uint64) Rules2 {
29+
r := Rules2{
30+
active: make(map[forks.Fork]bool, len(cfg.activation)),
31+
}
32+
return r
33+
}
34+
35+
// Active reports whether the given fork is active.
36+
func (r *Rules2) Active(f forks.Fork) bool {
37+
return r.active[f]
38+
}

0 commit comments

Comments
 (0)