mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
core/forkid: add NewStaticFilter
This commit is contained in:
parent
4ca202d988
commit
d9f697c03c
1 changed files with 7 additions and 1 deletions
|
|
@ -80,7 +80,7 @@ func newID(config *params.ChainConfig, genesis common.Hash, head uint64) ID {
|
||||||
return ID{Hash: checksumToBytes(hash), Next: next}
|
return ID{Hash: checksumToBytes(hash), Next: next}
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewFilter creates an filter that returns if a fork ID should be rejected or not
|
// NewFilter creates a filter that returns if a fork ID should be rejected or not
|
||||||
// based on the local chain's status.
|
// based on the local chain's status.
|
||||||
func NewFilter(chain *core.BlockChain) func(id ID) error {
|
func NewFilter(chain *core.BlockChain) func(id ID) error {
|
||||||
return newFilter(
|
return newFilter(
|
||||||
|
|
@ -92,6 +92,12 @@ func NewFilter(chain *core.BlockChain) func(id ID) error {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewStaticFilter creates a filter at block zero.
|
||||||
|
func NewStaticFilter(config *params.ChainConfig, genesis common.Hash) func(id ID) error {
|
||||||
|
head := func() uint64 { return 0 }
|
||||||
|
return newFilter(config, genesis, head)
|
||||||
|
}
|
||||||
|
|
||||||
// newFilter is the internal version of NewFilter, taking closures as its arguments
|
// 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
|
// instead of a chain. The reason is to allow testing it without having to simulate
|
||||||
// an entire blockchain.
|
// an entire blockchain.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue