mirror of https://github.com/status-im/op-geth.git
cmd/devp2p, core/forkid: make forkid.Filter API uniform
This commit is contained in:
parent
93422e9d15
commit
8927f7724a
|
@ -155,7 +155,7 @@ func minAgeFilter(args []string) (nodeFilter, error) {
|
|||
}
|
||||
|
||||
func ethFilter(args []string) (nodeFilter, error) {
|
||||
var filter func(forkid.ID) error
|
||||
var filter forkid.Filter
|
||||
switch args[0] {
|
||||
case "mainnet":
|
||||
filter = forkid.NewStaticFilter(params.MainnetChainConfig, params.MainnetGenesisHash)
|
||||
|
|
|
@ -96,7 +96,7 @@ func NewFilter(chain *core.BlockChain) Filter {
|
|||
}
|
||||
|
||||
// NewStaticFilter creates a filter at block zero.
|
||||
func NewStaticFilter(config *params.ChainConfig, genesis common.Hash) func(id ID) error {
|
||||
func NewStaticFilter(config *params.ChainConfig, genesis common.Hash) Filter {
|
||||
head := func() uint64 { return 0 }
|
||||
return newFilter(config, genesis, head)
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ func NewStaticFilter(config *params.ChainConfig, genesis common.Hash) func(id ID
|
|||
// newFilter is the internal version of NewFilter, taking closures as its arguments
|
||||
// instead of a chain. The reason is to allow testing it without having to simulate
|
||||
// an entire blockchain.
|
||||
func newFilter(config *params.ChainConfig, genesis common.Hash, headfn func() uint64) func(id ID) error {
|
||||
func newFilter(config *params.ChainConfig, genesis common.Hash, headfn func() uint64) Filter {
|
||||
// Calculate the all the valid fork hash and fork next combos
|
||||
var (
|
||||
forks = gatherForks(config)
|
||||
|
|
Loading…
Reference in New Issue