Skip to content

Commit

Permalink
Merge pull request #20225 from karalabe/forkid-eth-handshake-verifica…
Browse files Browse the repository at this point in the history
…tion-plus

cmd/devp2p, core/forkid: make forkid.Filter API uniform
  • Loading branch information
karalabe authored Oct 31, 2019
2 parents 93422e9 + 8927f77 commit 12f2a25
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cmd/devp2p/nodesetcmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions core/forkid/forkid.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,15 @@ 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)
}

// 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)
Expand Down

0 comments on commit 12f2a25

Please sign in to comment.